Browse Source

Merge "Revert "[libvirt] Filter hypervisor_type by virt_type"" into stable/rocky

tags/18.2.2
Zuul 1 month ago
parent
commit
372832163d
2 changed files with 4 additions and 26 deletions
  1. 4
    21
      nova/tests/unit/virt/libvirt/test_driver.py
  2. 0
    5
      nova/virt/libvirt/driver.py

+ 4
- 21
nova/tests/unit/virt/libvirt/test_driver.py View File

@@ -16146,8 +16146,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
16146 16146
         self.assertEqual(6, drvr._get_vcpu_used())
16147 16147
         mock_list.assert_called_with(only_guests=True, only_running=True)
16148 16148
 
16149
-    def _test_get_instance_capabilities(self, want):
16150
-        '''Base test for 'get_capabilities' function. '''
16149
+    def test_get_instance_capabilities(self):
16151 16150
         drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
16152 16151
 
16153 16152
         def get_host_capabilities_stub(self):
@@ -16178,27 +16177,11 @@ class LibvirtConnTestCase(test.NoDBTestCase,
16178 16177
         self.stubs.Set(host.Host, "get_capabilities",
16179 16178
                        get_host_capabilities_stub)
16180 16179
 
16181
-        got = drvr._get_instance_capabilities()
16182
-        self.assertEqual(want, got)
16183
-
16184
-    def test_get_instance_capabilities_kvm(self):
16185
-        self.flags(virt_type='kvm', group='libvirt')
16186
-
16187
-        # Because virt_type is set to kvm, we get only
16188
-        # capabilities where the hypervisor_type is kvm
16189 16180
         want = [(fields.Architecture.X86_64, 'kvm', 'hvm'),
16181
+                (fields.Architecture.X86_64, 'qemu', 'hvm'),
16190 16182
                 (fields.Architecture.I686, 'kvm', 'hvm')]
16191
-
16192
-        self._test_get_instance_capabilities(want)
16193
-
16194
-    def test_get_instance_capabilities_qemu(self):
16195
-        self.flags(virt_type='qemu', group='libvirt')
16196
-
16197
-        # Because virt_type is set to qemu, we get only
16198
-        # capabilities where the hypervisor_type is qemu
16199
-        want = [(fields.Architecture.X86_64, 'qemu', 'hvm')]
16200
-
16201
-        self._test_get_instance_capabilities(want)
16183
+        got = drvr._get_instance_capabilities()
16184
+        self.assertEqual(want, got)
16202 16185
 
16203 16186
     def test_set_cache_mode(self):
16204 16187
         self.flags(disk_cachemodes=['file=directsync'], group='libvirt')

+ 0
- 5
nova/virt/libvirt/driver.py View File

@@ -5855,17 +5855,12 @@ class LibvirtDriver(driver.ComputeDriver):
5855 5855
         hypervisor is capable of hosting.  Each tuple consists
5856 5856
         of the triplet (arch, hypervisor_type, vm_mode).
5857 5857
 
5858
-        Supported hypervisor_type is filtered by virt_type,
5859
-        a parameter set by operators via `nova.conf`.
5860
-
5861 5858
         :returns: List of tuples describing instance capabilities
5862 5859
         """
5863 5860
         caps = self._host.get_capabilities()
5864 5861
         instance_caps = list()
5865 5862
         for g in caps.guests:
5866 5863
             for dt in g.domtype:
5867
-                if dt != CONF.libvirt.virt_type:
5868
-                    continue
5869 5864
                 try:
5870 5865
                     instance_cap = (
5871 5866
                         fields.Architecture.canonicalize(g.arch),

Loading…
Cancel
Save