[pve-devel] [PATCH v2 qemu-server 5/5] hotplug_pending: allow partial fast plugging

Stefan Reiter s.reiter at proxmox.com
Mon Feb 24 11:22:31 CET 2020


For the series:

Tested-by: Stefan Reiter <s.reiter at proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter at proxmox.com>

One small thing I noticed is that when Agent is enabled, guest_fstrim 
enabled, VM running and one disables the Agent but does not touch the 
guest_fstrim box, 'agent: 0' is set to pending, but guest_fstrim is also 
fastplugged to off. This makes sense, since the GUI doesn't send a value 
for a 'disabled' state checkbox, but might seem weird to a user who 
never touched the checkbox (and it still looks checked, just grayed 
out). Certainly an edge case, and a GUI issue if at all, so I'd say this 
series is fine as is.

On 2/19/20 5:07 PM, Oguz Bektas wrote:
> adds a loop after the main fastplug loop, to check if any of the options
> are partially fast pluggable.
> 
> these are defined in $partial_fast_plug_option
> 
> Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
> ---
> 
> v1->v2:
> * set $changes according to partial_fast_plug result as well as fast_plug result
> * do cleanup_pending before writing fastplug changes
> 
> 
> 
>   PVE/QemuConfig.pm |  7 +++++++
>   PVE/QemuServer.pm | 19 +++++++++++++++++++
>   2 files changed, 26 insertions(+)
> 
> diff --git a/PVE/QemuConfig.pm b/PVE/QemuConfig.pm
> index 1ba728a..d1727b2 100644
> --- a/PVE/QemuConfig.pm
> +++ b/PVE/QemuConfig.pm
> @@ -399,6 +399,13 @@ sub __snapshot_foreach_volume {
>   
>       PVE::QemuServer::foreach_drive($conf, $func);
>   }
> +
> +sub get_partial_fast_plug_option {
> +    my ($class) = @_;
> +
> +    return $PVE::QemuServer::partial_fast_plug_option;
> +}
> +
>   # END implemented abstract methods from PVE::AbstractConfig
>   
>   1;
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 44d0dee..8a689a0 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -4732,6 +4732,18 @@ my $fast_plug_option = {
>       'tags' => 1,
>   };
>   
> +# name of opt
> +# -> fmt -> format variable
> +# -> properties -> fastpluggable options hash
> +our $partial_fast_plug_option = {
> +    agent => {
> +	fmt => $agent_fmt,
> +	properties => {
> +	    fstrim_cloned_disks => 1
> +	},
> +    },
> +};
> +
>   # hotplug changes in [PENDING]
>   # $selection hash can be used to only apply specified options, for
>   # example: { cores => 1 } (only apply changed 'cores')
> @@ -4761,7 +4773,14 @@ sub vmconfig_hotplug_pending {
>   	}
>       }
>   
> +    foreach my $opt (keys %{$conf->{pending}}) {
> +	if ($partial_fast_plug_option->{$opt}) {
> +	    $changes ||= PVE::QemuConfig->partial_fast_plug($conf, $opt);
> +	}
> +    }
> +
>       if ($changes) {
> +	PVE::QemuConfig->cleanup_pending($conf);
>   	PVE::QemuConfig->write_config($vmid, $conf);
>       }
>   
> 




More information about the pve-devel mailing list