'features_name': JList(JLeaf(str)),
'stripe_count': JLeaf(int, none=True),
'stripe_unit': JLeaf(int, none=True),
- 'parent': JObj(sub_elems={'pool_name': JLeaf(str),
+ 'parent': JObj(sub_elems={'pool_id': JLeaf(int),
+ 'pool_name': JLeaf(str),
'pool_namespace': JLeaf(str, none=True),
+ 'image_id': JLeaf(str),
'image_name': JLeaf(str),
+ 'trash': JLeaf(bool),
+ 'snap_id': JLeaf(int),
+ 'snap_namespace_type': JLeaf(int),
'snap_name': JLeaf(str)}, none=True),
'data_pool': JLeaf(str, none=True),
'snapshots': JList(JLeaf(dict)),
self.assertSchema(img, schema)
for k, v in kwargs.items():
- if isinstance(v, list):
+ if k == 'parent' and v is not None:
+ # check that img['parent'] contains (is a superset of) v
+ actual = {pk: img['parent'][pk]
+ for pk in v.keys() if pk in img['parent']}
+ self.assertEqual(actual, v)
+ elif isinstance(v, list):
self.assertSetEqual(set(img[k]), set(v))
else:
self.assertEqual(img[k], v)
Get spec of the cloned image's parent
:returns: dict - contains the following keys:
+
+ * ``pool_id`` (int) - parent pool id
+
* ``pool_name`` (str) - parent pool name
+
* ``pool_namespace`` (str) - parent pool namespace
+
+ * ``image_id`` (str) - parent image id
+
* ``image_name`` (str) - parent image name
+
+ * ``trash`` (bool) - True if parent image is in trash bin
+
+ * ``snap_id`` (int) - parent snapshot id
+
+ * ``snap_namespace_type`` (int) - parent snapshot namespace type
+
* ``snap_name`` (str) - parent snapshot name
:raises: :class:`ImageNotFound` if the image doesn't have a parent
if ret != 0:
raise make_ex(ret, 'error getting parent info for image %s' % self.name)
- result = {'pool_name': decode_cstr(parent_spec.pool_name),
+ result = {'pool_id': parent_spec.pool_id,
+ 'pool_name': decode_cstr(parent_spec.pool_name),
'pool_namespace': decode_cstr(parent_spec.pool_namespace),
+ 'image_id': decode_cstr(parent_spec.image_id),
'image_name': decode_cstr(parent_spec.image_name),
+ 'trash': parent_spec.trash,
+ 'snap_id': snap_spec.id,
+ 'snap_namespace_type': snap_spec.namespace_type,
'snap_name': decode_cstr(snap_spec.name)}
rbd_linked_image_spec_cleanup(&parent_spec)