Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .zuul.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
description: |
Run tempest live migration tests against local qcow2 ephemeral storage
and shared LVM/iSCSI cinder volumes.
irrelevant-files: &nova-base-irrelevant-files
irrelevant-files:
- ^api-.*$
- ^(test-|)requirements.txt$
- ^.*\.rst$
Expand All @@ -104,6 +104,7 @@
- ^nova/policies/.*$
- ^nova/tests/.*$
- ^nova/test.py$
- ^nova/virt/ironic/.*$
- ^releasenotes/.*$
- ^setup.cfg$
- ^tools/.*$
Expand Down Expand Up @@ -136,7 +137,21 @@
the "iptables_hybrid" securitygroup firewall driver, aka "hybrid plug".
The external events interactions between Nova and Neutron in these
situations has historically been fragile. This job exercises them.
irrelevant-files: *nova-base-irrelevant-files
irrelevant-files: &nova-base-irrelevant-files
- ^api-.*$
- ^(test-|)requirements.txt$
- ^.*\.rst$
- ^.git.*$
- ^doc/.*$
- ^nova/hacking/.*$
- ^nova/locale/.*$
- ^nova/policies/.*$
- ^nova/tests/.*$
- ^nova/test.py$
- ^releasenotes/.*$
- ^setup.cfg$
- ^tools/.*$
- ^tox.ini$
vars:
tox_envlist: all
tempest_test_regex: (^tempest\..*compute\..*(migration|resize|reboot).*)
Expand Down
13 changes: 13 additions & 0 deletions nova/virt/libvirt/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -7886,6 +7886,7 @@ def _get_existing_mdevs_not_assigned(self, parent, requested_types=None):
:param requested_types: Filter out the result for only mediated devices
having those types.
"""
LOG.debug('Searching for available mdevs...')
allocated_mdevs = self._get_all_assigned_mediated_devices()
mdevs = self._get_mediated_devices(requested_types)
available_mdevs = set()
Expand All @@ -7901,6 +7902,7 @@ def _get_existing_mdevs_not_assigned(self, parent, requested_types=None):
available_mdevs.add(mdev["uuid"])

available_mdevs -= set(allocated_mdevs)
LOG.info('Available mdevs at: %s.', available_mdevs)
return available_mdevs

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

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

@utils.synchronized(VGPU_RESOURCE_SEMAPHORE)
def _allocate_mdevs(self, allocations):
Expand Down Expand Up @@ -8015,13 +8025,16 @@ def _allocate_mdevs(self, allocations):
# Take the first available mdev
chosen_mdev = mdevs_available.pop()
else:
LOG.debug('No available mdevs where found. '
'Creating an new one...')
chosen_mdev = self._create_new_mediated_device(parent_device)
if not chosen_mdev:
# If we can't find devices having available VGPUs, just raise
raise exception.ComputeResourcesUnavailable(
reason='mdev-capable resource is not available')
else:
chosen_mdevs.append(chosen_mdev)
LOG.info('Allocated mdev: %s.', chosen_mdev)
return chosen_mdevs

def _detach_mediated_devices(self, guest):
Expand Down