def warm_configs(self): warm_pws = list() mq_type = nhelper.canon_mq_type(self.get_option("mq")) if mq_type == "rabbit": warm_pws.append(["rabbit", rhelper.PW_USER_PROMPT]) driver_canon = nhelper.canon_virt_driver(self.cfg.get("nova", "virt_driver")) if driver_canon == "xenserver": warm_pws.append(["xenapi_connection", "the Xen API connection"]) for pw_key, pw_prompt in warm_pws: self.cfg.get_password(pw_key, pw_prompt)
def configure(self): configs_made = nova.NovaInstaller.configure(self) driver_canon = nhelper.canon_virt_driver(self.cfg.get('nova', 'virt_driver')) if driver_canon == 'libvirt': (fn, contents) = self._get_policy(self._get_policy_users()) dirs_made = list() with sh.Rooted(True): # TODO check if this dir is restricted before assuming it isn't? dirs_made.extend(sh.mkdirslist(sh.dirname(fn))) sh.write_file(fn, contents) self.tracewriter.cfg_file_written(fn) self.tracewriter.dirs_made(*dirs_made) configs_made += 1 return configs_made
def pre_start(self): # Let the parent class do its thing comp.PythonRuntime.pre_start(self) virt_driver = nhelper.canon_virt_driver(self.cfg.get("nova", "virt_driver")) if virt_driver == "libvirt": # FIXME: The configuration for the virtualization-type # should come from the persona. virt_type = lv.canon_libvirt_type(self.cfg.get("nova", "libvirt_type")) LOG.info( "Checking that your selected libvirt virtualization type %s is working and running.", colorizer.quote(virt_type), ) try: self.virsh.check_virt(virt_type) self.virsh.restart_service() LOG.info("Libvirt virtualization type %s seems to be working and running.", colorizer.quote(virt_type)) except exceptions.ProcessExecutionError as e: msg = ( "Libvirt type %r does not seem to be active or configured correctly, " "perhaps you should be using %r instead: %s" % (virt_type, lv.DEF_VIRT_TYPE, e) ) raise exceptions.StartException(msg)
def _clear_libvirt_domains(self): virt_driver = nhelper.canon_virt_driver(self.cfg.get("nova", "virt_driver")) if virt_driver == "libvirt": inst_prefix = self.cfg.getdefaulted("nova", "instance_name_prefix", DEF_INSTANCE_PREFIX) libvirt_type = lv.canon_libvirt_type(self.cfg.get("nova", "libvirt_type")) self.virsh.clear_domains(libvirt_type, inst_prefix)