Skip to content

Commit 5d2f2e9

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Change the admin-visible logs for mdev support"
2 parents 51f3d6c + 9cf07d5 commit 5d2f2e9

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
@@ -2364,8 +2364,8 @@ def __init__(self, arqs, **kwargs):
23642364
self.arqs = arqs or []
23652365

23662366

2367-
class InvalidLibvirtGPUConfig(NovaException):
2368-
msg_fmt = _('Invalid configuration for GPU devices: %(reason)s')
2367+
class InvalidLibvirtMdevConfig(NovaException):
2368+
msg_fmt = _('Invalid configuration for mdev-capable devices: %(reason)s')
23692369

23702370

23712371
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
@@ -25400,7 +25400,7 @@ def test_get_supported_vgpu_types_with_duplicate_types(self):
2540025400
# Provide the same pGPU PCI ID for two different types
2540125401
self.flags(device_addresses=['0000:84:00.0'], group='mdev_nvidia-11')
2540225402
self.flags(device_addresses=['0000:84:00.0'], group='mdev_nvidia-12')
25403-
self.assertRaises(exception.InvalidLibvirtGPUConfig,
25403+
self.assertRaises(exception.InvalidLibvirtMdevConfig,
2540425404
libvirt_driver.LibvirtDriver,
2540525405
fake.FakeVirtAPI(), False)
2540625406

@@ -25411,7 +25411,7 @@ def test_get_supported_vgpu_types_with_invalid_pci_address(self):
2541125411
nova.conf.devices.register_dynamic_opts(CONF)
2541225412
# Fat-finger the PCI address
2541325413
self.flags(device_addresses=['whoops'], group='mdev_nvidia-11')
25414-
self.assertRaises(exception.InvalidLibvirtGPUConfig,
25414+
self.assertRaises(exception.InvalidLibvirtMdevConfig,
2541525415
libvirt_driver.LibvirtDriver,
2541625416
fake.FakeVirtAPI(), False)
2541725417

@@ -25794,8 +25794,9 @@ def test_allocate_mdevs_with_no_idea_of_the_provider(self, mock_warning):
2579425794
self.assertRaises(exception.ComputeResourcesUnavailable,
2579525795
drvr._allocate_mdevs, allocations=allocations)
2579625796
mock_warning.assert_called_once_with(
25797-
"pGPU device name %(name)s can't be guessed from the ProviderTree "
25798-
"roots %(roots)s", {'name': 'oops_I_did_it_again', 'roots': 'cn'})
25797+
"mdev-capable device name %(name)s can't be guessed from the "
25798+
"ProviderTree roots %(roots)s",
25799+
{'name': 'oops_I_did_it_again', 'roots': 'cn'})
2579925800

2580025801
@mock.patch.object(libvirt_driver.LibvirtDriver, '_get_vgpu_type_per_pgpu')
2580125802
@mock.patch.object(libvirt_driver.LibvirtDriver, '_get_mediated_devices')
@@ -25915,7 +25916,7 @@ def test_recreate_mediated_device_on_init_host_with_wrong_config(
2591525916
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
2591625917
# mdev1 was originally created for nvidia-99 but the operator messed up
2591725918
# the configuration by removing this type, we want to hardstop.
25918-
self.assertRaises(exception.InvalidLibvirtGPUConfig,
25919+
self.assertRaises(exception.InvalidLibvirtMdevConfig,
2591925920
drvr.init_host, host='foo')
2592025921

2592125922
@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):
@@ -7430,15 +7429,15 @@ def _get_supported_vgpu_types(self):
74307429
return [first_type]
74317430
for device_address in group.device_addresses:
74327431
if device_address in self.pgpu_type_mapping:
7433-
raise exception.InvalidLibvirtGPUConfig(
7432+
raise exception.InvalidLibvirtMdevConfig(
74347433
reason="duplicate types for PCI ID %s" % device_address
74357434
)
74367435
# Just checking whether the operator fat-fingered the address.
74377436
# If it's wrong, it will return an exception
74387437
try:
74397438
pci_utils.parse_address(device_address)
74407439
except exception.PciDeviceWrongAddressFormat:
7441-
raise exception.InvalidLibvirtGPUConfig(
7440+
raise exception.InvalidLibvirtMdevConfig(
74427441
reason="incorrect PCI address: %s" % device_address
74437442
)
74447443
self.pgpu_type_mapping[device_address] = vgpu_type
@@ -7468,12 +7467,12 @@ def _get_vgpu_type_per_pgpu(self, device_address):
74687467
except (exception.PciDeviceWrongAddressFormat, IndexError):
74697468
# this is not a valid PCI address
74707469
LOG.warning("The PCI address %s was invalid for getting the "
7471-
"related vGPU type", device_address)
7470+
"related mdev type", device_address)
74727471
return
74737472
try:
74747473
return self.pgpu_type_mapping.get(device_address)
74757474
except KeyError:
7476-
LOG.warning("No vGPU type was configured for PCI address: %s",
7475+
LOG.warning("No mdev type was configured for PCI address: %s",
74777476
device_address)
74787477
# We accept to return None instead of raising an exception
74797478
# because we prefer the callers to return the existing exceptions
@@ -7893,7 +7892,7 @@ def _allocate_mdevs(self, allocations):
78937892
# The provider doesn't exist, return a better understandable
78947893
# exception
78957894
raise exception.ComputeResourcesUnavailable(
7896-
reason='vGPU resource is not available')
7895+
reason='mdev-capable resource is not available')
78977896
# FIXME(sbauza): The functional reshape test assumes that we could
78987897
# run _allocate_mdevs() against non-nested RPs but this is impossible
78997898
# as all inventories have been reshaped *before now* since it's done
@@ -7916,14 +7915,14 @@ def _allocate_mdevs(self, allocations):
79167915
break
79177916
else:
79187917
LOG.warning(
7919-
"pGPU device name %(name)s can't be guessed from the "
7920-
"ProviderTree roots %(roots)s",
7918+
"mdev-capable device name %(name)s can't be guessed from "
7919+
"the ProviderTree roots %(roots)s",
79217920
{'name': rp_name,
79227921
'roots': ', '.join([root.name for root in roots])})
79237922
# We f... have no idea what was the parent device
79247923
# If we can't find devices having available VGPUs, just raise
79257924
raise exception.ComputeResourcesUnavailable(
7926-
reason='vGPU resource is not available')
7925+
reason='mdev-capable resource is not available')
79277926

79287927
supported_types = self.supported_vgpu_types
79297928
# Which mediated devices are created but not assigned to a guest ?
@@ -7941,7 +7940,7 @@ def _allocate_mdevs(self, allocations):
79417940
if not chosen_mdev:
79427941
# If we can't find devices having available VGPUs, just raise
79437942
raise exception.ComputeResourcesUnavailable(
7944-
reason='vGPU resource is not available')
7943+
reason='mdev-capable resource is not available')
79457944
else:
79467945
chosen_mdevs.append(chosen_mdev)
79477946
return chosen_mdevs
@@ -7962,7 +7961,7 @@ def _detach_mediated_devices(self, guest):
79627961
# operation to support reallocating mediated devices.
79637962
if error_code == libvirt.VIR_ERR_CONFIG_UNSUPPORTED:
79647963
reason = _("Suspend is not supported for instances having "
7965-
"attached vGPUs.")
7964+
"attached mediated devices.")
79667965
raise exception.InstanceFaultRollback(
79677966
exception.InstanceSuspendFailure(reason=reason))
79687967
else:

0 commit comments

Comments
 (0)