Skip to content

Commit 9cf07d5

Browse files
committed
Change the admin-visible logs for mdev support
Now that we want to support generic stateless mdev devices, we can't really tell of pGPUs and vGPUs in our logs and we need to be more generic. Change-Id: I016773b6d6750db4f34ef6faac6d272c4177d883 Partially-Implements: blueprint generic-mdevs
1 parent ff4d0d0 commit 9cf07d5

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

nova/conf/devices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
``[devices]/enabled_mdev_types``.
4141
4242
If the same PCI address is provided for two different types, nova-compute will
43-
return an InvalidLibvirtGPUConfig exception at restart.
43+
return an InvalidLibvirtMdevConfig exception at restart.
4444
4545
As an interim period, old configuration groups named ``[vgpu_$(MDEV_TYPE)]``
4646
will be accepted. A valid configuration could then be::

nova/exception.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,8 +2337,8 @@ def __init__(self, arqs, **kwargs):
23372337
self.arqs = arqs or []
23382338

23392339

2340-
class InvalidLibvirtGPUConfig(NovaException):
2341-
msg_fmt = _('Invalid configuration for GPU devices: %(reason)s')
2340+
class InvalidLibvirtMdevConfig(NovaException):
2341+
msg_fmt = _('Invalid configuration for mdev-capable devices: %(reason)s')
23422342

23432343

23442344
class RequiredMixedInstancePolicy(Invalid):

nova/tests/unit/virt/libvirt/test_driver.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25293,7 +25293,7 @@ def test_get_supported_vgpu_types_with_duplicate_types(self):
2529325293
# Provide the same pGPU PCI ID for two different types
2529425294
self.flags(device_addresses=['0000:84:00.0'], group='mdev_nvidia-11')
2529525295
self.flags(device_addresses=['0000:84:00.0'], group='mdev_nvidia-12')
25296-
self.assertRaises(exception.InvalidLibvirtGPUConfig,
25296+
self.assertRaises(exception.InvalidLibvirtMdevConfig,
2529725297
libvirt_driver.LibvirtDriver,
2529825298
fake.FakeVirtAPI(), False)
2529925299

@@ -25304,7 +25304,7 @@ def test_get_supported_vgpu_types_with_invalid_pci_address(self):
2530425304
nova.conf.devices.register_dynamic_opts(CONF)
2530525305
# Fat-finger the PCI address
2530625306
self.flags(device_addresses=['whoops'], group='mdev_nvidia-11')
25307-
self.assertRaises(exception.InvalidLibvirtGPUConfig,
25307+
self.assertRaises(exception.InvalidLibvirtMdevConfig,
2530825308
libvirt_driver.LibvirtDriver,
2530925309
fake.FakeVirtAPI(), False)
2531025310

@@ -25687,8 +25687,9 @@ def test_allocate_mdevs_with_no_idea_of_the_provider(self, mock_warning):
2568725687
self.assertRaises(exception.ComputeResourcesUnavailable,
2568825688
drvr._allocate_mdevs, allocations=allocations)
2568925689
mock_warning.assert_called_once_with(
25690-
"pGPU device name %(name)s can't be guessed from the ProviderTree "
25691-
"roots %(roots)s", {'name': 'oops_I_did_it_again', 'roots': 'cn'})
25690+
"mdev-capable device name %(name)s can't be guessed from the "
25691+
"ProviderTree roots %(roots)s",
25692+
{'name': 'oops_I_did_it_again', 'roots': 'cn'})
2569225693

2569325694
@mock.patch.object(libvirt_driver.LibvirtDriver, '_get_vgpu_type_per_pgpu')
2569425695
@mock.patch.object(libvirt_driver.LibvirtDriver, '_get_mediated_devices')
@@ -25808,7 +25809,7 @@ def test_recreate_mediated_device_on_init_host_with_wrong_config(
2580825809
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
2580925810
# mdev1 was originally created for nvidia-99 but the operator messed up
2581025811
# the configuration by removing this type, we want to hardstop.
25811-
self.assertRaises(exception.InvalidLibvirtGPUConfig,
25812+
self.assertRaises(exception.InvalidLibvirtMdevConfig,
2581225813
drvr.init_host, host='foo')
2581325814

2581425815
@mock.patch.object(libvirt_guest.Guest, 'detach_device')

nova/virt/libvirt/driver.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -974,15 +974,14 @@ def _recreate_assigned_mediated_devices(self):
974974
# vGPU type. We can't recreate the mdev until the operator
975975
# modifies the configuration.
976976
parent = "{}:{}:{}.{}".format(*parent[4:].split('_'))
977-
msg = ("The instance UUID %(inst)s uses a VGPU that "
978-
"its parent pGPU %(parent)s no longer "
979-
"supports as the instance vGPU type %(type)s "
980-
"is not accepted for the pGPU. Please correct "
977+
msg = ("The instance UUID %(inst)s uses a mediated device "
978+
"type %(type)s that is no longer supported by the "
979+
"parent PCI device, %(parent)s. Please correct "
981980
"the configuration accordingly." %
982981
{'inst': instance_uuid,
983982
'parent': parent,
984983
'type': dev_info['type']})
985-
raise exception.InvalidLibvirtGPUConfig(reason=msg)
984+
raise exception.InvalidLibvirtMdevConfig(reason=msg)
986985
self._create_new_mediated_device(parent, uuid=mdev_uuid)
987986

988987
def _check_file_backed_memory_support(self):
@@ -7414,15 +7413,15 @@ def _get_supported_vgpu_types(self):
74147413
return [first_type]
74157414
for device_address in group.device_addresses:
74167415
if device_address in self.pgpu_type_mapping:
7417-
raise exception.InvalidLibvirtGPUConfig(
7416+
raise exception.InvalidLibvirtMdevConfig(
74187417
reason="duplicate types for PCI ID %s" % device_address
74197418
)
74207419
# Just checking whether the operator fat-fingered the address.
74217420
# If it's wrong, it will return an exception
74227421
try:
74237422
pci_utils.parse_address(device_address)
74247423
except exception.PciDeviceWrongAddressFormat:
7425-
raise exception.InvalidLibvirtGPUConfig(
7424+
raise exception.InvalidLibvirtMdevConfig(
74267425
reason="incorrect PCI address: %s" % device_address
74277426
)
74287427
self.pgpu_type_mapping[device_address] = vgpu_type
@@ -7452,12 +7451,12 @@ def _get_vgpu_type_per_pgpu(self, device_address):
74527451
except (exception.PciDeviceWrongAddressFormat, IndexError):
74537452
# this is not a valid PCI address
74547453
LOG.warning("The PCI address %s was invalid for getting the "
7455-
"related vGPU type", device_address)
7454+
"related mdev type", device_address)
74567455
return
74577456
try:
74587457
return self.pgpu_type_mapping.get(device_address)
74597458
except KeyError:
7460-
LOG.warning("No vGPU type was configured for PCI address: %s",
7459+
LOG.warning("No mdev type was configured for PCI address: %s",
74617460
device_address)
74627461
# We accept to return None instead of raising an exception
74637462
# because we prefer the callers to return the existing exceptions
@@ -7877,7 +7876,7 @@ def _allocate_mdevs(self, allocations):
78777876
# The provider doesn't exist, return a better understandable
78787877
# exception
78797878
raise exception.ComputeResourcesUnavailable(
7880-
reason='vGPU resource is not available')
7879+
reason='mdev-capable resource is not available')
78817880
# FIXME(sbauza): The functional reshape test assumes that we could
78827881
# run _allocate_mdevs() against non-nested RPs but this is impossible
78837882
# as all inventories have been reshaped *before now* since it's done
@@ -7900,14 +7899,14 @@ def _allocate_mdevs(self, allocations):
79007899
break
79017900
else:
79027901
LOG.warning(
7903-
"pGPU device name %(name)s can't be guessed from the "
7904-
"ProviderTree roots %(roots)s",
7902+
"mdev-capable device name %(name)s can't be guessed from "
7903+
"the ProviderTree roots %(roots)s",
79057904
{'name': rp_name,
79067905
'roots': ', '.join([root.name for root in roots])})
79077906
# We f... have no idea what was the parent device
79087907
# If we can't find devices having available VGPUs, just raise
79097908
raise exception.ComputeResourcesUnavailable(
7910-
reason='vGPU resource is not available')
7909+
reason='mdev-capable resource is not available')
79117910

79127911
supported_types = self.supported_vgpu_types
79137912
# Which mediated devices are created but not assigned to a guest ?
@@ -7925,7 +7924,7 @@ def _allocate_mdevs(self, allocations):
79257924
if not chosen_mdev:
79267925
# If we can't find devices having available VGPUs, just raise
79277926
raise exception.ComputeResourcesUnavailable(
7928-
reason='vGPU resource is not available')
7927+
reason='mdev-capable resource is not available')
79297928
else:
79307929
chosen_mdevs.append(chosen_mdev)
79317930
return chosen_mdevs
@@ -7946,7 +7945,7 @@ def _detach_mediated_devices(self, guest):
79467945
# operation to support reallocating mediated devices.
79477946
if error_code == libvirt.VIR_ERR_CONFIG_UNSUPPORTED:
79487947
reason = _("Suspend is not supported for instances having "
7949-
"attached vGPUs.")
7948+
"attached mediated devices.")
79507949
raise exception.InstanceFaultRollback(
79517950
exception.InstanceSuspendFailure(reason=reason))
79527951
else:

0 commit comments

Comments
 (0)