all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH-SERIES qemu-server stable-bookworm 0/3] VM-state property handling improvements
@ 2025-09-18  9:38 Fiona Ebner
  2025-09-18  9:38 ` [pve-devel] [PATCH qemu-server 1/3] partially fix #6805: api: clone: properly remove all snapshot-related info Fiona Ebner
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Fiona Ebner @ 2025-09-18  9:38 UTC (permalink / raw)
  To: pve-devel

Backports of the already applied series here:
https://lore.proxmox.com/pve-devel/20250917163038.488710-1-f.ebner@proxmox.com/T/

There is no running-nets-host-mtu snapshot option yet in Proxmox VE 8,
so it's only about bug #6805.

Fiona Ebner (3):
  partially fix #6805: api: clone: properly remove all snapshot-related
    info
  partially fix #6805: api: modify vm config: privilege checks for
    VM-state-related properties
  vm start: remove left-over VM-state-related properties

 src/PVE/API2/Qemu.pm  |  6 +++++-
 src/PVE/QemuServer.pm | 16 ++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH qemu-server 1/3] partially fix #6805: api: clone: properly remove all snapshot-related info
  2025-09-18  9:38 [pve-devel] [PATCH-SERIES qemu-server stable-bookworm 0/3] VM-state property handling improvements Fiona Ebner
@ 2025-09-18  9:38 ` Fiona Ebner
  2025-09-18  9:38 ` [pve-devel] [PATCH qemu-server 2/3] partially fix #6805: api: modify vm config: privilege checks for VM-state-related properties Fiona Ebner
  2025-09-18  9:38 ` [pve-devel] [PATCH qemu-server 3/3] vm start: remove left-over " Fiona Ebner
  2 siblings, 0 replies; 4+ messages in thread
From: Fiona Ebner @ 2025-09-18  9:38 UTC (permalink / raw)
  To: pve-devel

When cloning from a snapshot, the current VM state is not copied. Not
all relevant properties were dropped, leading to some left-overs in
the configuration of the clone target.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250917163038.488710-2-f.ebner@proxmox.com
(cherry picked from commit 6572ff578488da700123281ac447d2ad6bd1771f)
[FE: drop running-nets-host-mtu which does not exist in PVE 8]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/API2/Qemu.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
index 9d026bc5..5af117ba 100644
--- a/src/PVE/API2/Qemu.pm
+++ b/src/PVE/API2/Qemu.pm
@@ -4333,7 +4333,9 @@ __PACKAGE__->register_method({
                     || $opt eq 'parent'
                     || $opt eq 'snaptime'
                     || $opt eq 'vmstate'
-                    || $opt eq 'snapstate';
+                    || $opt eq 'snapstate'
+                    || $opt eq 'runningcpu'
+                    || $opt eq 'runningmachine';
 
                 # no need to copy unused images, because VMID(owner) changes anyways
                 next if $opt =~ m/^unused\d+$/;
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH qemu-server 2/3] partially fix #6805: api: modify vm config: privilege checks for VM-state-related properties
  2025-09-18  9:38 [pve-devel] [PATCH-SERIES qemu-server stable-bookworm 0/3] VM-state property handling improvements Fiona Ebner
  2025-09-18  9:38 ` [pve-devel] [PATCH qemu-server 1/3] partially fix #6805: api: clone: properly remove all snapshot-related info Fiona Ebner
@ 2025-09-18  9:38 ` Fiona Ebner
  2025-09-18  9:38 ` [pve-devel] [PATCH qemu-server 3/3] vm start: remove left-over " Fiona Ebner
  2 siblings, 0 replies; 4+ messages in thread
From: Fiona Ebner @ 2025-09-18  9:38 UTC (permalink / raw)
  To: pve-devel

Currently, the VM-state-related properties 'runningcpu' and
'runningmachine' are not supposed to end up in the VM configuration of
a remote-migratable VM, because a suspended VM is not yet migratable.
However, there was a bug and the properties were not removed after
cloning from a snapshot, see commit "partially fix #6805: api: clone:
properly remove all snapshot-related info". Upon remote migration, the
property would be encountered and would be limited to root@pam only.

To aid fixing bug #6805, do proper privilege checking for
configuration properties related to the running VM state.

Note that the 'vmstate' property is already checked for in the
check_vm_modify_config_perm() helper. Note that VM-state-related
properties cannot be set via API by a user.

Originally-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250917163038.488710-3-f.ebner@proxmox.com
(cherry picked from commit 7c05f0be9858543272c1254c83f4dfc266b97fe2)
[FE: drop running-nets-host-mtu which does not exist in PVE 8]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/API2/Qemu.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
index 5af117ba..8b990371 100644
--- a/src/PVE/API2/Qemu.pm
+++ b/src/PVE/API2/Qemu.pm
@@ -721,6 +721,7 @@ my $check_cpu_model_access = sub {
 my $cpuoptions = {
     'cores' => 1,
     'cpu' => 1,
+    'runningcpu' => 1,
     'cpulimit' => 1,
     'cpuunits' => 1,
     'numa' => 1,
@@ -740,6 +741,7 @@ my $hwtypeoptions = {
     'hotplug' => 1,
     'kvm' => 1,
     'machine' => 1,
+    'runningmachine' => 1,
     'scsihw' => 1,
     'smbios1' => 1,
     'tablet' => 1,
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH qemu-server 3/3] vm start: remove left-over VM-state-related properties
  2025-09-18  9:38 [pve-devel] [PATCH-SERIES qemu-server stable-bookworm 0/3] VM-state property handling improvements Fiona Ebner
  2025-09-18  9:38 ` [pve-devel] [PATCH qemu-server 1/3] partially fix #6805: api: clone: properly remove all snapshot-related info Fiona Ebner
  2025-09-18  9:38 ` [pve-devel] [PATCH qemu-server 2/3] partially fix #6805: api: modify vm config: privilege checks for VM-state-related properties Fiona Ebner
@ 2025-09-18  9:38 ` Fiona Ebner
  2 siblings, 0 replies; 4+ messages in thread
From: Fiona Ebner @ 2025-09-18  9:38 UTC (permalink / raw)
  To: pve-devel

When cloning from a snapshot, VM-state-related properties would be
accidentally copied, see commit "partially fix #6805: api: clone:
properly remove all snapshot-related info". Detect and remove such
left-over properties upon VM start.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250917163038.488710-7-f.ebner@proxmox.com
(cherry picked from commit 0db14e60109ea91a558f0f08594583588ef9ec66)
[FE: drop running-nets-host-mtu which does not exist in PVE 8]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/QemuServer.pm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 8bc55def..94d12a92 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -5905,6 +5905,20 @@ sub vm_migrate_alloc_nbd_disks {
     return $nbd;
 }
 
+my sub remove_left_over_vmstate_opts {
+    my ($vmid, $conf) = @_;
+
+    my $found;
+    for my $opt (qw(runningmachine runningcpu)) {
+        if (defined($conf->{$opt})) {
+            print "No VM state set, removing left-over option '$opt'\n";
+            delete $conf->{$opt};
+            $found = 1;
+        }
+    }
+    PVE::QemuConfig->write_config($vmid, $conf) if $found;
+}
+
 # see vm_start_nolock for parameters, additionally:
 # migrate_opts:
 #   storagemap = parsed storage map for allocating NBD disks
@@ -6434,6 +6448,8 @@ sub vm_start_nolock {
         }
         delete $conf->@{qw(lock vmstate runningmachine runningcpu)};
         PVE::QemuConfig->write_config($vmid, $conf);
+    } elsif (!$conf->{vmstate}) {
+        remove_left_over_vmstate_opts($vmid, $conf);
     }
 
     PVE::GuestHelpers::exec_hookscript($conf, $vmid, 'post-start');
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-09-18  9:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-18  9:38 [pve-devel] [PATCH-SERIES qemu-server stable-bookworm 0/3] VM-state property handling improvements Fiona Ebner
2025-09-18  9:38 ` [pve-devel] [PATCH qemu-server 1/3] partially fix #6805: api: clone: properly remove all snapshot-related info Fiona Ebner
2025-09-18  9:38 ` [pve-devel] [PATCH qemu-server 2/3] partially fix #6805: api: modify vm config: privilege checks for VM-state-related properties Fiona Ebner
2025-09-18  9:38 ` [pve-devel] [PATCH qemu-server 3/3] vm start: remove left-over " Fiona Ebner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal