summaryrefslogtreecommitdiff
path: root/nova/cmd
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-08-18 14:43:06 +0000
committerGerrit Code Review <review@openstack.org>2021-08-18 14:43:06 +0000
commitcca1bb1baea0468d396be038ca9e345bf6164550 (patch)
treea595181bbb22b8ad44a21a990510099ee3a54779 /nova/cmd
parentb8c0f653c5978f2d4e92c6105135c561cf5fe382 (diff)
parent59c2262ca58460921b6ca7ee2bb74841f2f7dc0b (diff)
downloadnova-cca1bb1baea0468d396be038ca9e345bf6164550.tar.gz
Merge "Block servers with vGPU and device profile in heal_allocations"
Diffstat (limited to 'nova/cmd')
-rw-r--r--nova/cmd/manage.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/nova/cmd/manage.py b/nova/cmd/manage.py
index d0f1baaa24..6f00da20cd 100644
--- a/nova/cmd/manage.py
+++ b/nova/cmd/manage.py
@@ -1721,6 +1721,18 @@ class PlacementCommands(object):
allocations['user_id'] = instance.user_id
return allocations
+ @staticmethod
+ def ensure_instance_has_no_vgpu_request(instance):
+ if instance.flavor.extra_specs.get("resources:VGPU"):
+ raise exception.HealvGPUAllocationNotSupported(
+ instance_uuid=instance.uuid)
+
+ @staticmethod
+ def ensure_instance_has_no_cyborg_device_profile_request(instance):
+ if instance.flavor.extra_specs.get("accel:device_profile"):
+ raise exception.HealDeviceProfileAllocationNotSupported(
+ instance_uuid=instance.uuid)
+
def _heal_allocations_for_instance(self, ctxt, instance, node_cache,
output, placement, dry_run,
heal_port_allocations, neutron,
@@ -1777,6 +1789,9 @@ class PlacementCommands(object):
output(_('Instance %s is not on a host.') % instance.uuid)
return
+ self.ensure_instance_has_no_vgpu_request(instance)
+ self.ensure_instance_has_no_cyborg_device_profile_request(instance)
+
try:
allocations = placement.get_allocs_for_consumer(
ctxt, instance.uuid)
@@ -1893,7 +1908,7 @@ class PlacementCommands(object):
:param max_count: batch size (limit per instance query)
:param unlimited: True if all instances in the cell should be
processed, else False to just process $max_count instances
- :param outout: function that takes a single message for verbose output
+ :param output: function that takes a single message for verbose output
:param placement: nova.scheduler.client.report.SchedulerReportClient
to communicate with the Placement service API.
:param dry_run: Process instances and print output but do not commit
@@ -2033,6 +2048,7 @@ class PlacementCommands(object):
* 5: Unable to query ports from neutron
* 6: Unable to update ports in neutron
* 7: Cannot roll back neutron port updates. Manual steps needed.
+ * 8: Cannot heal instance with vGPU or Cyborg resource request
* 127: Invalid input.
"""
# NOTE(mriedem): Thoughts on ways to expand this:
@@ -2161,6 +2177,12 @@ class PlacementCommands(object):
except exception.UnableToRollbackPortUpdates as e:
print(e.format_message())
return 7
+ except (
+ exception.HealvGPUAllocationNotSupported,
+ exception.HealDeviceProfileAllocationNotSupported,
+ ) as e:
+ print(e.format_message())
+ return 8
# Make sure we don't go over the max count. Note that we
# don't include instances that already have allocations in the