Skip to content

Commit c2c53f0

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Improving logging at '_allocate_mdevs'." into stable/xena
2 parents ac3728e + e099571 commit c2c53f0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

nova/virt/libvirt/driver.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7886,6 +7886,7 @@ def _get_existing_mdevs_not_assigned(self, parent, requested_types=None):
78867886
:param requested_types: Filter out the result for only mediated devices
78877887
having those types.
78887888
"""
7889+
LOG.debug('Searching for available mdevs...')
78897890
allocated_mdevs = self._get_all_assigned_mediated_devices()
78907891
mdevs = self._get_mediated_devices(requested_types)
78917892
available_mdevs = set()
@@ -7901,6 +7902,7 @@ def _get_existing_mdevs_not_assigned(self, parent, requested_types=None):
79017902
available_mdevs.add(mdev["uuid"])
79027903

79037904
available_mdevs -= set(allocated_mdevs)
7905+
LOG.info('Available mdevs at: %s.', available_mdevs)
79047906
return available_mdevs
79057907

79067908
def _create_new_mediated_device(self, parent, uuid=None):
@@ -7912,6 +7914,7 @@ def _create_new_mediated_device(self, parent, uuid=None):
79127914

79137915
:returns: the newly created mdev UUID or None if not possible
79147916
"""
7917+
LOG.debug('Attempting to create new mdev...')
79157918
supported_types = self.supported_vgpu_types
79167919
# Try to see if we can still create a new mediated device
79177920
devices = self._get_mdev_capable_devices(supported_types)
@@ -7923,6 +7926,7 @@ def _create_new_mediated_device(self, parent, uuid=None):
79237926
# The device is not the one that was called, not creating
79247927
# the mdev
79257928
continue
7929+
LOG.debug('Trying on: %s.', dev_name)
79267930
dev_supported_type = self._get_vgpu_type_per_pgpu(dev_name)
79277931
if dev_supported_type and device['types'][
79287932
dev_supported_type]['availableInstances'] > 0:
@@ -7932,7 +7936,13 @@ def _create_new_mediated_device(self, parent, uuid=None):
79327936
pci_addr = "{}:{}:{}.{}".format(*dev_name[4:].split('_'))
79337937
chosen_mdev = nova.privsep.libvirt.create_mdev(
79347938
pci_addr, dev_supported_type, uuid=uuid)
7939+
LOG.info('Created mdev: %s on pGPU: %s.',
7940+
chosen_mdev, pci_addr)
79357941
return chosen_mdev
7942+
LOG.debug('Failed: No available instances on device.')
7943+
LOG.info('Failed to create mdev. '
7944+
'No free space found among the following devices: %s.',
7945+
[dev['dev_id'] for dev in devices])
79367946

79377947
@utils.synchronized(VGPU_RESOURCE_SEMAPHORE)
79387948
def _allocate_mdevs(self, allocations):
@@ -8015,13 +8025,16 @@ def _allocate_mdevs(self, allocations):
80158025
# Take the first available mdev
80168026
chosen_mdev = mdevs_available.pop()
80178027
else:
8028+
LOG.debug('No available mdevs where found. '
8029+
'Creating an new one...')
80188030
chosen_mdev = self._create_new_mediated_device(parent_device)
80198031
if not chosen_mdev:
80208032
# If we can't find devices having available VGPUs, just raise
80218033
raise exception.ComputeResourcesUnavailable(
80228034
reason='mdev-capable resource is not available')
80238035
else:
80248036
chosen_mdevs.append(chosen_mdev)
8037+
LOG.info('Allocated mdev: %s.', chosen_mdev)
80258038
return chosen_mdevs
80268039

80278040
def _detach_mediated_devices(self, guest):

0 commit comments

Comments
 (0)