Fix: Name shortening. Still an ugly fix but ok for now.
authorpeusterm <manuel.peuster@uni-paderborn.de>
Mon, 26 Jun 2017 07:59:12 +0000 (09:59 +0200)
committerpeusterm <manuel.peuster@uni-paderborn.de>
Tue, 11 Jul 2017 12:18:02 +0000 (14:18 +0200)
src/emuvim/api/openstack/compute.py

index 38796cf..be4324c 100755 (executable)
@@ -519,14 +519,17 @@ class OpenstackCompute(object):
             self.computeUnits[server.id] = server
         return server
 
-    def _shorten_server_name(self, name, char_limit=64):
+    def _shorten_server_name(self, name, char_limit=9):
         """
         Docker does not like too long instance names.
         This function provides a shorter name if needed
         """
+        # TODO this is a ugly hack and needs to be fixed
         LOG.debug("Long server name: {}".format(name))
         if len(name) > char_limit:
             # construct a short name
+            parts = name.split("_")
+            name = name.replace("_vnf", "")
             name = name[-char_limit:].strip("-_ .")
         LOG.debug("Short server name: {}".format(name))
         return name