Origin: Ic14b5f69534ecea65ff3236a7dea09634a80e4a0 Description: No authentication on block device used for os-volume_boot Bug: https://bugs.launchpad.net/nova/+bug/1069904 Index: nova-2012.1.3+stable-20120827-4d2a4afe/nova/compute/api.py =================================================================== --- nova-2012.1.3+stable-20120827-4d2a4afe.orig/nova/compute/api.py 2013-01-23 13:37:24.000000000 -0600 +++ nova-2012.1.3+stable-20120827-4d2a4afe/nova/compute/api.py 2013-01-23 13:56:58.000000000 -0600 @@ -389,6 +389,21 @@ 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']) + if create_instance_here: instance = self.create_db_entry_for_new_instance( context, instance_type, image, base_options, Index: nova-2012.1.3+stable-20120827-4d2a4afe/nova/exception.py =================================================================== --- nova-2012.1.3+stable-20120827-4d2a4afe.orig/nova/exception.py 2013-01-23 13:37:24.000000000 -0600 +++ nova-2012.1.3+stable-20120827-4d2a4afe/nova/exception.py 2013-01-23 13:56:39.000000000 -0600 @@ -309,6 +309,24 @@ "%(method)s while the instance is in this state.") +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.")