Revert "[libvirt] Filter hypervisor_type by virt_type"
This reverts commit eaa766ee20
.
The change regressed the behavior of the ImagePropertiesFilter
because existing images with hypervisor_type=QEMU, which would
match what is reported for hypervisor_type in the API for both
qemu/kvm virt_type nodes, will now get filtered out for hosts
where the configured virt_type is kvm.
Note that both the ImagePropertiesFilter docs [1] and
hypervisor_type image property docs [2] mention that for both
qemu and kvm nodes the value to use is qemu since that is the
actual hypervisor.
Presumably the change was made for a deployment with some
hosts configured with virt_type=qemu and other hosts configured
with virt_type=kvm and there were separate images with
hypervisor_type=qemu and hypervisor_type=kvm to match those hosts
for scheduler filter, but as noted this was a regression in
behavior for something that could have been achieved using
host aggregates and the AggregateImagePropertiesIsolation filter.
We could even use traits and a placement request pre-filter these
days for a more modern approach.
Also, since the API continues to report hypervisor_type=QEMU it's
doubly confusing for operators to have to configure their images
to use hypervisor_type=kvm (despite the docs).
And finally, any existing instances which have hypervisor_type=qemu
embedded in their RequestSpec can no longer be migrated to kvm
hosts without manually fixing the entries in the request_specs
table in the API DB.
Note that this is not a clean revert because of change
I5d95bd50279a6bf903a5793ad5f3ae9d06f085f4 made in Stein.
[1] https://docs.openstack.org/nova/latest/admin/configuration/schedulers.html#imagepropertiesfilter
[2] https://docs.openstack.org/glance/latest/admin/useful-image-properties.html
Change-Id: I7d761dc269f8c12c4a76ba14201ccdd82a04d01d
Closes-Bug: #1837756
This commit is contained in:
parent
0c39090bd7
commit
743dc083bb
|
@ -16437,8 +16437,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|||
self.assertEqual(6, drvr._get_vcpu_used())
|
||||
mock_list.assert_called_with(only_guests=True, only_running=True)
|
||||
|
||||
def _test_get_instance_capabilities(self, want):
|
||||
'''Base test for 'get_capabilities' function. '''
|
||||
def test_get_instance_capabilities(self):
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
||||
def get_host_capabilities_stub(self):
|
||||
|
@ -16469,28 +16468,12 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|||
self.stub_out('nova.virt.libvirt.host.Host.get_capabilities',
|
||||
get_host_capabilities_stub)
|
||||
|
||||
want = [(fields.Architecture.X86_64, 'kvm', 'hvm'),
|
||||
(fields.Architecture.X86_64, 'qemu', 'hvm'),
|
||||
(fields.Architecture.I686, 'kvm', 'hvm')]
|
||||
got = drvr._get_instance_capabilities()
|
||||
self.assertEqual(want, got)
|
||||
|
||||
def test_get_instance_capabilities_kvm(self):
|
||||
self.flags(virt_type='kvm', group='libvirt')
|
||||
|
||||
# Because virt_type is set to kvm, we get only
|
||||
# capabilities where the hypervisor_type is kvm
|
||||
want = [(fields.Architecture.X86_64, 'kvm', 'hvm'),
|
||||
(fields.Architecture.I686, 'kvm', 'hvm')]
|
||||
|
||||
self._test_get_instance_capabilities(want)
|
||||
|
||||
def test_get_instance_capabilities_qemu(self):
|
||||
self.flags(virt_type='qemu', group='libvirt')
|
||||
|
||||
# Because virt_type is set to qemu, we get only
|
||||
# capabilities where the hypervisor_type is qemu
|
||||
want = [(fields.Architecture.X86_64, 'qemu', 'hvm')]
|
||||
|
||||
self._test_get_instance_capabilities(want)
|
||||
|
||||
def test_set_cache_mode(self):
|
||||
self.flags(disk_cachemodes=['file=directsync'], group='libvirt')
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
|
|
@ -6039,17 +6039,12 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
hypervisor is capable of hosting. Each tuple consists
|
||||
of the triplet (arch, hypervisor_type, vm_mode).
|
||||
|
||||
Supported hypervisor_type is filtered by virt_type,
|
||||
a parameter set by operators via `nova.conf`.
|
||||
|
||||
:returns: List of tuples describing instance capabilities
|
||||
"""
|
||||
caps = self._host.get_capabilities()
|
||||
instance_caps = list()
|
||||
for g in caps.guests:
|
||||
for dt in g.domtype:
|
||||
if dt != CONF.libvirt.virt_type:
|
||||
continue
|
||||
try:
|
||||
instance_cap = (
|
||||
fields.Architecture.canonicalize(g.arch),
|
||||
|
|
Loading…
Reference in New Issue