Add debug logging for when boot sequence is invalid in _validate_bdm
The cells job is failing to boot from volume with a bdm v2 request like: "block_device_mapping_v2": [{ "destination_type": "volume", "boot_index": 0, "uuid": "553083ac-40f2-4225-ac4d-a1d021eb7fb1", "source_type": "volume", "delete_on_termination": true }] Given it seems there should only be one BDM in the list and it's boot index is 0, we shouldn't fail on the boot sequence validation, so add some debug logging when we hit that failure. Also copy some wording out of the 'Block Device Mapping in Nova' section of the devref to add as code comments for the validation happening so we have context. TODO(mriedem): track down ndipanov to figure out why _subsequent_list omits the last element of the list that it's processing, we need to doc that logic in the code for maintainability. Change-Id: I8adc94f3c93c149689fbef424665fb44ac573819 Related-Bug: #1489581
This commit is contained in:
parent
fd2e946b62
commit
a084dbf9f0
|
@ -1282,15 +1282,22 @@ class API(base.Base):
|
|||
|
||||
def _validate_bdm(self, context, instance, instance_type, all_mappings):
|
||||
def _subsequent_list(l):
|
||||
# Each device which is capable of being used as boot device should
|
||||
# be given a unique boot index, starting from 0 in ascending order.
|
||||
return all(el + 1 == l[i + 1] for i, el in enumerate(l[:-1]))
|
||||
|
||||
# Make sure that the boot indexes make sense
|
||||
# Make sure that the boot indexes make sense.
|
||||
# Setting a negative value or None indicates that the device should not
|
||||
# be used for booting.
|
||||
boot_indexes = sorted([bdm.boot_index
|
||||
for bdm in all_mappings
|
||||
if bdm.boot_index is not None
|
||||
and bdm.boot_index >= 0])
|
||||
|
||||
if 0 not in boot_indexes or not _subsequent_list(boot_indexes):
|
||||
# Convert the BlockDeviceMappingList to a list for repr details.
|
||||
LOG.debug('Invalid block device mapping boot sequence for '
|
||||
'instance: %s', list(all_mappings), instance=instance)
|
||||
raise exception.InvalidBDMBootSequence()
|
||||
|
||||
for bdm in all_mappings:
|
||||
|
|
Loading…
Reference in New Issue