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

Nir Soffer
2021-08-03T16:56:43Z

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.