[pve-devel] [PATCH v2 qemu-server 6/6] rollback: handle pool limits
Fabian Grünbichler
f.gruenbichler at proxmox.com
Tue Apr 16 14:20:54 CEST 2024
by checking the snapshot conf values as if the VM was newly created.
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
PVE/API2/Qemu.pm | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index adbc6557..eca0ab79 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -5403,6 +5403,14 @@ __PACKAGE__->register_method({
my $realcmd = sub {
PVE::Cluster::log_msg('info', $authuser, "rollback snapshot VM $vmid: $snapname");
+ my $snap_conf = PVE::QemuConfig->load_config($vmid)->{snapshots}->{snapname};
+ my $snap_usage = PVE::QemuConfig->get_pool_usage($snap_conf);
+ my $changes = {
+ absolute => 1,
+ mem => $snap_usage->{mem},
+ cpu => $snap_usage->{cpu},
+ };
+ PVE::GuestHelpers::check_guest_pool_limit($vmid, $changes);
PVE::QemuConfig->snapshot_rollback($vmid, $snapname);
if ($param->{start} && !PVE::QemuServer::Helpers::vm_running_locally($vmid)) {
--
2.39.2
More information about the pve-devel
mailing list