X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sliver_vs.py;h=432704cdc3df7bdbf550ab3417bc08f452d3cf50;hb=refs%2Fheads%2Fpackaging;hp=1d90f16c544a7872f1676dc24d5e0e6d60a4cc9d;hpb=6ec82e6a49df218bcbf4337d85d8d87dc8273824;p=nodemanager.git diff --git a/sliver_vs.py b/sliver_vs.py index 1d90f16..432704c 100644 --- a/sliver_vs.py +++ b/sliver_vs.py @@ -134,8 +134,15 @@ class Sliver_VS(vserver.VServer, Account, Initscript): @staticmethod def destroy(name): + # need to umount before we trash, otherwise we end up with sequels in + # /vservers/slicename/ (namely in home/ ) + # also because this is a static method we cannot check for 'omf_control' + # but it is no big deal as umount_ssh_dir checks before it umounts.. + Account.umount_ssh_dir(name) + logger.log("sliver_vs: destroying %s"%name) logger.log_call(['/bin/bash','-x','/usr/sbin/vuserdel', name, ]) + def configure(self, rec): # in case we update nodemanager.. self.install_and_enable_vinit() @@ -153,25 +160,25 @@ class Sliver_VS(vserver.VServer, Account, Initscript): def start(self, delay=0): if self.rspec['enabled'] <= 0: logger.log('sliver_vs: not starting %s, is not enabled'%self.name) + return + logger.log('sliver_vs: %s: starting in %d seconds' % (self.name, delay)) + time.sleep(delay) + # the generic /etc/init.d/vinit script is permanently refreshed, and enabled + self.install_and_enable_vinit() + # expose .ssh for omf_friendly slivers + if 'omf_control' in self.rspec['tags']: + Account.mount_ssh_dir(self.name) + # if a change has occured in the slice initscript, reflect this in /etc/init.d/vinit.slice + self.refresh_slice_vinit() + 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() + vserver.VServer.start(self) + os._exit(0) else: - logger.log('sliver_vs: %s: starting in %d seconds' % (self.name, delay)) - time.sleep(delay) - # the generic /etc/init.d/vinit script is permanently refreshed, and enabled - self.install_and_enable_vinit() - # expose .ssh for omf_friendly slivers - if 'omf_control' in self.rspec['tags']: - self.expose_ssh_dir() - # if a change has occured in the slice initscript, reflect this in /etc/init.d/vinit.slice - self.refresh_slice_vinit() - 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() - vserver.VServer.start(self) - os._exit(0) - else: - os.waitpid(child_pid, 0) + os.waitpid(child_pid, 0) def stop(self): logger.log('sliver_vs: %s: stopping' % self.name)