]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Extend param2id() to work with uuids
authorStephen Mulcahy <stephen.mulcahy@hp.com>
Thu, 21 Mar 2013 17:57:24 +0000 (17:57 +0000)
committerStephen Mulcahy <stephen.mulcahy@hp.com>
Thu, 21 Mar 2013 18:10:31 +0000 (18:10 +0000)
Add uuid support to param2id() to allow commands including
cinder-manage volume delete to work with uuid style volumd ids

Fixes bug #1158409

Change-Id: I2d197320b61f44d1104ed0342a6b5b70f673468a

bin/cinder-manage

index 8436afc0fdce8691d5c7396c298c21c79c79c2f6..15ad760b14c569b5730e1fa05c533f989e89fda1 100755 (executable)
@@ -83,6 +83,7 @@ from cinder import exception
 from cinder import flags
 from cinder.openstack.common import log as logging
 from cinder.openstack.common import rpc
+from cinder.openstack.common import uuidutils
 from cinder import utils
 from cinder import version
 
@@ -101,7 +102,9 @@ def param2id(object_id):
     """Helper function to convert various id types to internal id.
     args: [object_id], e.g. 'vol-0000000a' or 'volume-0000000a' or '10'
     """
-    if '-' in object_id:
+    if uuidutils.is_uuid_like(object_id):
+        return object_id
+    elif '-' in object_id:
         # FIXME(ja): mapping occurs in nova?
         pass
     else: