[pve-devel] applied: [PATCH qemu-server v2 2/2] Fix #1242 : clone_disk : call qga fstrim after clone

Alexandre DERUMIER aderumier at odiso.com
Sun Aug 5 20:54:19 CEST 2018


Thanks!

(I'm back from holiday tomorrow, I'll test it)

----- Mail original -----
De: "Thomas Lamprecht" <t.lamprecht at proxmox.com>
À: "pve-devel" <pve-devel at pve.proxmox.com>, "Stoiko Ivanov" <s.ivanov at proxmox.com>
Envoyé: Jeudi 2 Août 2018 12:19:05
Objet: [pve-devel] applied: [PATCH qemu-server v2 2/2] Fix #1242 : clone_disk : call qga fstrim after clone

Am 08/01/2018 um 08:29 PM schrieb Stoiko Ivanov: 
> Some storage like rbd or lvm can't keep thin-provising after a qemu-mirror. 
> 
> Call qga guest-fstrim if qga is available and fstrim_cloned_disks is enabled 
> after move_disk and migrate. 
> 
> Co-Authored-By: Alexandre Derumier <aderumier at odiso.com> 
> Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com> 

applied, thanks! 

> --- 
> PVE/API2/Qemu.pm | 4 ++++ 
> PVE/QemuMigrate.pm | 5 +++++ 
> 2 files changed, 9 insertions(+) 
> 
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm 
> index 464ba7f..b0af9d9 100644 
> --- a/PVE/API2/Qemu.pm 
> +++ b/PVE/API2/Qemu.pm 
> @@ -2969,6 +2969,10 @@ __PACKAGE__->register_method({ 
> 
> PVE::QemuConfig->write_config($vmid, $conf); 
> 
> + if ($running && PVE::QemuServer::parse_guest_agent($conf)->{fstrim_cloned_disks} && PVE::QemuServer::qga_check_running($vmid)) { 
> + eval { PVE::QemuServer::vm_mon_cmd($vmid, "guest-fstrim"); }; 
> + } 
> + 
> eval { 
> # try to deactivate volumes - avoid lvm LVs to be active on several nodes 
> PVE::Storage::deactivate_volumes($storecfg, [ $newdrive->{file} ]) 
> diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm 
> index 27cf7e3..e9e9075 100644 
> --- a/PVE/QemuMigrate.pm 
> +++ b/PVE/QemuMigrate.pm 
> @@ -966,6 +966,11 @@ sub phase3_cleanup { 
> $self->{errors} = 1; 
> } 
> } 
> + 
> + if ($self->{storage_migration} && PVE::QemuServer::parse_guest_agent($conf)->{fstrim_cloned_disks} && $self->{running}) { 
> + my $cmd = [@{$self->{rem_ssh}}, 'qm', 'guest', 'cmd', $vmid, 'fstrim']; 
> + eval{ PVE::Tools::run_command($cmd, outfunc => sub {}, errfunc => sub {}) }; 
> + } 
> } 
> 
> # close tunnel on successful migration, on error phase2_cleanup closed it 
> 


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




More information about the pve-devel mailing list