Re: [Libguestfs] [PATCH] v2v: -o rhv-upload: Optimize http request sending

Richard W.M. Jones
Mon, 18 Jun 2018 10:37:17 -0000

On Thu, Jun 14, 2018 at 09:24:48PM +0300, Nir Soffer
wrote:
> On Thu, Jun 14, 2018 at 9:16 PM Nir Soffer <nirsof@gmail.com> wrote:
> > +    headers = {"Content-Type":
"application/json",
> > +               "Content-Length", str(len(buf))}

There were a few Python syntax errors such as this one.  They
can be found by running:

  make -C v2v check TESTS=test-v2v-python-syntax.sh

However I have now fixed them.

> Do we have an easy way to test the plugin without running the entire
> virt-v2v pipeline?

Not really.  In fact we don't have any unit tests for -o rhv-upload
functionality because there's no way to simulate the imageio server.

However you can run virt-v2v locally against an oVirt instance without
needing VMware.  The command is rather lengthy, but here it is:

$ virt-builder fedora-27
$ ./run virt-v2v -i disk /var/tmp/fedora-27.img \
    -o rhv-upload \
    -oc https://ovirt-engine.example.com/ovirt-engine/api \
    -os ovirt-data \
    -op /tmp/password \
    -of raw \
    -oo rhv-cafile=/tmp/ca.pem \
    -oo rhv-direct

/tmp/password should contain the oVirt admin password.
/tmp/ca.pem should contain the oVirt CA cert.

This will create a guest called ‘fedora-27’ which you'll need to
delete (on oVirt) afterwards.  You can add ‘-on name’ to name it
something else.

In any case I have fixed and verified this patch and will push it
soon, thanks.

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch