I just improved my patch based on the different location formats of RBD.
And I found a small bug in Mike's patch, at below code. pieces[3] is 'snap', not the image id. Here should be pieces[2].
+ # There are 2 types of 'rbd' urls:
+ # 'rbd://image' and 'rbd://fsid/pool/image/snapshot'
+ # First one is forbidden, second is okay
+ pieces = url[len(prefix):].split('/')
+ if len(pieces) == 4 and pieces[3] == image_id:
+ return True
+ return False
I just improved my patch based on the different location formats of RBD.
And I found a small bug in Mike's patch, at below code. pieces[3] is 'snap', not the image id. Here should be pieces[2].
+ # There are 2 types of 'rbd' urls: fsid/pool/ image/snapshot' prefix) :].split( '/')
+ # 'rbd://image' and 'rbd://
+ # First one is forbidden, second is okay
+ pieces = url[len(
+ if len(pieces) == 4 and pieces[3] == image_id:
+ return True
+ return False
>>> url="rbd: //b0849a66- 357e-4428- a84c-f5ccd277c0 76/images/ 3c9e8443- 8331-4415- aa48-55e7ac95b7 c0/snap" prefix) :].split( '/') 357e-4428- a84c-f5ccd277c0 76', 'images', '3c9e8443- 8331-4415- aa48-55e7ac95b7 c0', 'snap']
>>> prefix="rbd://"
>>> pieces = url[len(
>>> pieces
['b0849a66-