Skip to content

Commit 3314614

Browse files
committed
Add missing image-format attr on snap VDIs
Signed-off-by: Goulven Riou <goulven.riou@vates.tech>
1 parent 800c849 commit 3314614

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

drivers/FileSR.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,8 @@ def _snapshot(self, snap_type, cbtlog=None, cbt_consistency=None, is_mirror_dest
905905
leaf_vdi.utilisation = self.utilisation
906906
leaf_vdi.sm_config = {}
907907
leaf_vdi.sm_config['vhd-parent'] = dstparent
908+
# TODO: fix the raw snapshot case
909+
leaf_vdi.sm_config["image-format"] = getImageStringFromVdiType(self.vdi_type)
908910
# If the parent is encrypted set the key_hash
909911
# for the new snapshot disk
910912
vdi_ref = self.sr.srcmd.params['vdi_ref']
@@ -925,6 +927,8 @@ def _snapshot(self, snap_type, cbtlog=None, cbt_consistency=None, is_mirror_dest
925927
base_vdi.size = self.size
926928
base_vdi.utilisation = self.utilisation
927929
base_vdi.sm_config = {}
930+
# TODO: fix the raw snapshot case
931+
base_vdi.sm_config["image-format"] = getImageStringFromVdiType(self.vdi_type)
928932
grandparent = self.cowutil.getParent(newsrc, FileVDI.extractUuid)
929933
if grandparent:
930934
base_vdi.sm_config['vhd-parent'] = grandparent
@@ -942,6 +946,8 @@ def _snapshot(self, snap_type, cbtlog=None, cbt_consistency=None, is_mirror_dest
942946
vdi_ref = self.sr.srcmd.params['vdi_ref']
943947
sm_config = self.session.xenapi.VDI.get_sm_config(vdi_ref)
944948
sm_config['vhd-parent'] = srcparent
949+
# TODO: fix the raw snapshot case
950+
sm_config["image-format"] = getImageStringFromVdiType(self.vdi_type)
945951
self.session.xenapi.VDI.set_sm_config(vdi_ref, sm_config)
946952
except Exception as e:
947953
util.SMlog("vdi_clone: caught error during VDI.db_introduce: %s" % (str(e)))

drivers/LVMSR.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,6 +1894,7 @@ def _createSnap(self, snapUuid, snapVdiType, snapSizeLV, isNew, is_mirror_destin
18941894
snapVDI.sm_config[key] = val
18951895
snapVDI.sm_config["vdi_type"] = snapVdiType
18961896
snapVDI.sm_config["vhd-parent"] = snapParent
1897+
snapVDI.sm_config["image-format"] = getImageStringFromVdiType(self.vdi_type)
18971898
snapVDI.lvname = snapLV
18981899
return snapVDI
18991900

0 commit comments

Comments
 (0)