1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-10-31 19:44:16 +00:00

Optimize snapshot capabilities to snap UEFI type machines. by @qrwitu

This commit is contained in:
catborise 2022-08-23 15:24:00 +03:00
parent 2910a3229a
commit f500d44492

View file

@ -1215,10 +1215,20 @@ class wvmInstance(wvmConnect):
name,
time.time(),
)
self.change_snapshot_xml()
xml += self._XMLDesc(VIR_DOMAIN_XML_SECURE)
xml += """<active>0</active>
</domainsnapshot>"""
self._snapshotCreateXML(xml, 0)
self.recover_snapshot_xml()
def change_snapshot_xml(self):
xml_temp = self._XMLDesc(VIR_DOMAIN_XML_SECURE).replace("<loader readonly='yes' type='pflash'>","<loader readonly='yes' type='rom'>")
self._defineXML(xml_temp)
def recover_snapshot_xml(self):
xml_temp = self._XMLDesc(VIR_DOMAIN_XML_SECURE).replace("<loader readonly='yes' type='rom'>","<loader readonly='yes' type='pflash'>")
self._defineXML(xml_temp)
def get_snapshot(self):
snapshots = []
@ -1234,8 +1244,10 @@ class wvmInstance(wvmConnect):
snap.delete(0)
def snapshot_revert(self, snapshot):
self.change_snapshot_xml()
snap = self.instance.snapshotLookupByName(snapshot, 0)
self.instance.revertToSnapshot(snap, 0)
self.recover_snapshot_xml()
def get_managed_save_image(self):
return self.instance.hasManagedSaveImage(0)