[Libguestfs] [PATCH virt-v2v 1/2] v2v: -o rhv-upload: Generate disk UUIDs

Richard W.M. Jones rjones at redhat.com
Tue Aug 3 17:48:35 UTC 2021


On Tue, Aug 03, 2021 at 07:56:43PM +0300, Nir Soffer wrote:
> On Tue, Aug 3, 2021 at 6:37 PM Richard W.M. Jones <rjones at redhat.com> wrote:
> >
> > On Tue, Aug 03, 2021 at 06:06:26PM +0300, Nir Soffer wrote:
> > > On Tue, Aug 3, 2021 at 12:26 PM Richard W.M. Jones <rjones at redhat.com> wrote:
> > > > diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py
> > > > index a3d578176..1155cf38d 100644
> > > > --- a/v2v/rhv-upload-plugin.py
> > > > +++ b/v2v/rhv-upload-plugin.py
> > > > @@ -482,8 +482,7 @@ def create_disk(connection):
> > > >
> > > >      disk = disks_service.add(
> > > >          disk=types.Disk(
> > > > -            # The ID is optional.
> > > > -            id=params.get('rhv_disk_uuid'),
> > > > +            id=params.get('disk_uuid'),
> > >
> > > The disk id is not optional now. If it is not specified in params, the
> > > caller has no way
> > > to get the id generated by RHV. So better remove the comment and use:
> > >
> > >     params["disk_id"]
> > >
> > > This will fail early in case there is a bug in the caller code.
> >
> > Not sure I understand.  Isn't that what this hunk does?'
> 
> params.get("disk_uuid") will return None silently, then RHV will create
> a disk with a new random UUID.
> 
> We want to fail loudly with a KeyError in this case.

Ah, I didn't realise there was a difference.  Good point!

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list