mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
fix(instances): snapshot tab reads less and fails less
The snapshot tab listed the VM's snapshots three times per page: once per kind and once more for all of them. The list of all is now made from the two kinds, so the combined flag is no longer used anywhere. The revert confirm named only the disks the persistent definition would lose. A disk hot-plugged into the running VM alone is detached too, so the live definition is compared with what ran when the snapshot was taken. A storage pool refresh error after libvirt had already made, reverted or deleted the snapshot was shown as if the operation had failed. It is now logged, and the left-behind check is skipped then, since a stale pool still lists the removed files. A volume removed while that check reads it is skipped too. An error reading the block jobs no longer breaks the instance page; create, revert and delete still query the jobs again and refuse.
This commit is contained in:
parent
3fd422db7e
commit
ff4ffab382
6 changed files with 136 additions and 21 deletions
|
|
@ -263,7 +263,7 @@ class Instance(models.Model):
|
|||
|
||||
@cached_property
|
||||
def snapshots(self) -> list[dict]:
|
||||
return self._snapshots(VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL | VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL)
|
||||
return sorted(self.internal_snapshots + self.external_snapshots, reverse=True, key=lambda k: k["date"])
|
||||
|
||||
@cached_property
|
||||
def internal_snapshots(self) -> list[dict]:
|
||||
|
|
@ -275,7 +275,11 @@ class Instance(models.Model):
|
|||
|
||||
@cached_property
|
||||
def snapshot_jobs(self) -> list[dict]:
|
||||
return self.proxy.get_snapshot_jobs()
|
||||
# only for the page; create, revert and delete query the jobs again and refuse if that fails
|
||||
try:
|
||||
return self.proxy.get_snapshot_jobs()
|
||||
except libvirtError:
|
||||
return []
|
||||
|
||||
@cached_property
|
||||
def inst_xml(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue