[pve-devel] [PATCH qemu-server] hotplug_pending: allow hotplugging of 'fstrim_cloned_disks'

Oguz Bektas o.bektas at proxmox.com
Thu Jan 16 15:57:39 CET 2020


Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---

some thoughts about this, based on our offline discussion with dominik.

this patch currently allows us to hotplug the fstrim option for agent,
when it's the only change.
however if the user changes both the type and this option for example,
it will not hotplug the option. this is the same behavior/semantic we
have with the other options like for disks (where you can hotplug some
options like backup etc. but they won't hotplug if you change
non-hotpluggable things at the same time).

one way of handling this in a generic way (for reuse) would be to have a
schema for each property string, to define the hotpluggability (or other
traits) of each substring/option.

so for now i decided to leave it like this since it behaves similar to
our other options, but we can discuss some solutions


 PVE/QemuServer.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 9ef3b71..c2547d6 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5031,6 +5031,13 @@ sub vmconfig_hotplug_pending {
 		}
 		vmconfig_update_disk($storecfg, $conf, $hotplug_features->{disk},
 				     $vmid, $opt, $value, 1, $arch, $machine_type);
+	    } elsif ($opt eq 'agent') {
+		my $old_agent = parse_guest_agent($conf);
+		my $new_agent = parse_guest_agent($conf->{pending});
+		if ($old_agent->{enabled} ne $new_agent->{enabled} ||
+		    $old_agent->{type} ne $new_agent->{type}) {
+		    die "skip\n"; # can't hotplug-enable agent or change type
+		}
 	    } elsif ($opt =~ m/^memory$/) { #dimms
 		die "skip\n" if !$hotplug_features->{memory};
 		$value = PVE::QemuServer::Memory::qemu_memory_hotplug($vmid, $conf, $defaults, $opt, $value);
-- 
2.20.1




More information about the pve-devel mailing list