1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

experimental: external snapshot fixes 2

This commit is contained in:
catborise 2023-04-14 16:11:13 +03:00
parent 06994b0423
commit f4aa925e2a
2 changed files with 5 additions and 1 deletions

View file

@ -1056,10 +1056,13 @@ def revert_external_snapshot(request, pk):
if allow_admin_or_not_template and request.user.has_perm(
"instances.snapshot_instances"
):
instance_state = True if instance.proxy.get_status() != 5 else False
name = request.POST.get("name", "")
date = request.POST.get("date", "")
desc = request.POST.get("desc", "")
instance.proxy.revert_external_snapshot(name, instance, date, desc)
instance.proxy.force_shutdown() if instance_state else None
instance.proxy.revert_external_snapshot(name, date, desc)
instance.proxy.start() if instance_state else None
msg = _("Revert external snapshot: %(snap)s") % {"snap": name}
addlogmsg(request.user.username, instance.compute.name, instance.name, msg)
return redirect(request.META.get("HTTP_REFERER") + "#managesnapshot")