Example #1
0
 def clean(self):
     virsh = lv.Virsh(self.uninstaller.get_int_option('service_wait_seconds'), self.uninstaller.distro)
     virt_driver = utils.canon_virt_driver(self.uninstaller.get_option('virt_driver'))
     if virt_driver == 'libvirt':
         inst_prefix = self.uninstaller.get_option('instance_name_prefix', default_value='instance-')
         libvirt_type = lv.canon_libvirt_type(self.uninstaller.get_option('libvirt_type'))
         virsh.clear_domains(libvirt_type, inst_prefix)
Example #2
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)
Example #3
0
 def clean(self):
     virsh = lv.Virsh(self.uninstaller.get_int_option("service_wait_seconds"), self.uninstaller.distro)
     virt_driver = utils.canon_virt_driver(self.uninstaller.get_option("virt_driver"))
     if virt_driver == "libvirt":
         inst_prefix = self.uninstaller.get_option("instance_name_prefix", default_value="instance-")
         libvirt_type = lv.canon_libvirt_type(self.uninstaller.get_option("libvirt_type"))
         virsh.clear_domains(libvirt_type, inst_prefix)
Example #4
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)
Example #5
0
 def clean(self):
     virsh = lv.Virsh(
         self.uninstaller.get_int_option('service_wait_seconds'),
         self.uninstaller.distro)
     virt_driver = utils.canon_virt_driver(
         self.uninstaller.get_option('virt_driver'))
     if virt_driver == 'libvirt':
         inst_prefix = self.uninstaller.get_option(
             'instance_name_prefix', default_value='instance-')
         libvirt_type = lv.canon_libvirt_type(
             self.uninstaller.get_option('libvirt_type'))
         virsh.clear_domains(libvirt_type, inst_prefix)
Example #6
0
 def _fix_virt(self):
     virt_driver = utils.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)
Example #7
0
 def _fix_virt(self):
     virt_driver = utils.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)
Example #8
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)
Example #9
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)
Example #10
0
    def _config_adjust_api(self, nova_conf):
        '''This method has the smarts to build the configuration file based on
           various runtime values. A useful reference for figuring out this
           is at http://docs.openstack.org/diablo/openstack-compute/admin/content/ch_configuring-openstack-compute.html
           See also: https://github.com/openstack/nova/blob/master/etc/nova/nova.conf.sample
        '''

        # Used more than once so we calculate it ahead of time
        hostip = self.installer.get_option('ip')

        nova_conf.add('verbose', self.installer.get_bool_option('log_verbose'))
        nova_conf.add('state_path', '/var/lib/nova')
        nova_conf.add('log_dir', '/var/log/nova')
        nova_conf.add('bindir', '/usr/bin')

        # Allow destination machine to match source for resize.
        nova_conf.add('allow_resize_to_same_host', True)

        # Which scheduler do u want?
        nova_conf.add('compute_scheduler_driver',
                      self.installer.get_option('scheduler', default_value='nova.scheduler.filter_scheduler.FilterScheduler'))

        # Rate limit the api??
        nova_conf.add('api_rate_limit', self.installer.get_bool_option('api_rate_limit'))

        # Ensure the policy.json is referenced correctly
        nova_conf.add('policy_file', '/etc/nova/policy.json')

        # Setup nova network/settings
        self._configure_network_settings(nova_conf)

        # The ip of where we are running
        nova_conf.add('my_ip', hostip)

        # Setup how the database will be connected.
        nova_conf.add('sql_connection', self.fetch_dbdsn())

        # Configure anything libvirt related?
        virt_driver = utils.canon_virt_driver(self.installer.get_option('virt_driver'))
        if virt_driver == 'libvirt':
            self._configure_libvirt(lv.canon_libvirt_type(self.installer.get_option('libvirt_type')), nova_conf)

        # How instances will be presented
        instance_template = "%s%s" % (self.installer.get_option('instance_name_prefix'),
                                      self.installer.get_option('instance_name_postfix'))
        if not instance_template:
            instance_template = 'instance-%08x'
        nova_conf.add('instance_name_template', instance_template)

        # Enable the standard extensions
        nova_conf.add('osapi_compute_extension',
                      'nova.api.openstack.compute.contrib.standard_extensions')

        # Auth will be using keystone
        nova_conf.add('auth_strategy', 'keystone')

        # Is config drive being forced on?
        if self.installer.get_bool_option('force_cfg_drive'):
            nova_conf.add('force_config_drive', 'always')

        # Don't always force images to raw, which makes things take time to get to raw...
        nova_conf.add('force_raw_images', self.installer.get_bool_option('force_raw_images'))

        # Add a checksum for images fetched for each hypervisor?
        # This check absorbs cpu cycles, warning....
        nova_conf.add('checksum_base_images', self.installer.get_bool_option('checksum_base_images'))

        # Setup the interprocess locking directory (don't put me on shared storage)
        nova_conf.add('lock_path', '/var/lock/nova')

        # Vnc settings setup
        self._configure_vnc(nova_conf)

        # Where our paste config is
        nova_conf.add('api_paste_config', self.target_config(PASTE_CONF))

        # What our imaging service will be
        self._configure_image_service(nova_conf, hostip)

        # Configs for ec2 / s3 stuff
        nova_conf.add('ec2_dmz_host', self.installer.get_option('ec2_dmz_host', default_value=hostip))
        nova_conf.add('s3_host', hostip)

        # How is your message queue setup?
        self.setup_rpc(nova_conf, rpc_backends=MQ_BACKENDS)

        # The USB tablet device is meant to improve mouse behavior in
        # the VNC console, but it has the side effect of increasing
        # the CPU usage of an idle VM tenfold.
        nova_conf.add('use_usb_tablet', False)

        # Is this a multihost setup?
        self._configure_multihost(nova_conf)

        # Handle any virt driver specifics
        self._configure_virt_driver(nova_conf)

        # Handle configuring the conductor service
        self._configure_conductor(nova_conf)
Example #11
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)
Example #12
0
    def generate(self, fn):

        # Everything built goes in here
        nova_conf = Conf(fn, self.installer)

        # Used more than once so we calculate it ahead of time
        hostip = self.installer.get_option('ip')

        nova_conf.add('verbose', self.installer.get_bool_option('log_verbose'))

        # Allow destination machine to match source for resize.
        nova_conf.add('allow_resize_to_same_host', True)

        # Which scheduler do u want?
        nova_conf.add('compute_scheduler_driver',
                      self.installer.get_option('scheduler', default_value='nova.scheduler.filter_scheduler.FilterScheduler'))

        # Rate limit the api??
        nova_conf.add('api_rate_limit', self.installer.get_bool_option('api_rate_limit'))

        # Ensure the policy.json is referenced correctly
        nova_conf.add('policy_file', '/etc/nova/policy.json')

        # Setup nova network/settings
        self._configure_network_settings(nova_conf)

        # Setup nova volume/settings
        if self.installer.get_option('volumes'):
            self._configure_vols(nova_conf)

        # The ip of where we are running
        nova_conf.add('my_ip', hostip)

        # Setup your sql connection
        dbdsn = dbhelper.fetch_dbdsn(dbname=DB_NAME,
                                     utf8=True,
                                     dbtype=self.installer.get_option('db', 'type'),
                                     **utils.merge_dicts(self.installer.get_option('db'),
                                                         dbhelper.get_shared_passwords(self.installer)))
        nova_conf.add('sql_connection', dbdsn)

        # Configure anything libvirt related?
        virt_driver = canon_virt_driver(self.installer.get_option('virt_driver'))
        if virt_driver == 'libvirt':
            self._configure_libvirt(lv.canon_libvirt_type(self.installer.get_option('libvirt_type')), nova_conf)

        # How instances will be presented
        instance_template = "%s%s" % (self.installer.get_option('instance_name_prefix'),
                                      self.installer.get_option('instance_name_postfix'))
        if not instance_template:
            instance_template = 'instance-%08x'
        nova_conf.add('instance_name_template', instance_template)

        # Enable the standard extensions
        nova_conf.add('osapi_compute_extension',
                      'nova.api.openstack.compute.contrib.standard_extensions')

        # Auth will be using keystone
        nova_conf.add('auth_strategy', 'keystone')

        # Is config drive being forced on?
        if self.installer.get_bool_option('force_cfg_drive'):
            nova_conf.add('force_config_drive', 'always')

        # Don't always force images to raw, which makes things take time to get to raw...
        nova_conf.add('force_raw_images', self.installer.get_bool_option('force_raw_images'))

        # Add a checksum for images fetched for each hypervisor?
        # This check absorbs cpu cycles, warning....
        nova_conf.add('checksum_base_images', self.installer.get_bool_option('checksum_base_images'))

        # Setup the interprocess locking directory (don't put me on shared storage)
        lock_path = self.installer.get_option('lock_path')
        if not lock_path:
            lock_path = sh.joinpths(self.installer.get_option('component_dir'), 'locks')
        sh.mkdirslist(lock_path, tracewriter=self.tracewriter)
        nova_conf.add('lock_path', lock_path)

        # Vnc settings setup
        self._configure_vnc(nova_conf)

        # Where our paste config is
        nova_conf.add('api_paste_config', self.installer.target_config(PASTE_CONF))

        # What our imaging service will be
        self._configure_image_service(nova_conf, hostip)

        # Configs for ec2 / s3 stuff
        nova_conf.add('ec2_dmz_host', self.installer.get_option('ec2_dmz_host', default_value=hostip))
        nova_conf.add('s3_host', hostip)

        # How is your message queue setup?
        mq_type = canon_mq_type(self.installer.get_option('mq-type'))
        if mq_type == 'rabbit':
            nova_conf.add('rabbit_host', self.installer.get_option('rabbit', 'host', default_value=hostip))
            nova_conf.add('rabbit_password', rbhelper.get_shared_passwords(self.installer)['pw'])
            nova_conf.add('rabbit_userid', self.installer.get_option('rabbit', 'user_id'))
            nova_conf.add('rpc_backend', 'nova.rpc.impl_kombu')

        # The USB tablet device is meant to improve mouse behavior in
        # the VNC console, but it has the side effect of increasing
        # the CPU usage of an idle VM tenfold.
        nova_conf.add('use_usb_tablet', False)

        # Where instances will be stored
        instances_path = self.installer.get_option('instances_path')
        if not instances_path:
            instances_path = sh.joinpths(self.installer.get_option('component_dir'), 'instances')
        self._configure_instances_path(instances_path, nova_conf)

        # Is this a multihost setup?
        self._configure_multihost(nova_conf)

        # Handle any virt driver specifics
        self._configure_virt_driver(nova_conf)

        # Handle configuring the conductor service
        self._configure_conductor(nova_conf)

        # Annnnnd extract to finish
        return self._get_content(nova_conf)
Example #13
0
    def generate(self, fn):

        # Everything built goes in here
        nova_conf = Conf(fn)

        # Used more than once so we calculate it ahead of time
        hostip = self.installer.get_option('ip')

        nova_conf.add('verbose', self.installer.get_bool_option('verbose'))

        # Allow destination machine to match source for resize. 
        nova_conf.add('allow_resize_to_same_host', True)

        # Which scheduler do u want?
        nova_conf.add('compute_scheduler_driver',
                      self.installer.get_option('scheduler', default_value='nova.scheduler.filter_scheduler.FilterScheduler'))

        # Rate limit the api??
        nova_conf.add('api_rate_limit', self.installer.get_bool_option('api_rate_limit'))

        # Setup nova network/settings
        self._configure_network_settings(nova_conf)

        # Setup nova volume/settings
        if self.installer.get_option('volumes'):
            self._configure_vols(nova_conf)

        # The ip of where we are running
        nova_conf.add('my_ip', hostip)

        # Setup your sql connection
        dbdsn = dbhelper.fetch_dbdsn(dbname=DB_NAME,
                                     utf8=True,
                                     dbtype=self.installer.get_option('db', 'type'),
                                     **utils.merge_dicts(self.installer.get_option('db'),
                                                         dbhelper.get_shared_passwords(self.installer)))
        nova_conf.add('sql_connection', dbdsn)

        # Configure anything libvirt related?
        virt_driver = canon_virt_driver(self.installer.get_option('virt_driver'))
        if virt_driver == 'libvirt':
            self._configure_libvirt(lv.canon_libvirt_type(self.installer.get_option('libvirt_type')), nova_conf)

        # How instances will be presented
        instance_template = "%s%s" % (self.installer.get_option('instance_name_prefix'),
                                      self.installer.get_option('instance_name_postfix'))
        if not instance_template:
            instance_template = 'instance-%08x'
        nova_conf.add('instance_name_template', instance_template)

        # Enable the standard extensions
        nova_conf.add('osapi_compute_extension',
                      'nova.api.openstack.compute.contrib.standard_extensions')

        # Auth will be using keystone
        nova_conf.add('auth_strategy', 'keystone')

        # Don't always force images to raw
        nova_conf.add('force_raw_images', self.installer.get_bool_option('force_raw_images'))

        # Add a checksum for images fetched to a hypervisor
        nova_conf.add('checksum_base_images', self.installer.get_bool_option('checksum_base_images'))

        # Vnc settings setup
        self._configure_vnc(nova_conf)

        # Where our paste config is
        nova_conf.add('api_paste_config',
                      self.installer.target_config(PASTE_CONF))

        # What our imaging service will be
        self._configure_image_service(nova_conf, hostip)

        # Configs for ec2 / s3 stuff
        nova_conf.add('ec2_dmz_host', self.installer.get_option('ec2_dmz_host', default_value=hostip))
        nova_conf.add('s3_host', hostip)

        # How is your message queue setup?
        mq_type = canon_mq_type(self.installer.get_option('mq-type'))
        if mq_type == 'rabbit':
            nova_conf.add('rabbit_host', self.installer.get_option('rabbit', 'host', default_value=hostip))
            nova_conf.add('rabbit_password', rbhelper.get_shared_passwords(self.installer)['pw'])
            nova_conf.add('rabbit_userid', self.installer.get_option('rabbit', 'user_id'))
            nova_conf.add('rpc_backend', 'nova.rpc.impl_kombu')

        # Where instances will be stored
        instances_path = self.installer.get_option('instances_path')
        if not instances_path:
            instances_path = sh.joinpths(self.installer.get_option('component_dir'), 'instances')
        self._configure_instances_path(instances_path, nova_conf)

        # Is this a multihost setup?
        self._configure_multihost(nova_conf)

        # Handle any virt driver specifics
        self._configure_virt_driver(nova_conf)

        # Annnnnd extract to finish
        return self._get_content(nova_conf)
Example #14
0
    def generate(self, fn):

        # Everything built goes in here
        nova_conf = Conf(fn, self.installer)

        # Used more than once so we calculate it ahead of time
        hostip = self.installer.get_option('ip')

        nova_conf.add('verbose', self.installer.get_bool_option('verbose'))

        # Allow destination machine to match source for resize.
        nova_conf.add('allow_resize_to_same_host', True)

        # Which scheduler do u want?
        nova_conf.add(
            'compute_scheduler_driver',
            self.installer.get_option(
                'scheduler',
                default_value='nova.scheduler.filter_scheduler.FilterScheduler'
            ))

        # Rate limit the api??
        nova_conf.add('api_rate_limit',
                      self.installer.get_bool_option('api_rate_limit'))

        # Setup nova network/settings
        self._configure_network_settings(nova_conf)

        # Setup nova volume/settings
        if self.installer.get_option('volumes'):
            self._configure_vols(nova_conf)

        # The ip of where we are running
        nova_conf.add('my_ip', hostip)

        # Setup your sql connection
        dbdsn = dbhelper.fetch_dbdsn(
            dbname=DB_NAME,
            utf8=True,
            dbtype=self.installer.get_option('db', 'type'),
            **utils.merge_dicts(self.installer.get_option('db'),
                                dbhelper.get_shared_passwords(self.installer)))
        nova_conf.add('sql_connection', dbdsn)

        # Configure anything libvirt related?
        virt_driver = canon_virt_driver(
            self.installer.get_option('virt_driver'))
        if virt_driver == 'libvirt':
            self._configure_libvirt(
                lv.canon_libvirt_type(
                    self.installer.get_option('libvirt_type')), nova_conf)

        # How instances will be presented
        instance_template = "%s%s" % (
            self.installer.get_option('instance_name_prefix'),
            self.installer.get_option('instance_name_postfix'))
        if not instance_template:
            instance_template = 'instance-%08x'
        nova_conf.add('instance_name_template', instance_template)

        # Enable the standard extensions
        nova_conf.add(
            'osapi_compute_extension',
            'nova.api.openstack.compute.contrib.standard_extensions')

        # Auth will be using keystone
        nova_conf.add('auth_strategy', 'keystone')

        # Is config drive being forced?
        if self.installer.get_bool_option('force_cfg_drive'):
            nova_conf.add('force_config_drive', 'always')

        # Don't always force images to raw
        nova_conf.add('force_raw_images',
                      self.installer.get_bool_option('force_raw_images'))

        # Add a checksum for images fetched to a hypervisor
        nova_conf.add('checksum_base_images',
                      self.installer.get_bool_option('checksum_base_images'))

        # Vnc settings setup
        self._configure_vnc(nova_conf)

        # Where our paste config is
        nova_conf.add('api_paste_config',
                      self.installer.target_config(PASTE_CONF))

        # What our imaging service will be
        self._configure_image_service(nova_conf, hostip)

        # Configs for ec2 / s3 stuff
        nova_conf.add(
            'ec2_dmz_host',
            self.installer.get_option('ec2_dmz_host', default_value=hostip))
        nova_conf.add('s3_host', hostip)

        # How is your message queue setup?
        mq_type = canon_mq_type(self.installer.get_option('mq-type'))
        if mq_type == 'rabbit':
            nova_conf.add(
                'rabbit_host',
                self.installer.get_option('rabbit',
                                          'host',
                                          default_value=hostip))
            nova_conf.add('rabbit_password',
                          rbhelper.get_shared_passwords(self.installer)['pw'])
            nova_conf.add('rabbit_userid',
                          self.installer.get_option('rabbit', 'user_id'))
            nova_conf.add('rpc_backend', 'nova.rpc.impl_kombu')

        # The USB tablet device is meant to improve mouse behavior in
        # the VNC console, but it has the side effect of increasing
        # the CPU usage of an idle VM tenfold.
        nova_conf.add('use_usb_tablet', False)

        # Where instances will be stored
        instances_path = self.installer.get_option('instances_path')
        if not instances_path:
            instances_path = sh.joinpths(
                self.installer.get_option('component_dir'), 'instances')
        self._configure_instances_path(instances_path, nova_conf)

        # Is this a multihost setup?
        self._configure_multihost(nova_conf)

        # Handle any virt driver specifics
        self._configure_virt_driver(nova_conf)

        # Annnnnd extract to finish
        return self._get_content(nova_conf)
Example #15
0
    def _config_adjust_api(self, nova_conf):
        ''' This method has the smarts to build the configuration file based on
            various runtime values. A useful reference for figuring out this
            is at http://docs.openstack.org/diablo/openstack-compute/admin/content/ch_configuring-openstack-compute.html
            See also: https://github.com/openstack/nova/blob/master/etc/nova/nova.conf.sample
        '''

        # Used more than once so we calculate it ahead of time
        hostip = self.installer.get_option('ip')

        nova_conf.add('verbose', self.installer.get_bool_option('log_verbose'))

        # Allow destination machine to match source for resize.
        nova_conf.add('allow_resize_to_same_host', True)

        # Which scheduler do u want?
        nova_conf.add(
            'compute_scheduler_driver',
            self.installer.get_option(
                'scheduler',
                default_value='nova.scheduler.filter_scheduler.FilterScheduler'
            ))

        # Rate limit the api??
        nova_conf.add('api_rate_limit',
                      self.installer.get_bool_option('api_rate_limit'))

        # Ensure the policy.json is referenced correctly
        nova_conf.add('policy_file', '/etc/nova/policy.json')

        # Setup nova network/settings
        self._configure_network_settings(nova_conf)

        # The ip of where we are running
        nova_conf.add('my_ip', hostip)

        nova_conf.add('sql_connection', self.fetch_dbdsn())

        # Configure anything libvirt related?
        virt_driver = utils.canon_virt_driver(
            self.installer.get_option('virt_driver'))
        if virt_driver == 'libvirt':
            self._configure_libvirt(
                lv.canon_libvirt_type(
                    self.installer.get_option('libvirt_type')), nova_conf)

        # How instances will be presented
        instance_template = "%s%s" % (
            self.installer.get_option('instance_name_prefix'),
            self.installer.get_option('instance_name_postfix'))
        if not instance_template:
            instance_template = 'instance-%08x'
        nova_conf.add('instance_name_template', instance_template)

        # Enable the standard extensions
        nova_conf.add(
            'osapi_compute_extension',
            'nova.api.openstack.compute.contrib.standard_extensions')

        # Auth will be using keystone
        nova_conf.add('auth_strategy', 'keystone')

        # Is config drive being forced on?
        if self.installer.get_bool_option('force_cfg_drive'):
            nova_conf.add('force_config_drive', 'always')

        # Don't always force images to raw, which makes things take time to get to raw...
        nova_conf.add('force_raw_images',
                      self.installer.get_bool_option('force_raw_images'))

        # Add a checksum for images fetched for each hypervisor?
        # This check absorbs cpu cycles, warning....
        nova_conf.add('checksum_base_images',
                      self.installer.get_bool_option('checksum_base_images'))

        # Setup the interprocess locking directory (don't put me on shared storage)
        lock_path = self.installer.get_option('lock_path')
        if not lock_path:
            lock_path = sh.joinpths(self.installer.get_option('component_dir'),
                                    'locks')
        sh.mkdirslist(lock_path, tracewriter=self.tracewriter)
        nova_conf.add('lock_path', lock_path)

        # Vnc settings setup
        self._configure_vnc(nova_conf)

        # Where our paste config is
        nova_conf.add('api_paste_config', self.target_config(PASTE_CONF))

        # What our imaging service will be
        self._configure_image_service(nova_conf, hostip)

        # Configs for ec2 / s3 stuff
        nova_conf.add(
            'ec2_dmz_host',
            self.installer.get_option('ec2_dmz_host', default_value=hostip))
        nova_conf.add('s3_host', hostip)

        # How is your message queue setup?
        self.setup_rpc(nova_conf, 'nova.rpc.impl_kombu')

        # The USB tablet device is meant to improve mouse behavior in
        # the VNC console, but it has the side effect of increasing
        # the CPU usage of an idle VM tenfold.
        nova_conf.add('use_usb_tablet', False)

        # Where instances will be stored
        instances_path = self.installer.get_option('instances_path')
        if not instances_path:
            instances_path = sh.joinpths(
                self.installer.get_option('component_dir'), 'instances')
        self._configure_instances_path(instances_path, nova_conf)

        # Is this a multihost setup?
        self._configure_multihost(nova_conf)

        # Handle any virt driver specifics
        self._configure_virt_driver(nova_conf)

        # Handle configuring the conductor service
        self._configure_conductor(nova_conf)
Example #16
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)