mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 03:36:48 +00:00
fix(instances): reverting a running VM to an internal snapshot fails before any effect
The internal revert's shut-off check ran in the job's run, after its intent was recorded, so the refusal went to recovery: the job ended uncertain and kept the VM's claim until a superuser resolved it. The check (check_internal_revert) now runs in precheck too, so a page older than the VM's start, or a direct POST, fails the job with the reason.
This commit is contained in:
parent
fe102f98c8
commit
62976cbd55
3 changed files with 18 additions and 3 deletions
|
|
@ -2301,12 +2301,17 @@ class wvmInstance(wvmConnect):
|
|||
self._check_snapshot_state()
|
||||
self._snapshot(snapshot, external=False).delete(0)
|
||||
|
||||
def snapshot_revert(self, snapshot):
|
||||
"""An internal snapshot is reverted to on a shut-off VM; one of a
|
||||
running VM starts it again as it was then."""
|
||||
def check_internal_revert(self):
|
||||
"""Refuses a revert to an internal snapshot, before anything changes,
|
||||
unless the VM is shut off."""
|
||||
if self.get_status() != 5:
|
||||
raise util.OperationError(gettext_noop("Shut the VM down to revert to an internal snapshot"))
|
||||
self._check_snapshot_state()
|
||||
|
||||
def snapshot_revert(self, snapshot):
|
||||
"""An internal snapshot is reverted to on a shut-off VM; one of a
|
||||
running VM starts it again as it was then."""
|
||||
self.check_internal_revert()
|
||||
self.instance.revertToSnapshot(self._snapshot(snapshot, external=False), 0)
|
||||
|
||||
def get_managed_save_image(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue