[pve-devel] [PATCH qemu-server 3/3] use fstrim_cloned_disks property
Stoiko Ivanov
s.ivanov at proxmox.com
Thu Jul 5 19:42:35 CEST 2018
as conditional when trimming after move_disk, migrate or clone
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
PVE/API2/Qemu.pm | 4 ++--
PVE/QemuMigrate.pm | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 6dc2489..d157ba6 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2773,7 +2773,7 @@ __PACKAGE__->register_method({
PVE::QemuConfig->write_config($newid, $newconf);
- if ($running && $conf->{agent} && PVE::QemuServer::qga_check_running($vmid)) {
+ 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"); };
}
@@ -2954,7 +2954,7 @@ __PACKAGE__->register_method({
PVE::QemuConfig->write_config($vmid, $conf);
- if ($running && $conf->{agent} && PVE::QemuServer::qga_check_running($vmid)) {
+ 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"); };
}
diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index ca09469..39546c9 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -967,7 +967,7 @@ sub phase3_cleanup {
}
}
- if ($self->{storage_migration} && $conf->{qga} && $self->{running}) {
+ if ($self->{storage_migration} && PVE::QemuServer::parse_guest_agent($conf)->{fstrim_cloned_disks} && $self->{running}) {
my $cmd = [@{$self->{rem_ssh}}, 'qm', 'agent', $vmid, 'fstrim'];
eval{ PVE::Tools::run_command($cmd, outfunc => sub {}, errfunc => sub {}) };
}
--
2.11.0
More information about the pve-devel
mailing list