diff --git a/instances/views.py b/instances/views.py index eb6d0bb..5ba91e9 100755 --- a/instances/views.py +++ b/instances/views.py @@ -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") diff --git a/vrtManager/instance.py b/vrtManager/instance.py index 680dd09..b434751 100644 --- a/vrtManager/instance.py +++ b/vrtManager/instance.py @@ -1335,6 +1335,7 @@ class wvmInstance(wvmConnect): info = self.instance.blockJobInfo(target_dev, 0) if info.get('cur') == info.get('end'): self.instance.blockJobAbort(target_dev,flags=VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT) + time.sleep(2) break # Check again pool for snapshot delta volume; if it exist, remove it manually with contextlib.suppress(libvirtError):