X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sliver_lxc.py;h=babac351500895504eeaa3dfb3a1b4b3030a2574;hb=b30253ecb183f8419cffef4ac28dbba114d8815c;hp=b7cd45f4e101b1d053d95d5edfa4d9ea64f37b41;hpb=b266b22c0fce1a4c9d8c2f1bcfbbe876601fee55;p=nodemanager.git diff --git a/sliver_lxc.py b/sliver_lxc.py index b7cd45f..babac35 100644 --- a/sliver_lxc.py +++ b/sliver_lxc.py @@ -64,18 +64,25 @@ class Sliver_LXC(Sliver_Libvirt, Initscript): # if a change has occured in the slice initscript, reflect this in /etc/init.d/vinit.slice self.refresh_slice_vinit() - def rerun_slice_vinit (self): - """This is called whenever the initscript code changes""" - # xxx - todo - not sure exactly how to: - # (.) invoke something in the guest - # (.) which options of systemctl should be used to trigger a restart - # should not prevent the first run from going fine hopefully - logger.log("WARNING: sliver_lxc.rerun_slice_vinit not implemented yet") - + def rerun_slice_vinit(self): + """This is called at startup, and whenever the initscript code changes""" + logger.log("sliver_lxc.rerun_slice_vinit {}".format(self.name)) + plain = "virsh -c lxc:/// lxc-enter-namespace --noseclabel -- {} /usr/bin/systemctl --system daemon-reload"\ + .format(self.name) + command = plain.split() + logger.log_call(command, timeout=3) + plain = "virsh -c lxc:/// lxc-enter-namespace --noseclabel -- {} /usr/bin/systemctl restart vinit.service"\ + .format(self.name) + command = plain.split() + logger.log_call(command, timeout=3) + + @staticmethod def create(name, rec=None): - ''' Create dirs, copy fs image, lxc_create ''' - logger.verbose ('sliver_lxc: %s create'%(name)) + ''' + Create dirs, copy fs image, lxc_create + ''' + logger.verbose('sliver_lxc: %s create' % name) conn = Sliver_Libvirt.getConnection(Sliver_LXC.TYPE) vref = rec['vref']