libvirt: Add 'COMPUTE_ADDRESS_SPACE_*' traits support
Based on the Libvirt and QEMU versions, two traits, COMPUTE_ADDRESS_SPACE_PASSTHROUGH and COMPUTE_ADDRESS_SPACE_EMULATED, are controlled. Since the two are supported from the same version on the Libvirt and QEMU, Nova handles them in the same way. Blueprint: libvirt-maxphysaddr-support Depends-On: https://review.opendev.org/c/openstack/os-traits/+/871226 Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp> Change-Id: If6c7169b7b8f43ad15a8992831824fb546e85aab
This commit is contained in:
parent
7e25b672ef
commit
2fd034ec48
@ -45,6 +45,8 @@ class ProviderTreeTests(integrated_helpers.ProviderUsageBaseTestCase):
|
|||||||
os_traits.COMPUTE_VOLUME_EXTEND,
|
os_traits.COMPUTE_VOLUME_EXTEND,
|
||||||
os_traits.COMPUTE_VOLUME_MULTI_ATTACH,
|
os_traits.COMPUTE_VOLUME_MULTI_ATTACH,
|
||||||
os_traits.COMPUTE_TRUSTED_CERTS,
|
os_traits.COMPUTE_TRUSTED_CERTS,
|
||||||
|
os_traits.COMPUTE_ADDRESS_SPACE_EMULATED,
|
||||||
|
os_traits.COMPUTE_ADDRESS_SPACE_PASSTHROUGH,
|
||||||
]
|
]
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -21367,6 +21367,40 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|||||||
cpu_model = drvr._get_cpu_model_mapping(expect_model[0])
|
cpu_model = drvr._get_cpu_model_mapping(expect_model[0])
|
||||||
self.assertEqual(cpu_model, expect_model[0])
|
self.assertEqual(cpu_model, expect_model[0])
|
||||||
|
|
||||||
|
@mock.patch.object(fakelibvirt.Connection, 'getLibVersion',
|
||||||
|
return_value=versionutils.convert_version_to_int(
|
||||||
|
libvirt_driver.MIN_LIBVIRT_MAXPHYSADDR))
|
||||||
|
@mock.patch.object(fakelibvirt.Connection, 'getVersion',
|
||||||
|
return_value=versionutils.convert_version_to_int(
|
||||||
|
libvirt_driver.MIN_QEMU_MAXPHYSADDR))
|
||||||
|
@mock.patch.object(fakelibvirt.Connection, 'getType',
|
||||||
|
return_value=host.HV_DRIVER_QEMU)
|
||||||
|
def test_update_host_specific_capabilities_with_maxphysaddr(
|
||||||
|
self, mock_get_lib_version, mock_get_version, mock_type):
|
||||||
|
driver = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI())
|
||||||
|
driver._update_host_specific_capabilities()
|
||||||
|
self.assertTrue(
|
||||||
|
driver.capabilities.get('supports_address_space_passthrough'))
|
||||||
|
self.assertTrue(
|
||||||
|
driver.capabilities.get('supports_address_space_emulated'))
|
||||||
|
|
||||||
|
@mock.patch.object(fakelibvirt.Connection, 'getLibVersion',
|
||||||
|
return_value=versionutils.convert_version_to_int(
|
||||||
|
libvirt_driver.MIN_LIBVIRT_MAXPHYSADDR))
|
||||||
|
@mock.patch.object(fakelibvirt.Connection, 'getVersion',
|
||||||
|
return_value=versionutils.convert_version_to_int(
|
||||||
|
libvirt_driver.MIN_QEMU_MAXPHYSADDR) - 1)
|
||||||
|
@mock.patch.object(fakelibvirt.Connection, 'getType',
|
||||||
|
return_value=host.HV_DRIVER_QEMU)
|
||||||
|
def test_update_host_specific_capabilities_without_maxphysaddr(
|
||||||
|
self, mock_get_lib_version, mock_get_version, mock_type):
|
||||||
|
driver = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI())
|
||||||
|
driver._update_host_specific_capabilities()
|
||||||
|
self.assertFalse(
|
||||||
|
driver.capabilities.get('supports_address_space_passthrough'))
|
||||||
|
self.assertFalse(
|
||||||
|
driver.capabilities.get('supports_address_space_emulated'))
|
||||||
|
|
||||||
@mock.patch.object(fakelibvirt.Connection, 'getLibVersion',
|
@mock.patch.object(fakelibvirt.Connection, 'getLibVersion',
|
||||||
return_value=versionutils.convert_version_to_int(
|
return_value=versionutils.convert_version_to_int(
|
||||||
libvirt_driver.MIN_LIBVIRT_TB_CACHE_SIZE) - 1)
|
libvirt_driver.MIN_LIBVIRT_TB_CACHE_SIZE) - 1)
|
||||||
|
@ -157,6 +157,10 @@ CAPABILITY_TRAITS_MAP = {
|
|||||||
os_traits.COMPUTE_EPHEMERAL_ENCRYPTION_LUKS,
|
os_traits.COMPUTE_EPHEMERAL_ENCRYPTION_LUKS,
|
||||||
"supports_ephemeral_encryption_plain":
|
"supports_ephemeral_encryption_plain":
|
||||||
os_traits.COMPUTE_EPHEMERAL_ENCRYPTION_PLAIN,
|
os_traits.COMPUTE_EPHEMERAL_ENCRYPTION_PLAIN,
|
||||||
|
"supports_address_space_passthrough":
|
||||||
|
os_traits.COMPUTE_ADDRESS_SPACE_PASSTHROUGH,
|
||||||
|
"supports_address_space_emulated":
|
||||||
|
os_traits.COMPUTE_ADDRESS_SPACE_EMULATED,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -226,6 +230,8 @@ class ComputeDriver(object):
|
|||||||
"supports_secure_boot": False,
|
"supports_secure_boot": False,
|
||||||
"supports_socket_pci_numa_affinity": False,
|
"supports_socket_pci_numa_affinity": False,
|
||||||
"supports_remote_managed_ports": False,
|
"supports_remote_managed_ports": False,
|
||||||
|
"supports_address_space_passthrough": False,
|
||||||
|
"supports_address_space_emulated": False,
|
||||||
|
|
||||||
# Ephemeral encryption support flags
|
# Ephemeral encryption support flags
|
||||||
"supports_ephemeral_encryption": False,
|
"supports_ephemeral_encryption": False,
|
||||||
|
@ -119,6 +119,8 @@ class FakeDriver(driver.ComputeDriver):
|
|||||||
"supports_pcpus": False,
|
"supports_pcpus": False,
|
||||||
"supports_accelerators": True,
|
"supports_accelerators": True,
|
||||||
"supports_remote_managed_ports": True,
|
"supports_remote_managed_ports": True,
|
||||||
|
"supports_address_space_passthrough": True,
|
||||||
|
"supports_address_space_emulated": True,
|
||||||
|
|
||||||
# Supported image types
|
# Supported image types
|
||||||
"supports_image_type_raw": True,
|
"supports_image_type_raw": True,
|
||||||
|
@ -104,6 +104,8 @@ class HyperVDriver(driver.ComputeDriver):
|
|||||||
"supports_accelerators": False,
|
"supports_accelerators": False,
|
||||||
"supports_secure_boot": True,
|
"supports_secure_boot": True,
|
||||||
"supports_remote_managed_ports": False,
|
"supports_remote_managed_ports": False,
|
||||||
|
"supports_address_space_passthrough": False,
|
||||||
|
"supports_address_space_emulated": False,
|
||||||
|
|
||||||
# Supported image types
|
# Supported image types
|
||||||
"supports_image_type_vhd": True,
|
"supports_image_type_vhd": True,
|
||||||
|
@ -165,6 +165,8 @@ class IronicDriver(virt_driver.ComputeDriver):
|
|||||||
"supports_pcpus": False,
|
"supports_pcpus": False,
|
||||||
"supports_accelerators": False,
|
"supports_accelerators": False,
|
||||||
"supports_remote_managed_ports": False,
|
"supports_remote_managed_ports": False,
|
||||||
|
"supports_address_space_passthrough": False,
|
||||||
|
"supports_address_space_emulated": False,
|
||||||
|
|
||||||
# Image type support flags
|
# Image type support flags
|
||||||
"supports_image_type_aki": False,
|
"supports_image_type_aki": False,
|
||||||
|
@ -252,6 +252,10 @@ LIBVIRT_PERF_EVENT_PREFIX = 'VIR_PERF_PARAM_'
|
|||||||
MIN_LIBVIRT_VDPA = (6, 9, 0)
|
MIN_LIBVIRT_VDPA = (6, 9, 0)
|
||||||
MIN_QEMU_VDPA = (5, 1, 0)
|
MIN_QEMU_VDPA = (5, 1, 0)
|
||||||
|
|
||||||
|
# Maxphysaddr minimal support version.
|
||||||
|
MIN_LIBVIRT_MAXPHYSADDR = (8, 7, 0)
|
||||||
|
MIN_QEMU_MAXPHYSADDR = (2, 7, 0)
|
||||||
|
|
||||||
REGISTER_IMAGE_PROPERTY_DEFAULTS = [
|
REGISTER_IMAGE_PROPERTY_DEFAULTS = [
|
||||||
'hw_machine_type',
|
'hw_machine_type',
|
||||||
'hw_cdrom_bus',
|
'hw_cdrom_bus',
|
||||||
@ -857,6 +861,19 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||||||
self._host.supports_remote_managed_ports
|
self._host.supports_remote_managed_ports
|
||||||
})
|
})
|
||||||
|
|
||||||
|
supports_maxphysaddr = self._host.has_min_version(
|
||||||
|
lv_ver=MIN_LIBVIRT_MAXPHYSADDR,
|
||||||
|
hv_ver=MIN_QEMU_MAXPHYSADDR,
|
||||||
|
hv_type=host.HV_DRIVER_QEMU,
|
||||||
|
)
|
||||||
|
|
||||||
|
# NOTE(nmiki): Currently libvirt does not provide a distinction
|
||||||
|
# between passthrough mode and emulated mode support status.
|
||||||
|
self.capabilities.update({
|
||||||
|
'supports_address_space_passthrough': supports_maxphysaddr,
|
||||||
|
'supports_address_space_emulated': supports_maxphysaddr,
|
||||||
|
})
|
||||||
|
|
||||||
def _register_all_undefined_instance_details(self) -> None:
|
def _register_all_undefined_instance_details(self) -> None:
|
||||||
"""Register the default image properties of instances on this host
|
"""Register the default image properties of instances on this host
|
||||||
|
|
||||||
|
@ -72,6 +72,8 @@ class VMwareVCDriver(driver.ComputeDriver):
|
|||||||
"supports_pcpus": False,
|
"supports_pcpus": False,
|
||||||
"supports_accelerators": False,
|
"supports_accelerators": False,
|
||||||
"supports_remote_managed_ports": False,
|
"supports_remote_managed_ports": False,
|
||||||
|
"supports_address_space_passthrough": False,
|
||||||
|
"supports_address_space_emulated": False,
|
||||||
|
|
||||||
# Image type support flags
|
# Image type support flags
|
||||||
"supports_image_type_aki": False,
|
"supports_image_type_aki": False,
|
||||||
|
@ -47,6 +47,8 @@ class ZVMDriver(driver.ComputeDriver):
|
|||||||
capabilities = {
|
capabilities = {
|
||||||
"supports_pcpus": False,
|
"supports_pcpus": False,
|
||||||
"supports_remote_managed_ports": False,
|
"supports_remote_managed_ports": False,
|
||||||
|
"supports_address_space_passthrough": False,
|
||||||
|
"supports_address_space_emulated": False,
|
||||||
|
|
||||||
# Image type support flags
|
# Image type support flags
|
||||||
"supports_image_type_aki": False,
|
"supports_image_type_aki": False,
|
||||||
|
@ -52,7 +52,7 @@ psutil>=3.2.2 # BSD
|
|||||||
oslo.versionedobjects>=1.35.0 # Apache-2.0
|
oslo.versionedobjects>=1.35.0 # Apache-2.0
|
||||||
os-brick>=5.2 # Apache-2.0
|
os-brick>=5.2 # Apache-2.0
|
||||||
os-resource-classes>=1.1.0 # Apache-2.0
|
os-resource-classes>=1.1.0 # Apache-2.0
|
||||||
os-traits>=2.9.0 # Apache-2.0
|
os-traits>=2.10.0 # Apache-2.0
|
||||||
os-vif>=3.1.0 # Apache-2.0
|
os-vif>=3.1.0 # Apache-2.0
|
||||||
castellan>=0.16.0 # Apache-2.0
|
castellan>=0.16.0 # Apache-2.0
|
||||||
microversion-parse>=0.2.1 # Apache-2.0
|
microversion-parse>=0.2.1 # Apache-2.0
|
||||||
|
Loading…
Reference in New Issue
Block a user