diff options
| author | Loganathan Parthipan <parthipan@hp.com> | 2013-04-30 13:13:33 +0000 |
|---|---|---|
| committer | Loganathan Parthipan <parthipan@hp.com> | 2013-05-02 01:41:11 +0000 |
| commit | 8e4eec840d504d27a3a4c640dba67b3b47e81730 (patch) | |
| tree | 3ef15fd69381b0be9e94641fa6d2762305cac2ae /nova/compute | |
| parent | b6aac988e46147154d49e938ecf9b67831613636 (diff) | |
Checks if volume can be attached
This patches makes a boot fail fast if one of the volumes cannot
be attached at boot time. Currently the request is accepted but
spawning fails in addition to leaving the volume state as
available which is an inconsistent state
Change-Id: I35b2034f8aa9574fcb8a34b58ead9f5e9ef27664
fixes: bug 1166770
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: |
