@@ -8115,6 +8115,7 @@ def _get_existing_mdevs_not_assigned(self, parent, requested_types=None):
81158115 :param requested_types: Filter out the result for only mediated devices
81168116 having those types.
81178117 """
8118+ LOG.debug('Searching for available mdevs...')
81188119 allocated_mdevs = self._get_all_assigned_mediated_devices()
81198120 mdevs = self._get_mediated_devices(requested_types)
81208121 available_mdevs = set()
@@ -8130,6 +8131,7 @@ def _get_existing_mdevs_not_assigned(self, parent, requested_types=None):
81308131 available_mdevs.add(mdev["uuid"])
81318132
81328133 available_mdevs -= set(allocated_mdevs)
8134+ LOG.info('Available mdevs at: %s.', available_mdevs)
81338135 return available_mdevs
81348136
81358137 def _create_new_mediated_device(self, parent, uuid=None):
@@ -8141,6 +8143,7 @@ def _create_new_mediated_device(self, parent, uuid=None):
81418143
81428144 :returns: the newly created mdev UUID or None if not possible
81438145 """
8146+ LOG.debug('Attempting to create new mdev...')
81448147 supported_types = self.supported_vgpu_types
81458148 # Try to see if we can still create a new mediated device
81468149 devices = self._get_mdev_capable_devices(supported_types)
@@ -8152,6 +8155,7 @@ def _create_new_mediated_device(self, parent, uuid=None):
81528155 # The device is not the one that was called, not creating
81538156 # the mdev
81548157 continue
8158+ LOG.debug('Trying on: %s.', dev_name)
81558159 dev_supported_type = self._get_vgpu_type_per_pgpu(dev_name)
81568160 if dev_supported_type and device['types'][
81578161 dev_supported_type]['availableInstances'] > 0:
@@ -8161,7 +8165,13 @@ def _create_new_mediated_device(self, parent, uuid=None):
81618165 pci_addr = "{}:{}:{}.{}".format(*dev_name[4:].split('_'))
81628166 chosen_mdev = nova.privsep.libvirt.create_mdev(
81638167 pci_addr, dev_supported_type, uuid=uuid)
8168+ LOG.info('Created mdev: %s on pGPU: %s.',
8169+ chosen_mdev, pci_addr)
81648170 return chosen_mdev
8171+ LOG.debug('Failed: No available instances on device.')
8172+ LOG.info('Failed to create mdev. '
8173+ 'No free space found among the following devices: %s.',
8174+ [dev['dev_id'] for dev in devices])
81658175
81668176 @utils.synchronized(VGPU_RESOURCE_SEMAPHORE)
81678177 def _allocate_mdevs(self, allocations):
@@ -8244,13 +8254,16 @@ def _allocate_mdevs(self, allocations):
82448254 # Take the first available mdev
82458255 chosen_mdev = mdevs_available.pop()
82468256 else:
8257+ LOG.debug('No available mdevs where found. '
8258+ 'Creating an new one...')
82478259 chosen_mdev = self._create_new_mediated_device(parent_device)
82488260 if not chosen_mdev:
82498261 # If we can't find devices having available VGPUs, just raise
82508262 raise exception.ComputeResourcesUnavailable(
82518263 reason='mdev-capable resource is not available')
82528264 else:
82538265 chosen_mdevs.append(chosen_mdev)
8266+ LOG.info('Allocated mdev: %s.', chosen_mdev)
82548267 return chosen_mdevs
82558268
82568269 def _detach_mediated_devices(self, guest):
0 commit comments