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)
Beispiel #2
0
    def test_update_resources(self):
        cn = self.compute_node1
        pt = self._pt_with_cns()

        cn_resources = {
            "CUSTOM_RESOURCE_0": {
                objects.Resource(provider_uuid=cn.uuid,
                                 resource_class="CUSTOM_RESOURCE_0",
                                 identifier="bar")
            },
            "CUSTOM_RESOURCE_1": {
                objects.Resource(provider_uuid=cn.uuid,
                                 resource_class="CUSTOM_RESOURCE_1",
                                 identifier="foo_1"),
                objects.Resource(provider_uuid=cn.uuid,
                                 resource_class="CUSTOM_RESOURCE_1",
                                 identifier="foo_2")
            }
        }
        # resources changed
        self.assertTrue(pt.update_resources(cn.uuid, cn_resources))
        # resources not changed
        self.assertFalse(pt.update_resources(cn.uuid, cn_resources))
Beispiel #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)