X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sliver_vs.py;h=58798c53fa8b674268c537dbe003f100622961e0;hb=2bea6afe154924341f57f7b8633b9ca87b53b82f;hp=1ada697ca3b2df2922605db409581a3e9dd3134e;hpb=be193a6a83281b91afb18ab6b26eb6ea4eea840c;p=nodemanager.git diff --git a/sliver_vs.py b/sliver_vs.py index 1ada697..58798c5 100644 --- a/sliver_vs.py +++ b/sliver_vs.py @@ -18,6 +18,7 @@ don't have to guess if there is a running process or not. import errno import os +import time import vserver import accounts @@ -26,7 +27,7 @@ import tools class Sliver_VS(accounts.Account, vserver.VServer): - """This class wraps vserver.VServer to make its interface closer to what we need for the Node Manager.""" + """This class wraps vserver.VServer to make its interface closer to what we need.""" SHELL = '/bin/vsh' TYPE = 'sliver.VServer' @@ -65,13 +66,14 @@ class Sliver_VS(accounts.Account, vserver.VServer): accounts.Account.configure(self, rec) # install ssh keys - def start(self): + def start(self, delay=0): if self.rspec['enabled']: - logger.log('%s: starting' % self.name) + logger.log('%s: starting in %d seconds' % (self.name, delay)) child_pid = os.fork() if child_pid == 0: # VServer.start calls fork() internally, so just close the nonstandard fds and fork once to avoid creating zombies tools.close_nonstandard_fds() + time.sleep(delay) vserver.VServer.start(self, True) os._exit(0) else: os.waitpid(child_pid, 0)