Beispiel #1
0
 def _clear_libvirt_domains(self):
     virt_driver = nhelper.canon_virt_driver(self.get_option('virt_driver'))
     if virt_driver == 'libvirt':
         inst_prefix = self.get_option('instance_name_prefix', 'instance-')
         libvirt_type = lv.canon_libvirt_type(
             self.get_option('libvirt_type'))
         self.virsh.clear_domains(libvirt_type, inst_prefix)
Beispiel #2
0
 def _fix_virt(self):
     virt_driver = nhelper.canon_virt_driver(self.get_option("virt_driver"))
     if virt_driver == "libvirt":
         virt_type = lv.canon_libvirt_type(self.get_option("libvirt_type"))
         if virt_type == "qemu":
             # On RHEL it appears a sym-link needs to be created
             # to enable qemu to actually work, apparently fixed
             # in RHEL 6.4.
             #
             # See: http://fedoraproject.org/wiki/Getting_started_with_OpenStack_EPEL
             if not sh.isfile("/usr/bin/qemu-system-x86_64"):
                 sh.symlink("/usr/libexec/qemu-kvm", "/usr/bin/qemu-system-x86_64", tracewriter=self.tracewriter)
Beispiel #3
0
 def _fix_virt(self):
     virt_driver = nhelper.canon_virt_driver(self.get_option('virt_driver'))
     if virt_driver == 'libvirt':
         virt_type = lv.canon_libvirt_type(self.get_option('libvirt_type'))
         if virt_type == 'qemu':
             # On RHEL it appears a sym-link needs to be created
             # to enable qemu to actually work, apparently fixed
             # in RHEL 6.4.
             #
             # See: http://fedoraproject.org/wiki/Getting_started_with_OpenStack_EPEL
             if not sh.isfile('/usr/bin/qemu-system-x86_64'):
                 sh.symlink('/usr/libexec/qemu-kvm',
                            '/usr/bin/qemu-system-x86_64',
                            tracewriter=self.tracewriter)
Beispiel #4
0
 def configure(self):
     configs_made = nova.NovaInstaller.configure(self)
     driver_canon = nhelper.canon_virt_driver(self.get_option('virt_driver'))
     if driver_canon == 'libvirt':
         # Create a libvirtd user group
         if not sh.group_exists('libvirtd'):
             cmd = ['groupadd', 'libvirtd']
             sh.execute(*cmd, run_as_root=True)
         if not sh.isfile(LIBVIRT_POLICY_FN):
             contents = self._get_policy(self._get_policy_users())
             with sh.Rooted(True):
                 sh.mkdirslist(sh.dirname(LIBVIRT_POLICY_FN))
                 sh.write_file(LIBVIRT_POLICY_FN, contents)
             configs_made += 1
     return configs_made
Beispiel #5
0
 def pre_start(self):
     # Let the parent class do its thing
     comp.PythonRuntime.pre_start(self)
     virt_driver = nhelper.canon_virt_driver(self.get_option('virt_driver'))
     if virt_driver == 'libvirt':
         virt_type = lv.canon_libvirt_type(self.get_option('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)
Beispiel #6
0
 def pre_start(self):
     # Let the parent class do its thing
     comp.PythonRuntime.pre_start(self)
     virt_driver = nhelper.canon_virt_driver(self.get_option('virt_driver'))
     if virt_driver == 'libvirt':
         virt_type = lv.canon_libvirt_type(self.get_option('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 excp.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 excp.StartException(msg)
Beispiel #7
0
 def _clear_libvirt_domains(self):
     virt_driver = nhelper.canon_virt_driver(self.get_option('virt_driver'))
     if virt_driver == 'libvirt':
         inst_prefix = self.get_option('instance_name_prefix', 'instance-')
         libvirt_type = lv.canon_libvirt_type(self.get_option('libvirt_type'))
         self.virsh.clear_domains(libvirt_type, inst_prefix)
Beispiel #8
0
 def _clear_libvirt_domains(self):
     virt_driver = nhelper.canon_virt_driver(self.get_option("virt_driver"))
     if virt_driver == "libvirt":
         inst_prefix = self.get_option("instance_name_prefix", default_value="instance-")
         libvirt_type = lv.canon_libvirt_type(self.get_option("libvirt_type"))
         self.virsh.clear_domains(libvirt_type, inst_prefix)