summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2011-11-24 07:08:52 +0000
committerMark McLoughlin <markmc@redhat.com>2011-11-24 07:08:52 +0000
commitd8301748152e10ba64b4cebb79d4dad139988cea (patch)
tree8780dee6453a832fd9198c70b34d076e545e9fa6
parent1670bccfa42c48e964c691e94c76359d56a73e59 (diff)
Remove boot-from-volume unreachable code path (#894172)
In http://review.openstack.org/1834 it was discovered that a bool-from-volume code path in nova/compute/manager.py can never be reached. The code is basically: if ((bdm['snapshot_id'] is not None) and (bdm['volume_id'] is None)): vol = volume_api.create(context, ...) ... bdm['volume_id'] = vol['id'] if ((bdm['snapshot_id'] is not None) and (bdm['volume_id'] is None)): ... raise exception.ApiError(...) (after applying De Morgan's laws to the expression in the second if statement, that is) It's obvious that the code path can only be reached if the volume API's create() method can return a volume with id=None, but it can't ever do this. From: https://code.launchpad.net/~yamahata/nova/boot-from-volume-0/+merge/62419 it looks like the author originally had this check as an assertion, which makes more sense, but changed it to the current code following a review comment. Change-Id: I9f85028675f5dac8ab23bd150869eca421fc2fd0
-rw-r--r--nova/compute/manager.py11
1 files changed, 0 insertions, 11 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 2f0b0c71c..5f0d522d6 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -303,17 +303,6 @@ class ComputeManager(manager.SchedulerDependentManager):
context, bdm['id'], {'volume_id': vol['id']})
bdm['volume_id'] = vol['id']
- if not ((bdm['snapshot_id'] is None) or
- (bdm['volume_id'] is not None)):
- LOG.error(_('corrupted state of block device mapping '
- 'id: %(id)s snapshot: %(snapshot_id)s '
- 'volume: %(volume_id)s') %
- {'id': bdm['id'],
- 'snapshot_id': bdm['snapshot'],
- 'volume_id': bdm['volume_id']})
- raise exception.ApiError(_('broken block device mapping %d') %
- bdm['id'])
-
if bdm['volume_id'] is not None:
volume_api.check_attach(context,
volume_id=bdm['volume_id'])