diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-08-24 21:47:19 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-08-24 21:47:19 +0000 |
| commit | 325fb8599923ca92fd237b9efd97ccf50beb5dd0 (patch) | |
| tree | 4620f9a3e675200643bcfb5954f58e36c12c84f7 | |
| parent | 2d972302079846561460bb7b9831949ca0d29f88 (diff) | |
| parent | 6fe4b23e3e4278825833e628f958c3d517e3d9f8 (diff) | |
| download | nova-325fb8599923ca92fd237b9efd97ccf50beb5dd0.tar.gz nova-325fb8599923ca92fd237b9efd97ccf50beb5dd0.tar.xz nova-325fb8599923ca92fd237b9efd97ccf50beb5dd0.zip | |
Merge "Check volume status before detaching."
| -rw-r--r-- | nova/compute/api.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 6c21414b6..205f59667 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -1724,6 +1724,10 @@ class API(base.Base): def detach_volume(self, context, volume_id): """Detach a volume from an instance.""" volume = self.volume_api.get(context, volume_id) + if volume['attach_status'] == 'detached': + msg = _("Volume must be attached in order to detach.") + raise exception.InvalidVolume(reason=msg) + instance_uuid = volume['instance_uuid'] instance = self.db.instance_get_by_uuid(context.elevated(), instance_uuid) |
