From: "Richard W.M. Jones" <rjones@redhat.com>
To: Gandalf Corvotempesta <gandalf.corvotempesta@gmail.com>
Cc: libguestfs <libguestfs@redhat.com>,
qemu-devel@nongnu.org, Qemu-block <qemu-block@nongnu.org>,
Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [Libguestfs] [qemu-img] support for XVA
Date: Thu, 16 Nov 2017 10:01:03 +0000 [thread overview]
Message-ID: <20171116100102.GE2450@redhat.com> (raw)
In-Reply-To: <CAJH6TXiPuLu62-+o2+PrUGpstrks_5pLotFEe1bAOmsbn20otw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2832 bytes --]
Here's my solution, as a nbdkit plugin written in Perl.
As with Max's solution I don't bother to parse the virtual size out of
the XML file, so you need to specify that on the command line
otherwise the disk will be truncated to the largest extent stored in
the file. Also the ‘.xva’ file must not be compressed.
$ nbdkit perl script=./xva-reader.pl file=./debian8cloud.xva size=4294967296
$ guestfish --ro --format=raw -a nbd://localhost -i
Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.
Type: 'help' for help on commands
'man' to read the manual
'quit' to quit the shell
Operating system: 8.2
/dev/sda1 mounted on /
><fs> ll /
total 100
drwxr-xr-x 22 root root 4096 Jan 8 2016 .
drwxr-xr-x 19 root root 4096 Nov 16 09:50 ..
drwxrwxr-x 2 root root 4096 Jan 8 2016 bin
drwxr-xr-x 3 root root 4096 Jan 8 2016 boot
drwxr-xr-x 4 root root 4096 Jan 8 2016 dev
drwxr-xr-x 87 root root 4096 Jan 8 2016 etc
drwxr-xr-x 3 root root 4096 Jan 8 2016 home
lrwxrwxrwx 1 root root 31 Jan 8 2016 initrd.img -> /boot/initrd.img-3.16.0-4-amd64
drwxr-xr-x 14 root root 4096 Jan 8 2016 lib
drwxr-xr-x 2 root root 4096 Jan 8 2016 lib64
drwx------ 2 root root 16384 Jan 8 2016 lost+found
drwxr-xr-x 3 root root 4096 Jan 8 2016 media
drwxr-xr-x 2 root root 4096 Jan 8 2016 mnt
drwxr-xr-x 2 root root 4096 Jan 8 2016 opt
drwxr-xr-x 2 root root 4096 May 4 2015 proc
drwx------ 2 root root 4096 Jan 8 2016 root
drwxr-xr-x 2 root root 4096 Jan 8 2016 run
drwxr-xr-x 2 root root 4096 Jan 8 2016 sbin
drwxr-xr-x 2 root root 4096 Jan 8 2016 srv
drwxr-xr-x 2 root root 4096 Apr 6 2015 sys
drwxrwxrwt 7 root root 4096 Jan 8 2016 tmp
drwxr-xr-x 10 root root 4096 Jan 8 2016 usr
drwxr-xr-x 11 root root 4096 Jan 8 2016 var
lrwxrwxrwx 1 root root 27 Jan 8 2016 vmlinuz -> boot/vmlinuz-3.16.0-4-amd64
I even managed to boot the Debian 8 guest from the sample .xva file:
$ qemu-system-x86_64 -cpu host -machine accel=kvm:tcg -m 2048 -drive file=nbd:localhost:10809,format=raw,if=virtio,snapshot=on
although it was pretty slow ...
As mentioned before you can use this to do a qemu-img convert using
captive nbdkit:
$ nbdkit -U - \
perl script=./xva-reader.pl file=./debian8cloud.xva size=4294967296 \
--run 'qemu-img convert -f raw $nbd -O qcow2 /var/tmp/output.qcow2 -p'
HTH,
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
http://libguestfs.org/virt-builder.1.html
[-- Attachment #2: xva-reader.pl --]
[-- Type: application/x-perl, Size: 3227 bytes --]
next prev parent reply other threads:[~2017-11-16 10:01 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-15 15:52 [Qemu-devel] [qemu-img] support for XVA Gandalf Corvotempesta
2017-11-15 17:33 ` Eric Blake
2017-11-15 17:44 ` Gandalf Corvotempesta
2017-11-15 19:59 ` Max Reitz
2017-11-15 20:06 ` Gandalf Corvotempesta
2017-11-15 20:07 ` Max Reitz
2017-11-15 20:24 ` [Qemu-devel] [Libguestfs] " Richard W.M. Jones
2017-11-15 20:27 ` Max Reitz
2017-11-15 20:29 ` Richard W.M. Jones
2017-11-15 20:41 ` Gandalf Corvotempesta
2017-11-15 21:05 ` Richard W.M. Jones
2017-11-15 21:15 ` Richard W.M. Jones
2017-11-15 21:30 ` Max Reitz
2017-11-15 21:42 ` Gandalf Corvotempesta
2017-11-15 21:49 ` Richard W.M. Jones
2017-11-15 21:50 ` Gandalf Corvotempesta
2017-11-15 21:50 ` Max Reitz
2017-11-15 22:28 ` Max Reitz
2017-11-15 22:47 ` Gandalf Corvotempesta
2017-11-15 22:55 ` Max Reitz
2017-11-15 22:57 ` Max Reitz
2017-11-16 10:08 ` Gandalf Corvotempesta
2017-11-16 14:02 ` Max Reitz
2017-11-20 21:48 ` Gandalf Corvotempesta
2017-11-15 21:51 ` Richard W.M. Jones
2017-11-16 10:01 ` Richard W.M. Jones [this message]
2017-11-16 10:07 ` Gandalf Corvotempesta
2017-11-16 10:11 ` Richard W.M. Jones
2017-11-16 12:56 ` Tomáš Golembiovský
2017-11-16 13:07 ` Tomáš Golembiovský
2017-11-16 13:08 ` Richard W.M. Jones
2017-11-15 19:43 ` [Qemu-devel] " Richard W.M. Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171116100102.GE2450@redhat.com \
--to=rjones@redhat.com \
--cc=gandalf.corvotempesta@gmail.com \
--cc=libguestfs@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.