From 7973f056b636b5eaef7d0d5b330bccecddda8588 Mon Sep 17 00:00:00 2001 From: peusterm Date: Fri, 29 Jan 2016 14:38:05 +0100 Subject: [PATCH] added image argument to CLI --- README.md | 2 +- emuvim/api/zerorpcapi.py | 4 ++-- emuvim/cli/compute.py | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7d75760..a9d48b3 100644 --- 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 diff --git a/emuvim/api/zerorpcapi.py b/emuvim/api/zerorpcapi.py index 8a08131..be44444 100644 --- a/emuvim/api/zerorpcapi.py +++ b/emuvim/api/zerorpcapi.py @@ -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.") diff --git a/emuvim/cli/compute.py b/emuvim/cli/compute.py index c5f2231..9f1030f 100644 --- a/emuvim/cli/compute.py +++ b/emuvim/cli/compute.py @@ -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. -- 2.17.1