On 11/27/18 11:32 AM, Dominik Csapak wrote:
> 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 it looks like this:
> 
> Starting cleanup for 101
> trying to acquire lock...
>  OK
> Configuration file 'nodes/pve-ceph-01/qemu-server/101.conf' does not exist
> Config for 101 not found, possibly migrated
> Finished cleanup for 101

This isn't really better, IMO, there shouldn't be an error/warning at all
in this case?

> 
> it makes it more clear that the cleanup correctly does nothing,
> and gives a hint that it got migrated
> 
> Signed-off-by: Dominik Csapak <[email protected]>
> ---
> maybe the $@ if $@ warn is too much?
> 
>  PVE/CLI/qm.pm | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
> index eceb9b3..f99dce0 100755
> --- a/PVE/CLI/qm.pm
> +++ b/PVE/CLI/qm.pm
> @@ -757,7 +757,12 @@ __PACKAGE__->register_method({
>       warn "Starting cleanup for $vmid\n";
>  
>       PVE::QemuConfig->lock_config($vmid, sub {
> -         my $conf = PVE::QemuConfig->load_config ($vmid);
> +         my $conf = eval { PVE::QemuConfig->load_config ($vmid) };
> +         if (!$conf) {
> +             warn $@ if $@;
> +             warn "Config for $vmid not found, possibly migrated\n";
> +             return;
> +         }
>           my $pid = PVE::QemuServer::check_running ($vmid);
>           die "vm still running\n" if $pid;
>  
> 


_______________________________________________
pve-devel mailing list
[email protected]
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to