Re: [Libguestfs] failure to virt-sysprep (FC27?)

2017-12-14 Thread Emmanuel Kasper
> What's happening [in the Perl test case, not necessarily in Yaniv's
> case] is that libguestfs is opening the VMDK file for write, and at
> the same time ‘qemu-img info’ is opening the VMDK file for read.

You're right about this, so I am thinking of using list_devices() and
blockdev_getsize64() to get the disk size from the appliance.






___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] failure to virt-sysprep (FC27?)

2017-12-12 Thread Emmanuel Kasper
On 12/12/2017 01:13 PM, Richard W.M. Jones wrote:
> On Thu, Nov 23, 2017 at 02:05:32PM +, Richard W.M. Jones wrote:
>> On Thu, Nov 23, 2017 at 03:00:45PM +0200, Yaniv Kaul wrote:
>>> On Thu, Nov 23, 2017 at 10:57 AM, Richard W.M. Jones 
>>> wrote:
>>>
 On Tue, Nov 21, 2017 at 11:43:54PM +0200, Yaniv Kaul wrote:
> Since I upgrading to FC27, I *sometimes* fail to virt-sysprep.
> The debug messages:
> libguestfs: trace: set_verbose true
> libguestfs: trace: set_verbose = 0
> libguestfs: create: flags = 0, handle = 0x7f465dd0, program = python2
> libguestfs: trace: set_program "lago"
> libguestfs: trace: set_program = 0
> libguestfs: trace: add_drive_ro
> "/home/ykaul/ovirt-system-tests/deployment-basic-suite-
 master/default/images/lago-basic-suite-master-host-0_root.qcow2"
> libguestfs: trace: add_drive
> "/home/ykaul/ovirt-system-tests/deployment-basic-suite-
 master/default/images/lago-basic-suite-master-host-0_root.qcow2"
> "readonly:true"
> libguestfs: creating COW overlay to protect original drive content
> libguestfs: trace: disk_format
> "/home/ykaul/ovirt-system-tests/deployment-basic-suite-
 master/default/images/lago-basic-suite-master-host-0_root.qcow2"
> libguestfs: command: run: qemu-img
> libguestfs: command: run: \ info
> libguestfs: command: run: \ --output json
> libguestfs: command: run: \ /dev/fd/7
> qemu-img: Could not open '/dev/fd/7': Failed to get shared "write" lock
> Is another process using the image?
>>
>> Looking at this a bit closer, I think this may be a bug in qemu.
>>
>> /dev/fd/7 is supposed to be the file descriptor of the image which we
>> have opened in libguestfs, see this code:
>>
>>   
>> https://github.com/libguestfs/libguestfs/blob/06df910491c49360c0292c7153ba5e5cd09a4735/lib/info.c#L174-L191
>>
>> I wonder if qemu gets confused by this and thinks that the image is
>> open in two places?
>>
>> I can't reproduce this here however.  Having a nice short reproducer
>> might help.
> 
> This bug has now been reported by a Debian user:
> 
>   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=884110

Hi Rich

Have you tried the reproducer from the bug report ?
Using a Debian Testing system with  qemu-img 2.10.1 and libguestfs
1.36.11-1 packages I can reproduce it 100 %.





___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] Using libguestfs to sandbox VM builds

2017-09-28 Thread Emmanuel Kasper
Hi
Debian has a couple of tools like fai-diskimage and vmdebootstrap, to
build VM images, but they require being root, as these loopmounts
partitions on which deboostrap is executed. Maybe installing grub2 needs
access to block devices too.

I was thinking of using libguestfs to sandbox those processes, by
passing a build VM as a disk image and my build directory as a 9pfs
mount to the appliance, and calling the build command via $g->shell().

Any pitfalls I should be aware while doing this ?

Emmanuel

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] virt-v2v and import of Debian OVAs

2017-02-23 Thread Emmanuel Kasper
On 02/23/2017 05:06 PM, Pino Toscano wrote:
> On Thursday, 23 February 2017 16:47:57 CET Emmanuel Kasper wrote:
>> Is virt-v2v able to import a debian guest from an OVA archive ?
>>
>> According to the "true" in convert_linux.ml, I would have said yes
>>
>>   let matching = function
>> | { i_type = "linux";
>> i_distro = ("fedora"
>>| "rhel" | "centos" | "scientificlinux" |
>> "redhat-based"
>>| "oraclelinux"
>>| "sles" | "suse-based" | "opensuse") } -> true
>> | { i_type = "linux";
>> i_distro = ("debian" | "ubuntu" | "linuxmint") } -> true
>> | _ -> false
> 
> This is current master.

you're right sorry for the confusion

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] virt-v2v and import of Debian OVAs

2017-02-23 Thread Emmanuel Kasper
Hi
Is virt-v2v able to import a debian guest from an OVA archive ?

According to the "true" in convert_linux.ml, I would have said yes

  let matching = function
| { i_type = "linux";
i_distro = ("fedora"
   | "rhel" | "centos" | "scientificlinux" |
"redhat-based"
   | "oraclelinux"
   | "sles" | "suse-based" | "opensuse") } -> true
| { i_type = "linux";
i_distro = ("debian" | "ubuntu" | "linuxmint") } -> true
| _ -> false

But an OVA import fails with:

virt-v2v  --machine-readable -i ova
turnkey-wordpress-14.1-jessie-amd64.ova -o qemu -of qcow2 -os v2v/
[   0.0] Opening the source -i ova turnkey-wordpress-14.1-jessie-amd64.ova
[   1.2] Creating an overlay to protect the source from being modified
[   1.2] Initializing the target -o qemu -os v2v/
[   1.2] Opening the overlay
[   3.5] Inspecting the overlay
[   4.8] Checking for sufficient free disk space in the guest
[   4.8] Estimating space required on target for each disk
[   4.8] Converting 8.4 to run on KVM
virt-v2v: error: virt-v2v is unable to convert this guest type
(linux/debian)


Using:
virt-v2v --version
virt-v2v 1.34.3

I am using an OVA from the following location

https://www.turnkeylinux.org/download?file=turnkey-wordpress-14.1-jessie-amd64.ova

Am I missing something ?

Emmanuel

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] import-to-ovirt.pl minor problem

2016-12-24 Thread Emmanuel Kasper
Hi Richard

I've noticed this snippet in import-to-ovirt.pl

 my $minor_version = $g->inspect_get_major_version ($root);

I guess you meant here

my $minor_version = $g->inspect_get_minor_version ($root);

Emmanuel


___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] libguestfs and exporting to OVA/OVF

2016-12-07 Thread Emmanuel Kasper
Am 22. Oktober 2016 00:03:30 MESZ, schrieb Emmanuel Kasper <emman...@libera.cc>:
>Le 21/10/2016 à 16:08, Richard W.M. Jones a écrit :
>> On Thu, Oct 20, 2016 at 10:43:26PM +0200, Emmanuel Kasper wrote:
>>> Hi
>>> I've been looking for a standalone tool to create OVA/OVF VM files
>based
>>> on a disk image and found none. So I was thinking to write my own.
>>> Would you be interested in having such a tool in the libguestfs
>umbrella ?
>> 
>> There is this:
>> 
>>   http://git.annexia.org/?p=import-to-ovirt.git
>> 
>> which can generate OVF, and with not very much extra work could
>> generate OVAs.
>> 
>> The problem is that OVF is not a reliable standard.  Sure, there is a
>> standards organization behind it, but there is in practice no
>interop.
>> You have to know the target hypervisor in order to be able to create
>> OVF which will work, and the OVF is quite different for each target.
>
>
>Thanks for the hint for import-to-ovirt, the code is easy to read and
>follow, and is close to what I want to achieve.
>
>A good part of the script is ovirt specific but I am going to reuse the
>part where you generate the OVF file.
>
>I'll send you a link when I have something to show.
>
>___
>Libguestfs mailing list
>Libguestfs@redhat.com
>https://www.redhat.com/mailman/listinfo/libguestfs

So I adapted on my spare time import-to-ovirt and I have now my  import2vbox.
I had to adapt the generated ovf and disable the rh(e)v specific stuff but 
nothing extraordinary complicated.
Code is here:

https://github.com/EmmanuelKasper/import2vbox

Thanks for the initial pointer to import-to-ovirt

Emmanuel


-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

Re: [Libguestfs] libguestfs and exporting to OVA/OVF

2016-10-22 Thread Emmanuel Kasper
Le 21/10/2016 à 16:08, Richard W.M. Jones a écrit :
> On Thu, Oct 20, 2016 at 10:43:26PM +0200, Emmanuel Kasper wrote:
>> Hi
>> I've been looking for a standalone tool to create OVA/OVF VM files based
>> on a disk image and found none. So I was thinking to write my own.
>> Would you be interested in having such a tool in the libguestfs umbrella ?
> 
> There is this:
> 
>   http://git.annexia.org/?p=import-to-ovirt.git
> 
> which can generate OVF, and with not very much extra work could
> generate OVAs.
> 
> The problem is that OVF is not a reliable standard.  Sure, there is a
> standards organization behind it, but there is in practice no interop.
> You have to know the target hypervisor in order to be able to create
> OVF which will work, and the OVF is quite different for each target.


Thanks for the hint for import-to-ovirt, the code is easy to read and
follow, and is close to what I want to achieve.

A good part of the script is ovirt specific but I am going to reuse the
part where you generate the OVF file.

I'll send you a link when I have something to show.

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] libguestfs and exporting to OVA/OVF

2016-10-21 Thread Emmanuel Kasper
Hi
I've been looking for a standalone tool to create OVA/OVF VM files based
on a disk image and found none. So I was thinking to write my own.
Would you be interested in having such a tool in the libguestfs umbrella ?

My aim is too have a free toolchain to build VirtualBox images for
Debian (for Vagrant to be more exact, see
https://wiki.debian.org/Teams/Cloud/VagrantBaseBoxes)

Interface for such a tool would be something like

disk2ova --memory 2G --controller sata --network E1000
myDiskImage.{raw,qcow2}

based on the command line switches, a XML ovf would be created and
packed with the disk image in a OVA file.

There is some python code around which does that, for example the ganeti
export code and imagefactory

https://github.com/redhat-imaging/imagefactory/blob/master/imagefactory_plugins/ovfcommon/ovfcommon.py#L69

but nothing available as a standalone tool.

I am afraid I can only contribute Perl code.

Emmanuel




___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs