+ def __init__(self, rec):
+ name = rec['name']
+ Sliver_Libvirt.__init__(self, rec)
+ Initscript.__init__(self, name)
+
+ def configure(self, rec):
+ logger.log('========== sliver_lxc.configure {}'.format(self.name))
+ Sliver_Libvirt.configure(self, rec)
+
+ # in case we update nodemanager..
+ self.install_and_enable_vinit()
+ # do the configure part from Initscript
+ Initscript.configure(self, rec)
+
+ # remember configure() always gets called *before* start()
+ # in particular the slice initscript
+ # is expected to be in place already at this point
+ def start(self, delay=0):
+ logger.log('==================== sliver_lxc.start {}'.format(self.name))
+ if 'enabled' in self.rspec and self.rspec['enabled'] <= 0:
+ logger.log('sliver_lxc: not starting {}, is not enabled'.format(self.name))
+ return
+ # the generic /etc/init.d/vinit script is permanently refreshed, and enabled
+ self.install_and_enable_vinit()
+ # expose .ssh for omf_friendly slivers
+ if 'tags' in self.rspec and 'omf_control' in self.rspec['tags']:
+ Account.mount_ssh_dir(self.name)
+# logger.log("NM is exiting for debug - just about to start {}".format(self.name))
+# exit(0)
+ Sliver_Libvirt.start(self, delay)
+
+ 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)
+
+