Origin: backport, Ic14b5f69534ecea65ff3236a7dea09634a80e4a0 Description: No authentication on block device used for os-volume_boot Bug: https://bugs.launchpad.net/nova/+bug/1069904 Index: nova-2011.3/nova/compute/api.py =================================================================== --- nova-2011.3.orig/nova/compute/api.py 2013-01-23 14:03:23.000000000 -0600 +++ nova-2011.3/nova/compute/api.py 2013-01-23 14:04:02.000000000 -0600 @@ -541,6 +541,22 @@ block_device_mapping = block_device_mapping or [] instances = [] LOG.debug(_("Going to run %s instances..."), num_instances) + + # Validate our use of the block devices + for bdm in block_device_mapping: + # NOTE(vish): For now, just make sure the volumes are accessible. + if bdm.get('snapshot_id') is not None and \ + 'volume_id' in bdm and bdm['volume_id'] is None: + try: + self.volume_api.get_snapshot(context, bdm['snapshot_id']) + except Exception: + raise exception.InvalidBDMSnapshot(id=bdm['snapshot_id']) + elif 'volume_id' in bdm and bdm['volume_id'] is not None: + try: + self.volume_api.get(context, bdm['volume_id']) + except Exception: + raise exception.InvalidBDMVolume(id=bdm['volume_id']) + for num in range(num_instances): instance = self.create_db_entry_for_new_instance(context, instance_type, image, Index: nova-2011.3/nova/exception.py =================================================================== --- nova-2011.3.orig/nova/exception.py 2013-01-23 14:03:23.000000000 -0600 +++ nova-2011.3/nova/exception.py 2013-01-23 14:03:30.000000000 -0600 @@ -224,6 +224,24 @@ message = _("%(err)s") +class InvalidBDM(Invalid): + message = _("Block Device Mapping is Invalid.") + + +class InvalidBDMSnapshot(InvalidBDM): + message = _("Block Device Mapping is Invalid: " + "failed to get snapshot %(id)s.") + + +class InvalidBDMVolume(InvalidBDM): + message = _("Block Device Mapping is Invalid: " + "failed to get volume %(id)s.") + + +class InvalidSnapshot(Invalid): + message = _("Invalid snapshot") + ": %(reason)s" + + class InstanceNotRunning(Invalid): message = _("Instance %(instance_id)s is not running.")