Richard W.M. Jones
2018-Aug-14 13:40 UTC
[Libguestfs] [PATCH] v2v: -o rhv-upload: Fix error message disk numbering (RHBZ#1615885).
Thanks: Xiaodai Wang --- v2v/output_rhv_upload.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml index 6260eaac5..df91a117f 100644 --- a/v2v/output_rhv_upload.ml +++ b/v2v/output_rhv_upload.ml @@ -361,13 +361,13 @@ If the messages above are not sufficient to diagnose the problem then add the *) let nr_disks = List.length targets in let image_uuids - List.map ( - fun t -> + List.mapi ( + fun i t -> let id = t.target_overlay.ov_source.s_disk_id in let diskid_file = diskid_file_of_id id in if not (wait_for_file diskid_file finalization_timeout) then error (f_"transfer of disk %d/%d failed, see earlier error messages") - (id+1) nr_disks; + (i+1) nr_disks; let diskid = read_whole_file diskid_file in diskid ) targets in -- 2.18.0
Pino Toscano
2018-Aug-14 14:03 UTC
Re: [Libguestfs] [PATCH] v2v: -o rhv-upload: Fix error message disk numbering (RHBZ#1615885).
On Tuesday, 14 August 2018 15:40:54 CEST Richard W.M. Jones wrote:> Thanks: Xiaodai Wang > --- > v2v/output_rhv_upload.ml | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml > index 6260eaac5..df91a117f 100644 > --- a/v2v/output_rhv_upload.ml > +++ b/v2v/output_rhv_upload.ml > @@ -361,13 +361,13 @@ If the messages above are not sufficient to diagnose the problem then add the > *) > let nr_disks = List.length targets in > let image_uuids > - List.map ( > - fun t -> > + List.mapi ( > + fun i t -> > let id = t.target_overlay.ov_source.s_disk_id in > let diskid_file = diskid_file_of_id id in > if not (wait_for_file diskid_file finalization_timeout) then > error (f_"transfer of disk %d/%d failed, see earlier error messages") > - (id+1) nr_disks; > + (i+1) nr_disks;This works only when the input is based on libvirt, and produce e.g. "transfer of disk 0/1 failed" when using -i disk, -i ova, and -i vmx. IMHO the issue is in the libvirt XML parser, which starts to number the disks from 1. I'm sending a patch for this. -- Pino Toscano
Richard W.M. Jones
2018-Aug-14 14:54 UTC
Re: [Libguestfs] [PATCH] v2v: -o rhv-upload: Fix error message disk numbering (RHBZ#1615885).
On Tue, Aug 14, 2018 at 04:03:13PM +0200, Pino Toscano wrote:> On Tuesday, 14 August 2018 15:40:54 CEST Richard W.M. Jones wrote: > > Thanks: Xiaodai Wang > > --- > > v2v/output_rhv_upload.ml | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml > > index 6260eaac5..df91a117f 100644 > > --- a/v2v/output_rhv_upload.ml > > +++ b/v2v/output_rhv_upload.ml > > @@ -361,13 +361,13 @@ If the messages above are not sufficient to diagnose the problem then add the > > *) > > let nr_disks = List.length targets in > > let image_uuids > > - List.map ( > > - fun t -> > > + List.mapi ( > > + fun i t -> > > let id = t.target_overlay.ov_source.s_disk_id in > > let diskid_file = diskid_file_of_id id in > > if not (wait_for_file diskid_file finalization_timeout) then > > error (f_"transfer of disk %d/%d failed, see earlier error messages") > > - (id+1) nr_disks; > > + (i+1) nr_disks; > > This works only when the input is based on libvirt, and produce e.g. > "transfer of disk 0/1 failed" when using -i disk, -i ova, and -i vmx.If there's a single disk then nr_disks == 1, and i == 0, so it should print (i+1) == 1 / 1. (I didn't actually test it because it's tricky to test this failure path.) Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
Apparently Analagous Threads
- Re: [PATCH] v2v: -o rhv-upload: Fix error message disk numbering (RHBZ#1615885).
- [PATCH 6/8] v2v: -o rhv-upload: collect disks UUIDs right after copy
- [PATCH 0/8] v2v: various fixed for -o rhv-upload
- Re: [PATCH v5 4/4] v2v: Add -o rhv-upload output mode.
- [PATCH v5 0/4] v2v: Add -o rhv-upload output mode.