diff options
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/api.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 3f3078d5b..ac52b805d 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -780,11 +780,16 @@ class API(base.Base): for bdm in self.db.block_device_mapping_get_all_by_instance( context, instance['uuid']): # NOTE(vish): For now, just make sure the volumes are accessible. + # Additionally, check that the volume can be attached to this + # instance. snapshot_id = bdm.get('snapshot_id') volume_id = bdm.get('volume_id') if volume_id is not None: try: - self.volume_api.get(context, volume_id) + volume = self.volume_api.get(context, volume_id) + self.volume_api.check_attach(context, + volume, + instance=instance) except Exception: raise exception.InvalidBDMVolume(id=volume_id) elif snapshot_id is not None: |
