mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-02 08:56:07 +00:00
feat(instances): snapshot the VMs chosen on the VM list
Taking the same snapshot of many VMs, before an update say, took each one's Snapshots tab. The VM list's bulk form now has a snapshot name with Take snapshots: an external snapshot, without memory and without freezing file systems (the tab has those choices), queued as a snapshot.create job for each chosen VM, with the tab's rules (change rights and the snapshot permission). A VM refused or held is named and the others are queued; the Jobs page follows them. Enter in any text box of the form sends nothing. The power and snapshot views share one queuing helper.
This commit is contained in:
parent
1c3993133e
commit
e802fa07e2
13 changed files with 975 additions and 749 deletions
|
|
@ -429,8 +429,11 @@ class CreateSnapshot(Kind):
|
|||
|
||||
def validate(self, user, params):
|
||||
check_snapshot_name(params["name"])
|
||||
proxy = _proxy(_authorized(user, params["instance"]))
|
||||
if params["external"]: # what it reads before taking one, refused before it is queued
|
||||
proxy.check_external_snapshot(params["name"])
|
||||
# recovery counts a listed snapshot as taken by the job
|
||||
if params["name"] in _proxy(_authorized(user, params["instance"])).instance.snapshotListNames(0):
|
||||
elif params["name"] in proxy.instance.snapshotListNames(0):
|
||||
raise util.OperationError(_("A snapshot named %(name)s already exists"), name=params["name"])
|
||||
|
||||
def plan(self, user, params):
|
||||
|
|
|
|||
|
|
@ -72,6 +72,15 @@
|
|||
<button type="submit" class="btn btn-outline-danger" name="action" value="force_off" disabled
|
||||
data-confirm="{% trans "Force off the chosen VMs? They stop at once, as if unplugged, and may lose unsaved data." %}">{% trans "Force off" %}</button>
|
||||
</div>
|
||||
{% if snapshotable %}
|
||||
{# external, without memory and without freezing file systems: the VM's Snapshots tab has those choices #}
|
||||
<div class="input-group input-group-sm w-auto">
|
||||
<input class="form-control" type="text" name="snapshot_name" maxlength="64" placeholder="{% trans "Snapshot name" %}"
|
||||
aria-label="{% trans "Snapshot name" %}" style="width: 10rem">
|
||||
<button type="submit" class="btn btn-outline-primary" name="action" value="snapshot" formaction="{% url 'instances:bulk_snapshot' %}" disabled
|
||||
title="{% trans "An external snapshot of each chosen VM, without memory and without freezing its file systems" %}">{% trans "Take snapshots" %}</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser %}
|
||||
{# tags are a superuser's, as on the VM's Settings tab #}
|
||||
<div class="input-group input-group-sm w-auto">
|
||||
|
|
|
|||
102
instances/tests/test_bulk_snapshot.py
Normal file
102
instances/tests/test_bulk_snapshot.py
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
"""An external snapshot of each VM chosen on the VM list, of one name: a
|
||||
snapshot.create job each, with the VM page's rules (an owner with change
|
||||
rights and the snapshot permission). A VM that is refused is named and the
|
||||
others are queued."""
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.models import Permission
|
||||
from django.contrib.messages import get_messages
|
||||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
from lxml import html
|
||||
|
||||
from accounts.models import UserInstance
|
||||
from computes.models import Compute
|
||||
from instances.models import Instance
|
||||
from operations.models import Operation
|
||||
from vrtManager import util
|
||||
|
||||
|
||||
class BulkSnapshotTestCase(TestCase):
|
||||
def setUp(self):
|
||||
self.admin = get_user_model().objects.create_superuser("bs-admin", "bs@example.com", "pw")
|
||||
self.client.force_login(self.admin)
|
||||
compute = Compute.objects.create(name="bs-host", hostname="127.0.0.1", login="", password="", type=4)
|
||||
self.vms = [Instance.objects.create(compute=compute, name=f"bs-vm{n}", uuid=f"00000000-0000-4000-8000-00000000020{n}")
|
||||
for n in (1, 2)]
|
||||
# the VM's host is not this machine's libvirt: its last error would reach other tests
|
||||
proxy = self.proxy = MagicMock(**{"get_status.return_value": 5})
|
||||
proxy.instance.snapshotListNames.return_value = []
|
||||
proxy.check_external_snapshot.return_value = None
|
||||
patch.object(Instance, "proxy", property(lambda vm: proxy)).start()
|
||||
patch("instances.jobs._proxy", return_value=proxy).start() # the snapshot job's own connection
|
||||
self.addCleanup(patch.stopall)
|
||||
|
||||
def post(self, name, vms, user=None):
|
||||
if user:
|
||||
self.client.force_login(user)
|
||||
self.client.cookies.pop("messages", None)
|
||||
response = self.client.post(reverse("instances:bulk_snapshot"), {"snapshot_name": name, "vm": [vm.pk for vm in vms],
|
||||
"submission_key": "key-bulksnap1"})
|
||||
return response, [str(m) for m in get_messages(response.wsgi_request)]
|
||||
|
||||
def test_a_job_for_each_vm(self):
|
||||
response, said = self.post("before-update", self.vms)
|
||||
self.assertRedirects(response, reverse("operations:jobs") + "?kind=snapshot.create", fetch_redirect_response=False)
|
||||
self.assertEqual(said, ["2 VMs are queued; the Jobs page follows them."])
|
||||
self.assertEqual(sorted(op.params["instance"] for op in Operation.objects.all()), [vm.pk for vm in self.vms])
|
||||
self.assertEqual({(op.kind, op.params["name"], op.params["external"], op.params["memory"], op.params["quiesce"])
|
||||
for op in Operation.objects.all()}, {("snapshot.create", "before-update", True, False, False)})
|
||||
|
||||
def test_a_wrong_name_is_refused(self):
|
||||
_response, said = self.post(".hidden", self.vms)
|
||||
self.assertTrue(said and not Operation.objects.exists(), said)
|
||||
_response, said = self.post("", self.vms)
|
||||
self.assertEqual(said, ["Choose the VMs and write the snapshot's name"])
|
||||
|
||||
def test_an_owner_needs_the_snapshot_permission_and_change_rights(self):
|
||||
owner = get_user_model().objects.create_user("bs-owner", password="pw")
|
||||
UserInstance.objects.create(instance=self.vms[0], user=owner, is_change=True)
|
||||
UserInstance.objects.create(instance=self.vms[1], user=owner) # no change rights
|
||||
_response, said = self.post("s1", self.vms, user=owner)
|
||||
self.assertEqual(said, ["bs-vm1: you may not snapshot it", "bs-vm2: you may not snapshot it"])
|
||||
self.assertFalse(Operation.objects.exists())
|
||||
owner.user_permissions.add(Permission.objects.get(codename="snapshot_instances"))
|
||||
_response, said = self.post("s1", self.vms, user=owner)
|
||||
self.assertEqual(said, ["bs-vm2: you may not snapshot it", "1 VM is queued; the Jobs page follows it."])
|
||||
self.assertEqual([(op.kind, op.params["instance"]) for op in Operation.objects.all()],
|
||||
[("snapshot.create", self.vms[0].pk)])
|
||||
|
||||
def test_a_vm_that_cannot_take_one_or_a_template_is_refused_when_asked(self):
|
||||
# what the snapshot reads before it is taken, refused before it is queued; a template not at all
|
||||
def check(name):
|
||||
raise util.OperationError("The VM has internal snapshots; external snapshots cannot be mixed with them")
|
||||
|
||||
self.proxy.check_external_snapshot.side_effect = lambda name: None
|
||||
Instance.objects.filter(pk=self.vms[1].pk).update(is_template=True)
|
||||
_response, said = self.post("s1", self.vms)
|
||||
self.assertEqual(said, ["bs-vm2: a template's snapshots are not taken here", "1 VM is queued; the Jobs page follows it."])
|
||||
Operation.objects.all().delete()
|
||||
self.proxy.check_external_snapshot.side_effect = check
|
||||
_response, said = self.post("s2", self.vms[:1])
|
||||
self.assertEqual(said, ["bs-vm1: The VM has internal snapshots; external snapshots cannot be mixed with them"])
|
||||
self.assertFalse(Operation.objects.exists())
|
||||
|
||||
def test_the_box_is_for_one_who_may_snapshot_a_listed_vm(self):
|
||||
owner = get_user_model().objects.create_user("bs-owner2", password="pw")
|
||||
owner.user_permissions.add(Permission.objects.get(codename="snapshot_instances"))
|
||||
UserInstance.objects.create(instance=self.vms[0], user=owner) # no change rights
|
||||
self.client.force_login(owner)
|
||||
with patch("instances.views.utils.vm_states", return_value={}), \
|
||||
patch("instances.views.refresh_instance_database"), patch("instances.views.utils.read_list_rows"):
|
||||
page = html.fromstring(self.client.get(reverse("instances:index")).content)
|
||||
self.assertFalse(page.xpath("//input[@name='snapshot_name']"))
|
||||
|
||||
def test_the_list_offers_it(self):
|
||||
with patch("instances.views.utils.vm_states", return_value={}), \
|
||||
patch("instances.views.refresh_instance_database"), patch("instances.views.utils.read_list_rows"):
|
||||
page = html.fromstring(self.client.get(reverse("instances:index")).content)
|
||||
(form,) = page.xpath("//form[@id='bulk-power']")
|
||||
self.assertEqual(form.xpath(".//button[@value='snapshot']/@formaction"), [reverse("instances:bulk_snapshot")])
|
||||
self.assertTrue(form.xpath(".//input[@name='snapshot_name']"))
|
||||
|
|
@ -66,15 +66,16 @@ class BulkTagTestCase(TestCase):
|
|||
with patch("instances.views.utils.vm_states", return_value={}), \
|
||||
patch("instances.views.refresh_instance_database"), patch("instances.views.utils.read_list_rows"):
|
||||
page = html.fromstring(self.client.get(reverse("instances:index")).content)
|
||||
self.assertFalse(page.xpath("//button[@formaction]"))
|
||||
self.assertFalse(page.xpath("//button[starts-with(@value, 'tag_')]"))
|
||||
|
||||
def test_the_list_offers_them_to_a_superuser(self):
|
||||
with patch("instances.views.utils.vm_states", return_value={}), \
|
||||
patch("instances.views.refresh_instance_database"), patch("instances.views.utils.read_list_rows"):
|
||||
page = html.fromstring(self.client.get(reverse("instances:index")).content)
|
||||
(form,) = page.xpath("//form[@id='bulk-power']")
|
||||
self.assertEqual(form.xpath(".//button[@formaction]/@value"), ["tag_add", "tag_remove"])
|
||||
self.assertEqual(set(form.xpath(".//button[@formaction]/@formaction")), {reverse("instances:bulk_tag")})
|
||||
tag_buttons = form.xpath(".//button[starts-with(@value, 'tag_')]")
|
||||
self.assertEqual([b.get("value") for b in tag_buttons], ["tag_add", "tag_remove"])
|
||||
self.assertEqual({b.get("formaction") for b in tag_buttons}, {reverse("instances:bulk_tag")})
|
||||
self.assertTrue(form.xpath(".//input[@name='tag']"))
|
||||
# every tag offered, also one no VM has
|
||||
Tag.objects.create(name="hosts-only")
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ urlpatterns = [
|
|||
path("<int:pk>/", views.instance, name="instance"),
|
||||
path("bulk_power/", views.bulk_power, name="bulk_power"),
|
||||
path("bulk_tag/", views.bulk_tag, name="bulk_tag"),
|
||||
path("bulk_snapshot/", views.bulk_snapshot, name="bulk_snapshot"),
|
||||
path("<int:pk>/poweron/", views.poweron, name="poweron"),
|
||||
path("<int:pk>/powercycle/", views.powercycle, name="powercycle"),
|
||||
path("<int:pk>/poweroff/", views.poweroff, name="poweroff"),
|
||||
|
|
|
|||
|
|
@ -60,7 +60,8 @@ from webvirtcloud.middleware import error_text, same_origin_referer
|
|||
from vrtManager import util
|
||||
from vrtManager.connection import CONNECT_TIMEOUT
|
||||
from vrtManager.create import cpu_choices, wvmCreate
|
||||
from vrtManager.instance import BYTES_MAX, IOPS_MAX, USAGE_MAX_WINDOW, VIR_ERR_AGENT_COMMAND_TIMEOUT, wvmInstances
|
||||
from vrtManager.instance import (BYTES_MAX, IOPS_MAX, USAGE_MAX_WINDOW, VIR_ERR_AGENT_COMMAND_TIMEOUT, check_snapshot_name,
|
||||
wvmInstances)
|
||||
from vrtManager.interface import wvmInterface
|
||||
from vrtManager.nodedevs import (check_hostdevs, device_names, hostdev_problems, hostdev_users, managed_pci,
|
||||
node_devices, pci_problems, usb_unmatched)
|
||||
|
|
@ -136,6 +137,9 @@ def index(request):
|
|||
# a superuser's bulk tag box offers every tag, as the Settings tab's picker
|
||||
"tag_names": list(Tag.objects.order_by("name").values_list("name", flat=True)) if request.user.is_superuser else [],
|
||||
"bulk_max": BULK_MAX,
|
||||
# the bulk snapshot box: for one who may snapshot a listed VM (change rights and the permission)
|
||||
"snapshotable": request.user.is_superuser or (request.user.has_perm("instances.snapshot_instances") and
|
||||
UserInstance.objects.filter(user=request.user, is_change=True).exists()),
|
||||
"powerable": {i.pk for i in instances} if request.user.is_superuser else
|
||||
set(UserInstance.objects.filter(user=request.user).values_list("instance_id", flat=True))},
|
||||
)
|
||||
|
|
@ -748,22 +752,11 @@ def bulk_tag(request):
|
|||
return redirect("instances:index")
|
||||
|
||||
|
||||
@require_POST
|
||||
def bulk_power(request):
|
||||
"""Starts, shuts down or forces off the VMs chosen on the VM list: a job each
|
||||
(instances.jobs.POWER), followed on the Jobs page. A VM the user may not
|
||||
power, gone, or held by another job is named (if the user may see it);
|
||||
the others are queued."""
|
||||
from instances.jobs import POWER # instances.jobs imports this module
|
||||
|
||||
action, key = request.POST.get("action", ""), request.POST.get("submission_key", "")
|
||||
vms = _chosen_vms(request)
|
||||
if action not in POWER or not vms or not KEY_RE.fullmatch(key) or len(key) > 50:
|
||||
messages.error(request, _("Choose the VMs you may power, and Start, Shut down or Force off"))
|
||||
return redirect("instances:index")
|
||||
if len(vms) > BULK_MAX:
|
||||
messages.error(request, _("Choose at most %(count)s VMs at once") % {"count": BULK_MAX})
|
||||
return redirect("instances:index")
|
||||
def _queue_each(request, vms, kind, raw, refused):
|
||||
"""A job of kind for each of vms (raw: its parameters, the VM given), followed on the Jobs page.
|
||||
A VM refused (refused: the words, with %(vm)s), gone or held by another job is named, if the
|
||||
user may see it; the others are queued. One key per VM: a resent form queues none twice."""
|
||||
key = request.POST.get("submission_key", "")
|
||||
names = dict(Instance.objects.filter(pk__in=vms).values_list("pk", "name"))
|
||||
seen = names if request.user.is_superuser else dict(Instance.objects.filter(
|
||||
pk__in=vms, userinstance__user=request.user).values_list("pk", "name"))
|
||||
|
|
@ -771,20 +764,75 @@ def bulk_power(request):
|
|||
for pk in vms:
|
||||
name = seen.get(pk) or _("a chosen VM") # one the user may not see is not named
|
||||
try:
|
||||
# one key per VM: a resent form queues none twice
|
||||
jobs.submit(POWER[action], request.user, {"instance": pk}, f"{key}-{pk}")
|
||||
jobs.submit(kind, request.user, {**raw, "instance": pk}, f"{key}-{pk}")
|
||||
queued += 1
|
||||
except claims.Busy as busy:
|
||||
messages.error(request, f"{name}: {busy_message(busy, request.user)}")
|
||||
except (Http404, PermissionDenied, Instance.DoesNotExist):
|
||||
messages.error(request, _("%(vm)s: you may not power it now") % {"vm": name})
|
||||
messages.error(request, refused % {"vm": name})
|
||||
except (jobs.SubmissionConflict, libvirtError) as err:
|
||||
messages.error(request, f"{name}: {error_text(request, err)}")
|
||||
if not queued:
|
||||
return redirect("instances:index")
|
||||
messages.success(request, ngettext("%(count)s VM is queued; the Jobs page follows it.",
|
||||
"%(count)s VMs are queued; the Jobs page follows them.", queued) % {"count": queued})
|
||||
return redirect(reverse("operations:jobs") + f"?kind={POWER[action]}")
|
||||
return redirect(reverse("operations:jobs") + f"?kind={kind}")
|
||||
|
||||
|
||||
def _bulk_refused(request, vms, text):
|
||||
"""Why the VM list's bulk form cannot be taken (text when nothing fits), or None."""
|
||||
key = request.POST.get("submission_key", "")
|
||||
if not vms or not KEY_RE.fullmatch(key) or len(key) > 50:
|
||||
return text
|
||||
if len(vms) > BULK_MAX:
|
||||
return _("Choose at most %(count)s VMs at once") % {"count": BULK_MAX}
|
||||
return None
|
||||
|
||||
|
||||
@require_POST
|
||||
def bulk_power(request):
|
||||
"""Starts, shuts down or forces off the VMs chosen on the VM list: a job each
|
||||
(instances.jobs.POWER), as their pages' buttons do."""
|
||||
from instances.jobs import POWER # instances.jobs imports this module
|
||||
|
||||
action, vms = request.POST.get("action", ""), _chosen_vms(request)
|
||||
refusal = _bulk_refused(request, vms, _("Choose the VMs you may power, and Start, Shut down or Force off"))
|
||||
if action not in POWER or refusal:
|
||||
messages.error(request, refusal or _("Choose the VMs you may power, and Start, Shut down or Force off"))
|
||||
return redirect("instances:index")
|
||||
return _queue_each(request, vms, POWER[action], {}, _("%(vm)s: you may not power it now"))
|
||||
|
||||
|
||||
@require_POST
|
||||
def bulk_snapshot(request):
|
||||
"""An external snapshot, of one name and without memory, of each VM chosen on the VM list: a
|
||||
snapshot.create job each, as on its Snapshots tab, which has the other choices."""
|
||||
name, vms = request.POST.get("snapshot_name", "").strip(), _chosen_vms(request)
|
||||
refusal = _bulk_refused(request, vms, _("Choose the VMs and write the snapshot's name"))
|
||||
if not name or refusal:
|
||||
messages.error(request, refusal or _("Choose the VMs and write the snapshot's name"))
|
||||
return redirect("instances:index")
|
||||
try:
|
||||
check_snapshot_name(name)
|
||||
except util.OperationError as err:
|
||||
messages.error(request, error_text(request, err))
|
||||
return redirect("instances:index")
|
||||
# a template's page has no snapshot controls: none is taken here either
|
||||
templates = set(Instance.objects.filter(pk__in=vms, is_template=True).values_list("pk", flat=True))
|
||||
for pk in templates:
|
||||
messages.error(request, _("%(vm)s: a template's snapshots are not taken here") % {"vm": _visible_name(request, pk)})
|
||||
if templates and not set(vms) - templates:
|
||||
return redirect("instances:index")
|
||||
return _queue_each(request, [pk for pk in vms if pk not in templates], "snapshot.create",
|
||||
{"name": name, "external": True}, _("%(vm)s: you may not snapshot it"))
|
||||
|
||||
|
||||
def _visible_name(request, pk):
|
||||
"""The VM's name if the user may see it, else words that do not name it."""
|
||||
visible = Instance.objects.filter(pk=pk)
|
||||
if not request.user.is_superuser:
|
||||
visible = visible.filter(userinstance__user=request.user)
|
||||
return visible.values_list("name", flat=True).first() or _("a chosen VM")
|
||||
|
||||
|
||||
def from_script(request):
|
||||
|
|
|
|||
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
|
@ -40,15 +40,15 @@
|
|||
later = setTimeout(update, 50);
|
||||
}).observe(document.querySelector(".table-responsive") || document.body,
|
||||
{attributes: true, attributeFilter: ["hidden", "class"], subtree: true});
|
||||
// Enter in the tag box would send the form with its first button, Start: it sends nothing
|
||||
var tagBox = document.getElementById("bulk-tag");
|
||||
if (tagBox) {
|
||||
tagBox.addEventListener("keydown", function (event) {
|
||||
// Enter in a text box (a tag, a snapshot's name) would send the form with its first button,
|
||||
// Start: it sends nothing
|
||||
form.querySelectorAll("input[type='text']").forEach(function (box) {
|
||||
box.addEventListener("keydown", function (event) {
|
||||
if (event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
form.addEventListener("submit", function (event) {
|
||||
document.querySelectorAll("input[name='vm'][form='bulk-power']:checked").forEach(function (box) {
|
||||
if (!box.getClientRects().length) {
|
||||
|
|
|
|||
|
|
@ -2150,22 +2150,11 @@ class wvmInstance(wvmConnect):
|
|||
</domainsnapshot>"""
|
||||
self.instance.snapshotCreateXML(xml, 0)
|
||||
|
||||
def create_external_snapshot(self, name, desc="", memory=False, quiesce=False, free_percent=10, free_min_gib=1):
|
||||
"""A disk-only snapshot, or with memory too (running VMs only). Every
|
||||
disk gets a libvirt-named overlay next to it; the memory file goes
|
||||
next to the first disk. quiesce: the guest agent freezes the guest's
|
||||
file systems for a disk-only snapshot of a running VM (libvirt
|
||||
accepts it only without memory, which keeps the whole state anyway).
|
||||
free_percent, free_min_gib: the free space each pool keeps (see
|
||||
_check_snapshot_space)."""
|
||||
def check_external_snapshot(self, name):
|
||||
"""Refuses (OperationError) an external snapshot of name the VM cannot take, reading only:
|
||||
its state, internal snapshots, the name taken, snapshots newer than the current one, a disk
|
||||
that is no file or media still inserted. The VM's live definition, parsed."""
|
||||
check_snapshot_name(name)
|
||||
if quiesce:
|
||||
if memory:
|
||||
raise util.OperationError(gettext_noop("A snapshot with memory is not quiesced; it keeps the whole guest state"))
|
||||
if self.get_status() != 1:
|
||||
raise util.OperationError(gettext_noop("Only a running VM's file systems can be frozen"))
|
||||
if not self.is_agent_ready():
|
||||
raise util.OperationError(gettext_noop("The QEMU guest agent is not connected; it freezes the file systems"))
|
||||
self._check_snapshot_state()
|
||||
if self.instance.snapshotListNames(VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL):
|
||||
raise util.OperationError(gettext_noop("The VM has internal snapshots; external snapshots cannot be mixed with them"))
|
||||
|
|
@ -2185,6 +2174,24 @@ class wvmInstance(wvmConnect):
|
|||
raise util.OperationError(gettext_noop("Eject the media from %(dev)s first"), dev=dev)
|
||||
elif disk.get("type") != "file":
|
||||
raise util.OperationError(gettext_noop("Disk %(dev)s is not a file; external snapshots need file disks"), dev=dev)
|
||||
return tree
|
||||
|
||||
def create_external_snapshot(self, name, desc="", memory=False, quiesce=False, free_percent=10, free_min_gib=1):
|
||||
"""A disk-only snapshot, or with memory too (running VMs only). Every
|
||||
disk gets a libvirt-named overlay next to it; the memory file goes
|
||||
next to the first disk. quiesce: the guest agent freezes the guest's
|
||||
file systems for a disk-only snapshot of a running VM (libvirt
|
||||
accepts it only without memory, which keeps the whole state anyway).
|
||||
free_percent, free_min_gib: the free space each pool keeps (see
|
||||
_check_snapshot_space)."""
|
||||
if quiesce:
|
||||
if memory:
|
||||
raise util.OperationError(gettext_noop("A snapshot with memory is not quiesced; it keeps the whole guest state"))
|
||||
if self.get_status() != 1:
|
||||
raise util.OperationError(gettext_noop("Only a running VM's file systems can be frozen"))
|
||||
if not self.is_agent_ready():
|
||||
raise util.OperationError(gettext_noop("The QEMU guest agent is not connected; it freezes the file systems"))
|
||||
tree = self.check_external_snapshot(name)
|
||||
disks = list(self._disk_sources(tree).values())
|
||||
# free space, and the top overlays, are known to the pools only after
|
||||
# a refresh; nothing has changed yet when it fails
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ ALLOWED_FOR_ANY_USER = {
|
|||
"instances:index": "lists only the user's own instances",
|
||||
"instances:find_address": "searches only the user's own instances",
|
||||
"instances:states": "the VM list's poll: only the user's own instances",
|
||||
"instances:bulk_snapshot": "queues a snapshot.create job only for VMs the user may snapshot (its validate)",
|
||||
"instances:bulk_power": "queues a job only for VMs the user may power (instances.jobs.PowerVM)",
|
||||
"accounts:login": "login page",
|
||||
"accounts:email_otp": "part of the login flow (its own issues are tracked separately)",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue