Exemplo n.º 1
0
    def configure(self, virtapi):
        # (dscannell) import the libvirt module to ensure that the the
        # libvirt flags can be read in.
        from nova.virt.libvirt.driver import LibvirtDriver

        self.determine_openstack_user()

        # Two libvirt drivers are created for the two different cases:
        #   migration: When doing a migration we attempt to keep everything
        #              the same as a regular boot. In this case we just use
        #              the regular driver without modifications.
        #
        #   launch:     When doing a launch we dealing exclusively with qcow2
        #               images. We need to replace the regular image backend
        #               with the LaunchImageBackend that will force exclusive
        #               use of qcow2.
        launch_libvirt_conn = LibvirtDriver(virtapi, read_only=False)
        launch_libvirt_conn.image_backend = LaunchImageBackend(CONF.use_cow_images)
        self.libvirt_connections = {'migration': LibvirtDriver(virtapi, read_only=False),
                                    'launch': launch_libvirt_conn}

        vms_config = self.vmsapi.config()
        # It doesn't matter which libvirt connection we use because the uri
        # should be the same in either case.
        vms_config.MANAGEMENT['connection_url'] = launch_libvirt_conn.uri()
        self.vmsapi.select_hypervisor('libvirt')
Exemplo n.º 2
0
    def configure(self, virtapi):
        # (dscannell) import the libvirt module to ensure that the the
        # libvirt flags can be read in.
        from nova.virt.libvirt.driver import LibvirtDriver

        self.determine_openstack_user()

        # Two libvirt drivers are created for the two different cases:
        #   migration: When doing a migration we attempt to keep everything
        #              the same as a regular boot. In this case we just use
        #              the regular driver without modifications.
        #
        #   launch:     When doing a launch we dealing exclusively with qcow2
        #               images. We need to replace the regular image backend
        #               with the LaunchImageBackend that will force exclusive
        #               use of qcow2.
        launch_libvirt_conn = LibvirtDriver(virtapi, read_only=False)
        launch_libvirt_conn.image_backend = LaunchImageBackend(CONF.use_cow_images)
        self.libvirt_connections = {'migration': LibvirtDriver(virtapi, read_only=False),
                                    'launch': launch_libvirt_conn}

        libvirt_uri = launch_libvirt_conn.uri()
        self.vmsapi.configure(
                vms_api.Vmsctl(vms_platform='libvirt',
                            management_options={'connection_url': libvirt_uri}))
Exemplo n.º 3
0
    def configure(self, virtapi):
        # (dscannell) import the libvirt module to ensure that the the
        # libvirt flags can be read in.
        from nova.virt.libvirt.driver import LibvirtDriver

        self.determine_openstack_user()

        # Two libvirt drivers are created for the two different cases:
        #   migration: When doing a migration we attempt to keep everything
        #              the same as a regular boot. In this case we just use
        #              the regular driver without modifications.
        #
        #   launch:     When doing a launch we dealing exclusively with qcow2
        #               images. We need to replace the regular image backend
        #               with the LaunchImageBackend that will force exclusive
        #               use of qcow2.
        launch_libvirt_conn = LibvirtDriver(virtapi, read_only=False)
        launch_libvirt_conn.image_backend = LaunchImageBackend(
            CONF.use_cow_images)
        self.libvirt_connections = {
            'migration': LibvirtDriver(virtapi, read_only=False),
            'launch': launch_libvirt_conn
        }

        libvirt_uri = launch_libvirt_conn.uri()
        self.vmsapi.configure(
            vms_api.Vmsctl(vms_platform='libvirt',
                           management_options={'connection_url': libvirt_uri}))
Exemplo n.º 4
0
    def _gen_stats(self):
        """Return currently known host stats"""
        disk_usage = psutil.disk_usage('/')
        local_gb = disk_usage.total / GB
        local_gb_used = disk_usage.used / GB
        disk_available_least = disk_usage.free / GB

        mem_usage = psutil.virtual_memory()
        memory_mb = mem_usage.total / MB
        memory_mb_used = mem_usage.used / MB

        # list of (arch, hypervisor_type, vm_mode)
        capabilities = [('ppc', 'dynamips', 'ios')]

        return {
            'vcpus': LibvirtDriver.get_vcpu_total(),
            'vcpus_used': self.get_vcpu_used(),
            'cpu_info': '{}',
            'disk_total': disk_usage.total,
            'disk_used': disk_usage.used,
            'disk_available': disk_usage.free,
            'host_memory_total': mem_usage.total,
            'host_memory_free': mem_usage.free,
            'memory_mb': memory_mb,
            'memory_mb_used': memory_mb_used,
            'local_gb': local_gb,
            'local_gb_used': local_gb_used,
            'disk_available_least': disk_available_least,
            'hypervisor_type': 'dynamips',
            'hypervisor_version': '0.2.7+',
            'hypervisor_hostname': '',
            'supported_instances': capabilities
        }
Exemplo n.º 5
0
    def configure(self):
        # (dscannell) import the libvirt module to ensure that the the
        # libvirt flags can be read in.
        from nova.virt.libvirt.driver import LibvirtDriver

        self.determine_openstack_user()

        self.libvirt_conn = LibvirtDriver(False)
        vms_config = self.vmsapi.config()
        vms_config.MANAGEMENT['connection_url'] = self.libvirt_conn.uri
        self.vmsapi.select_hypervisor('libvirt')
Exemplo n.º 6
0
    def _gen_stats(self):
        """Return currently known host stats"""
        disk_usage = psutil.disk_usage('/')
        local_gb = disk_usage.total / GB
        local_gb_used = disk_usage.used / GB
        disk_available_least = disk_usage.free / GB

        mem_usage = psutil.virtual_memory()
        memory_mb = mem_usage.total / MB
        memory_mb_used = mem_usage.used / MB

        # list of (arch, hypervisor_type, vm_mode)
        capabilities = [
            ('ppc', 'dynamips', 'ios')
        ]

        return {
            'vcpus': LibvirtDriver.get_vcpu_total(),
            'vcpus_used': self.get_vcpu_used(),
            'cpu_info': '{}',
            'disk_total': disk_usage.total,
            'disk_used': disk_usage.used,
            'disk_available': disk_usage.free,
            'host_memory_total': mem_usage.total,
            'host_memory_free': mem_usage.free,

            'memory_mb': memory_mb,
            'memory_mb_used': memory_mb_used,
            'local_gb': local_gb,
            'local_gb_used': local_gb_used,
            'disk_available_least': disk_available_least,

            'hypervisor_type': 'dynamips',
            'hypervisor_version': '0.2.7+',
            'hypervisor_hostname': '',
            'supported_instances': capabilities}