Also support the usual CMD field in images 23/7323/4
authorschillinge <ablu@mail.uni-paderborn.de>
Thu, 14 Mar 2019 21:46:14 +0000 (22:46 +0100)
committerschillinge <ablu@mail.uni-paderborn.de>
Mon, 18 Mar 2019 13:34:02 +0000 (14:34 +0100)
For backwards-compatibility the SON_EMU_CMD/VIM_EMU_CMD commands still
surpress this, but otherwise the usual ENTRYPOINT + CMD logic should be
working with this + commit 83b52502743eb29e5e0b8e33e6aa119a5005c676 in
containernet.

Since the caching of the build server prevents a automatic Containernet
update to latest master, an explicit commit hash is given. This will
allow explicit updates when required while still supporting caching.

Comment wording above checkout is from Manuel Peuster.

Change-Id: Ic01f87acb5f9e79d09baae499f3d353c2c0aca9e
Signed-off-by: schillinge <ablu@mail.uni-paderborn.de>
Dockerfile
src/emuvim/api/openstack/compute.py
src/emuvim/api/rest/compute.py

index cccecdf..b77c268 100755 (executable)
@@ -47,7 +47,9 @@ RUN apt-get update \
     sudo
 
 # install containernet (using its Ansible playbook)
-RUN git clone https://github.com/containernet/containernet.git
+# Attention: Containernet installation fixed to specific commit. Change to update to latest Containernet version.
+RUN git clone https://github.com/containernet/containernet.git && \
+    (cd containernet && git checkout bc269d6f1cf9f50f71fda65c25fe1f2f4c1573b7)
 WORKDIR /containernet/ansible
 RUN ansible-playbook -i "localhost," -c local --skip-tags "notindocker" install.yml
 
index 873daa4..9d77a44 100755 (executable)
@@ -493,6 +493,7 @@ class OpenstackCompute(object):
         # Start the real emulator command now as specified in the dockerfile
         config = c.dcinfo.get("Config", dict())
         env = config.get("Env", list())
+        legacy_command_execution = False
         for env_var in env:
             var, cmd = map(str.strip, map(str, env_var.split('=', 1)))
             if var == "SON_EMU_CMD" or var == "VIM_EMU_CMD":
@@ -503,7 +504,10 @@ class OpenstackCompute(object):
                 t = threading.Thread(target=c.cmdPrint, args=(cmd,))
                 t.daemon = True
                 t.start()
+                legacy_command_execution = True
                 break  # only execute one command
+        if not legacy_command_execution:
+            c.start()
 
     def stop_compute(self, server):
         """
index aec010e..7a12c68 100755 (executable)
@@ -79,6 +79,7 @@ class Compute(Resource):
             try:
                 config = c.dcinfo.get("Config", dict())
                 env = config.get("Env", list())
+                legacy_command_execution = False
                 for env_var in env:
                     var, cmd = map(str.strip, map(str, env_var.split('=', 1)))
                     logging.debug("%r = %r" % (var, cmd))
@@ -90,6 +91,10 @@ class Compute(Resource):
                         t = threading.Thread(target=c.cmdPrint, args=(cmd,))
                         t.daemon = True
                         t.start()
+                        legacy_command_execution = True
+                        break
+                if not legacy_command_execution:
+                    c.start()
             except Exception as ex:
                 logging.warning("Couldn't run Docker entry point VIM_EMU_CMD")
                 logging.exception("Exception:")