added basic start/stop functionality for containers. connection setup etc. still missing.
diff --git a/emuvim/api/zerorpcapi.py b/emuvim/api/zerorpcapi.py
index 88d7740..7be3f60 100644
--- a/emuvim/api/zerorpcapi.py
+++ b/emuvim/api/zerorpcapi.py
@@ -44,10 +44,14 @@
def compute_action_start(self, dc_name, compute_name):
# TODO return UUID / IP ?
- logging.info("compute start")
+ logging.debug("RPC CALL: compute start")
+ if dc_name in self.dcs:
+ self.dcs[dc_name].addCompute(compute_name)
def compute_action_stop(self, dc_name, compute_name):
logging.info("compute stop")
+ if dc_name in self.dcs:
+ self.dcs[dc_name].removeCompute(compute_name)
def compute_list(self):
pass
diff --git a/emuvim/cli/__main__.py b/emuvim/cli/__main__.py
index 771049b..95ce01e 100644
--- a/emuvim/cli/__main__.py
+++ b/emuvim/cli/__main__.py
@@ -15,7 +15,7 @@
# do some API tests
print c.compute_action_start("dc2", "my_new_container1")
- time.sleep(5)
+ time.sleep(10)
print c.compute_action_stop("dc2", "my_new_container1")
diff --git a/emuvim/dcemulator/node.py b/emuvim/dcemulator/node.py
index b095e19..3111735 100644
--- a/emuvim/dcemulator/node.py
+++ b/emuvim/dcemulator/node.py
@@ -39,8 +39,12 @@
def start(self):
pass
- def addCompute(self):
- pass
+ def addCompute(self, name):
+ #TODO remove mnet shortcut to have a clean API
+ #TODO connect container to DC's swtich
+ self.net.mnet.addDocker("%s.%s" % (self.name, name), dimage="ubuntu")
- def removeCompute(self):
- pass
+ def removeCompute(self, name):
+ #TODO remove mnet shortcut to have a clean API
+ #TODO disconnect container to DC's swtich
+ self.net.mnet.removeDocker("%s.%s" % (self.name, name))