* [pve-devel] [PATCH v2 qemu-server] qemu-agent: allow hotplug of fstrim_cloned_disk option.
@ 2021-10-05 9:46 Alexandre Derumier
2021-10-05 11:12 ` Fabian Grünbichler
0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Derumier @ 2021-10-05 9:46 UTC (permalink / raw)
To: pve-devel
This option don't have any impact on device itself.
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
PVE/QemuServer.pm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 076ce59..907d522 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4829,6 +4829,8 @@ sub vmconfig_hotplug_pending {
} elsif ($opt eq 'cpulimit') {
my $cpulimit = $conf->{pending}->{$opt} == 0 ? -1 : int($conf->{pending}->{$opt} * 100000);
$cgroup->change_cpu_quota($cpulimit, 100000);
+ } elsif ($opt eq 'agent') {
+ vmconfig_update_agent($conf, $opt, $value);
} else {
die "skip\n"; # skip non-hot-pluggable options
}
@@ -4988,6 +4990,23 @@ sub vmconfig_update_net {
}
}
+sub vmconfig_update_agent {
+ my ($conf, $opt, $value) = @_;
+
+ if ($conf->{$opt} && (my $old_agent = parse_guest_agent($conf))) {
+
+ my $agent = parse_guest_agent({$opt => $value});
+
+ # skip non hotpluggable value
+ if (safe_string_ne($agent->{enabled}, $old_agent->{enabled}) ||
+ safe_string_ne($agent->{type}, $old_agent->{type})) {
+ die "skip\n";
+ }
+ } else {
+ die "skip\n";
+ }
+}
+
sub vmconfig_update_disk {
my ($storecfg, $conf, $hotplug, $vmid, $opt, $value, $arch, $machine_type) = @_;
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [pve-devel] [PATCH v2 qemu-server] qemu-agent: allow hotplug of fstrim_cloned_disk option.
2021-10-05 9:46 [pve-devel] [PATCH v2 qemu-server] qemu-agent: allow hotplug of fstrim_cloned_disk option Alexandre Derumier
@ 2021-10-05 11:12 ` Fabian Grünbichler
2021-10-05 12:13 ` DERUMIER, Alexandre
0 siblings, 1 reply; 3+ messages in thread
From: Fabian Grünbichler @ 2021-10-05 11:12 UTC (permalink / raw)
To: Proxmox VE development discussion
On October 5, 2021 11:46 am, Alexandre Derumier wrote:
> This option don't have any impact on device itself.
>
> Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
> ---
> PVE/QemuServer.pm | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 076ce59..907d522 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -4829,6 +4829,8 @@ sub vmconfig_hotplug_pending {
> } elsif ($opt eq 'cpulimit') {
> my $cpulimit = $conf->{pending}->{$opt} == 0 ? -1 : int($conf->{pending}->{$opt} * 100000);
> $cgroup->change_cpu_quota($cpulimit, 100000);
> + } elsif ($opt eq 'agent') {
> + vmconfig_update_agent($conf, $opt, $value);
> } else {
> die "skip\n"; # skip non-hot-pluggable options
> }
> @@ -4988,6 +4990,23 @@ sub vmconfig_update_net {
> }
> }
>
> +sub vmconfig_update_agent {
> + my ($conf, $opt, $value) = @_;
> +
> + if ($conf->{$opt} && (my $old_agent = parse_guest_agent($conf))) {
> +
> + my $agent = parse_guest_agent({$opt => $value});
> +
> + # skip non hotpluggable value
shouldn't this be the other way round? check keys which are different,
and have a list of hotpluggable ones, skip if any others are different?
that way if we add another property to the agent it's fail-safe
(defaults to not being hotpluggable) until it is added to the explicit
list.
> + if (safe_string_ne($agent->{enabled}, $old_agent->{enabled}) ||
> + safe_string_ne($agent->{type}, $old_agent->{type})) {
> + die "skip\n";
> + }
> + } else {
> + die "skip\n";
> + }
> +}
> +
> sub vmconfig_update_disk {
> my ($storecfg, $conf, $hotplug, $vmid, $opt, $value, $arch, $machine_type) = @_;
>
> --
> 2.30.2
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [pve-devel] [PATCH v2 qemu-server] qemu-agent: allow hotplug of fstrim_cloned_disk option.
2021-10-05 11:12 ` Fabian Grünbichler
@ 2021-10-05 12:13 ` DERUMIER, Alexandre
0 siblings, 0 replies; 3+ messages in thread
From: DERUMIER, Alexandre @ 2021-10-05 12:13 UTC (permalink / raw)
To: pve-devel
Le mardi 05 octobre 2021 à 13:12 +0200, Fabian Grünbichler a écrit :
> shouldn't this be the other way round? check keys which are
> different,
> and have a list of hotpluggable ones, skip if any others are
> different?
>
> that way if we add another property to the agent it's fail-safe
> (defaults to not being hotpluggable) until it is added to the
> explicit
> list
yes, sure. I'll rework the patch and send a v3 tomorrow.
thanks for the review !
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-05 12:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-05 9:46 [pve-devel] [PATCH v2 qemu-server] qemu-agent: allow hotplug of fstrim_cloned_disk option Alexandre Derumier
2021-10-05 11:12 ` Fabian Grünbichler
2021-10-05 12:13 ` DERUMIER, Alexandre
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