add f9 to the list of known pldistros
[nodemanager.git] / sliver_vs.py
index 5167ba0..ab9a716 100644 (file)
@@ -89,12 +89,15 @@ class Sliver_VS(accounts.Account, vserver.VServer):
             # default
             default=file("/etc/planetlab/slicefamily").read().strip()
             (pldistro,fcdistro,arch) = default.split("-")
+
+            known_archs = [ 'i386', 'x86_64' ]
+            known_fcdistros = [ 'f8', 'f9', 'centos5' ]
             # from the slice attribute: cut dashes and try to figure the meaning
             slice_wishes = vref.split("-")
             for wish in slice_wishes:
-                if wish == "i386" or wish == "x86_64":
+                if wish in known_archs:
                     arch=wish
-                elif wish == "f8" or wish == "centos5" :
+                elif wish in known_fcdistros:
                     fcdistro=wish
                 else:
                     pldistro=wish
@@ -156,19 +159,6 @@ class Sliver_VS(accounts.Account, vserver.VServer):
             time.sleep(delay)
             # VServer.start calls fork() internally
             vserver.VServer.start(self)
-            # Watch for 5 mins to see if slice is running before setting the name
-            # It would make sense to do this as part of start in VServer, but the name
-            # comes from NM.  Also, the name would only change in NM.  Name can only be
-            # set from root context, so overloading chcontext wont work;  chcontext, setname
-            # will fail, and in the converse the context isn't setup in the kernel.
-            for i in range(0,60):
-                time.sleep(5)
-                if vserver.VServer.is_running(self):
-                    # Set the vciVHI_CONTEXT to slice_id for 
-                    # fprobe-ulog to mark packets with.
-                    logger.log("%s: Setting name to %s" % (self.name, self.slice_id),2)
-                    self.setname(self.slice_id)
-                    break
 
         else: logger.log('%s: not starting, is not enabled' % self.name)
         self.initscriptchanged = False
@@ -232,6 +222,10 @@ class Sliver_VS(accounts.Account, vserver.VServer):
                 (self.name, self.rspec['ip_addresses']))
             self.set_ipaddresses_config(self.rspec['ip_addresses'])
 
+            if self.is_running():
+                logger.log("%s: Setting name to %s" % (self.name, self.slice_id),2)
+                self.setname(self.slice_id)
             if False: # Does not work properly yet.
                 if self.have_limits_changed():
                     logger.log('%s: limits have changed --- restarting' % self.name)