added image argument to CLI
authorpeusterm <manuel.peuster@uni-paderborn.de>
Fri, 29 Jan 2016 13:38:05 +0000 (14:38 +0100)
committerpeusterm <manuel.peuster@uni-paderborn.de>
Fri, 29 Jan 2016 13:38:05 +0000 (14:38 +0100)
README.md
emuvim/api/zerorpcapi.py
emuvim/cli/compute.py

index 7d75760..a9d48b3 100644 (file)
--- a/README.md
+++ b/README.md
@@ -76,7 +76,7 @@ Automatic installation is provide through an Ansible playbook.
  * list active compute resources
 * Cloud-like reference API with CLI for demonstrations
  * Write CLI client
- * Start compute
+ * Start compute (name, DC, image)
  * Stop compute
 * Create an Ansible-based automatic installation routine
 * Unit tests
index 8a08131..be44444 100644 (file)
@@ -56,11 +56,11 @@ class MultiDatacenterApi(object):
     def __init__(self, dcs):
         self.dcs = dcs
 
-    def compute_action_start(self, dc_name, compute_name):
+    def compute_action_start(self, dc_name, compute_name, image):
         # TODO what to return UUID / given name / internal name ?
         logging.debug("RPC CALL: compute start")
         try:
-            c = self.dcs.get(dc_name).startCompute(compute_name)
+            c = self.dcs.get(dc_name).startCompute(compute_name, image=image)
             return str(c.name)
         except Exception as ex:
             logging.exception("RPC error.")
index c5f2231..9f1030f 100644 (file)
@@ -28,7 +28,7 @@ class ZeroRpcClient(object):
 
     def start(self, args):
         r = self.c.compute_action_start(
-            args.get("datacenter"), args.get("name"))
+            args.get("datacenter"), args.get("name"), args.get("image"))
         pp.pprint(r)
 
     def stop(self, args):
@@ -77,6 +77,8 @@ parser.add_argument(
     "--datacenter", "-d", dest="datacenter", help="Data center.")
 parser.add_argument(
     "--name", "-n", dest="name", help="Compute name.")
+parser.add_argument(
+    "--image", "-i", dest="image", help="Name of container image to be used.")
 # TODO: IP, image, etc. pp.