[pve-devel] [PATCH qemu 2/2] migrate: log which local resource causes error

Tim Marx t.marx at proxmox.com
Fri May 3 13:38:19 CEST 2019


It looks like this: can't migrate VM which uses local devices-usb1-usb2-usb0-hostpci0

Seems ok for me?

> Dominik Csapak <d.csapak at proxmox.com> hat am 3. Mai 2019 um 13:31 geschrieben:
> 
> 
> afaics, the error will look like:
> 
> "can't migrate VM which uses local devicesivshmem-usb0-hostpci1'
> 
> ?
> 
> would it not be better to do something like
> 
> 
> my $loc_res = [];
> 
> loop {
>     push @$loc_res, 'local_resource';
> }
> 
> return join(", ", @$loc_res)?
> 
> On 5/3/19 1:25 PM, Tim Marx wrote:
> > Signed-off-by: Tim Marx <t.marx at proxmox.com>
> > ---
> >   PVE/QemuMigrate.pm |  2 +-
> >   PVE/QemuServer.pm  | 10 +++++-----
> >   2 files changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
> > index e915a9a..3e5e7d8 100644
> > --- a/PVE/QemuMigrate.pm
> > +++ b/PVE/QemuMigrate.pm
> > @@ -221,7 +221,7 @@ sub prepare {
> >   
> >       if (my $loc_res = PVE::QemuServer::check_local_resources($conf, 1)) {
> >   	if ($self->{running} || !$self->{opts}->{force}) {
> > -	    die "can't migrate VM which uses local devices\n";
> > +	    die "can't migrate VM which uses local devices${loc_res}\n";
> >   	} else {
> >   	    $self->log('info', "migrating VM which uses local devices");
> >   	}
> > diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> > index ee4fbd3..77bace3 100644
> > --- a/PVE/QemuServer.pm
> > +++ b/PVE/QemuServer.pm
> > @@ -2846,18 +2846,18 @@ sub config_list {
> >   sub check_local_resources {
> >       my ($conf, $noerr) = @_;
> >   
> > -    my $loc_res = 0;
> > +    my $loc_res = "";
> >   
> > -    $loc_res = 1 if $conf->{hostusb}; # old syntax
> > -    $loc_res = 1 if $conf->{hostpci}; # old syntax
> > +    $loc_res = join("-", $loc_res, "hostusb") if $conf->{hostusb}; # old syntax
> > +    $loc_res = join("-", $loc_res, "hostpci") if $conf->{hostpci}; # old syntax
> >   
> > -    $loc_res = 1 if $conf->{ivshmem};
> > +    $loc_res = join("-", $loc_res, "ivshmem") if $conf->{ivshmem};
> >   
> >       foreach my $k (keys %$conf) {
> >   	next if $k =~ m/^usb/ && ($conf->{$k} eq 'spice');
> >   	# sockets are safe: they will recreated be on the target side post-migrate
> >   	next if $k =~ m/^serial/ && ($conf->{$k} eq 'socket');
> > -	$loc_res = 1 if $k =~ m/^(usb|hostpci|serial|parallel)\d+$/;
> > +	$loc_res = join("-", $loc_res, $k) if $k =~ m/^(usb|hostpci|serial|parallel)\d+$/;
> >       }
> >   
> >       die "VM uses local resources\n" if $loc_res && !$noerr;
> > 
> 
> 
> also that last die statement would also profit from the list of local 
> resources, no?
>




More information about the pve-devel mailing list