added basic start/stop functionality for containers. connection setup etc. still...
authorpeusterm <manuel.peuster@uni-paderborn.de>
Wed, 6 Jan 2016 16:14:40 +0000 (17:14 +0100)
committerpeusterm <manuel.peuster@uni-paderborn.de>
Wed, 6 Jan 2016 16:14:40 +0000 (17:14 +0100)
emuvim/api/zerorpcapi.py
emuvim/cli/__main__.py
emuvim/dcemulator/node.py

index 88d7740..7be3f60 100644 (file)
@@ -44,10 +44,14 @@ class MultiDatacenterApi(object):
 
     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
index 771049b..95ce01e 100644 (file)
@@ -15,7 +15,7 @@ def main():
     # 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")
 
index b095e19..3111735 100644 (file)
@@ -39,8 +39,12 @@ class Datacenter(object):
     def start(self):
         pass
 
-    def addCompute(self):
-        pass
-
-    def removeCompute(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, 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))