Пример #1
0
    def _start_compute_service(self, hostname):
        fake_connection = self._get_connection(
            # Need a host to support creating more servers with vpmems
            host_info=fakelibvirt.HostInfo(cpu_nodes=2, cpu_sockets=1,
                                           cpu_cores=2, cpu_threads=2,
                                           kB_mem=15740000),
            hostname=hostname)
        self.mock_conn.return_value = fake_connection
        compute = self._start_compute(host=hostname)

        # Ensure populating the existing pmems correctly.
        vpmems = compute.driver._vpmems_by_name
        expected_vpmems = {
            'ns_0': objects.LibvirtVPMEMDevice(
                label='4GB', name='ns_0', devpath='/dev/dax0.0',
                size=4292870144, align=2097152),
            'ns_1': objects.LibvirtVPMEMDevice(
                label='SMALL', name='ns_1', devpath='/dev/dax0.1',
                size=4292870144, align=2097152),
            'ns_2': objects.LibvirtVPMEMDevice(
                label='SMALL', name='ns_2', devpath='/dev/dax0.2',
                size=4292870144, align=2097152)}
        self.assertDictEqual(expected_vpmems, vpmems)

        # Ensure reporting vpmems resources correctly
        rp_uuid = self._get_provider_uuid_by_host(compute.host)
        inventory = self._get_provider_inventory(rp_uuid)
        self.assertEqual(1, inventory['CUSTOM_PMEM_NAMESPACE_4GB']['total'])
        self.assertEqual(2, inventory['CUSTOM_PMEM_NAMESPACE_SMALL']['total'])

        return compute
Пример #2
0
    def test_check_can_migrate_specific_resources(self):
        """Test _check_can_migrate_specific_resources allows live migration
        with vpmem.
        """
        @mock.patch.object(live_migrate, 'supports_vpmem_live_migration')
        def _test(resources, supp_lm_vpmem_retval, mock_support_lm_vpmem):
            self.instance.resources = resources
            mock_support_lm_vpmem.return_value = supp_lm_vpmem_retval
            self.task._check_can_migrate_specific_resources()

        vpmem_0 = objects.LibvirtVPMEMDevice(
            label='4GB', name='ns_0', devpath='/dev/dax0.0',
            size=4292870144, align=2097152)
        resource_0 = objects.Resource(
            provider_uuid=uuids.rp,
            resource_class="CUSTOM_PMEM_NAMESPACE_4GB",
            identifier='ns_0', metadata=vpmem_0)
        resources = objects.ResourceList(
            objects=[resource_0])

        _test(None, False)
        _test(None, True)
        _test(resources, True)
        self.assertRaises(exception.MigrationPreCheckError,
                          _test, resources, False)
Пример #3
0
 def test_check_can_migrate_specific_resources(self):
     vpmem_0 = objects.LibvirtVPMEMDevice(label='4GB',
                                          name='ns_0',
                                          devpath='/dev/dax0.0',
                                          size=4292870144,
                                          align=2097152)
     resource_0 = objects.Resource(
         provider_uuid=uuids.rp,
         resource_class="CUSTOM_PMEM_NAMESPACE_4GB",
         identifier='ns_0',
         metadata=vpmem_0)
     self.instance.resources = objects.ResourceList(objects=[resource_0])
     self.assertRaises(exception.MigrationPreCheckError,
                       self.task._check_can_migrate_specific_resources)