Discussion:
[pve-devel] [PATCH qemu-server v2] better cleanup logging for migration
Dominik Csapak
2018-11-27 13:31:27 UTC
Permalink
if we migrate a vm we call cleanup but the logging looks like:

Starting cleanup for 101
trying to acquire lock...
OK
Configuration file 'nodes/pve-ceph-01/qemu-server/101.conf' does not exist

with this patch, we omit any logging in the case we do not have the config,
since we cannot know what to clean up

Signed-off-by: Dominik Csapak <***@proxmox.com>
---
PVE/CLI/qm.pm | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
index eceb9b3..8d4fb9b 100755
--- a/PVE/CLI/qm.pm
+++ b/PVE/CLI/qm.pm
@@ -753,6 +753,12 @@ __PACKAGE__->register_method({
my $clean = $param->{'clean-shutdown'};
my $guest = $param->{'guest-requested'};

+ my $conf = eval { PVE::QemuConfig->load_config ($vmid) };
+ if (!$conf) {
+ # silently return if vm is migrated
+ return;
+ }
+
my $storecfg = PVE::Storage::config();
warn "Starting cleanup for $vmid\n";
--
2.11.0
Thomas Lamprecht
2018-11-28 07:11:37 UTC
Permalink
Post by Dominik Csapak
Starting cleanup for 101
trying to acquire lock...
OK
Configuration file 'nodes/pve-ceph-01/qemu-server/101.conf' does not exist
with this patch, we omit any logging in the case we do not have the config,
since we cannot know what to clean up
---
PVE/CLI/qm.pm | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
index eceb9b3..8d4fb9b 100755
--- a/PVE/CLI/qm.pm
+++ b/PVE/CLI/qm.pm
@@ -753,6 +753,12 @@ __PACKAGE__->register_method({
my $clean = $param->{'clean-shutdown'};
my $guest = $param->{'guest-requested'};
+ my $conf = eval { PVE::QemuConfig->load_config ($vmid) };
you cause an unnecessary IPC read here for the case this check is true,
maybe just do an:

return if -f PVE::QemuConfig->config_file($vmid);
Post by Dominik Csapak
+ if (!$conf) {
+ # silently return if vm is migrated
change to 'return if VM does not belong to us anymore' because this is the reason,
migration is just one way it gets shown...
Post by Dominik Csapak
+ return;
+ }
+
my $storecfg = PVE::Storage::config();
warn "Starting cleanup for $vmid\n";
Loading...