If do_part_get_parttype returns NULL, then return from the function
instead of dereferencing the NULL pointer and crashing. Note that
do_part_get_parttype has already called reply_with_error in this case.
This fixes commit 0316d24770.
Found by: Lingfei Kong
Old virt-v2v rebuilt the initrd late. Currently we rebuild the initrd
right after choosing a kernel, but it's best to update the initrd
at the end since mkinitrd may depend on other configuration files
that we are changing (especially see next commit).
The old virt-v2v code had:
my $prefix;
if ($virtio) {
$prefix = 'vd';
} elsif ($libata) {
$prefix = 'sd';
} else {
$prefix = 'hd'
}
The translated code dropped the test for virtio by accident, which
meant that device names would be mapped to sd* or hd* even if the
virtio-blk driver was enabled for the guest.
Thanks: Tingting Zheng
For Xen guests, a device can be presented twice as (eg) xvda and sda,
and therefore we should map any otherwise unmapped xvdX.
For non-Xen guests, this should have no effect.
I made a mistake while translating the Perl conversion code and
transcribed --set-default as --set-kernel. grubby has no --set-kernel
option so it failed.
Thanks: Tingting Zheng
Previously only "running" domains were blocked from conversion.
However "blocked" is essentially the same as running (on Xen it just
means the domain is running but waiting on an I/O resource). And
"paused" domains probably shouldn't be converted either since their
disks are only crash-consistent.
Don't rely on libvirt's implicit print-to-stderr. Instead make sure
that libvirt error messages are raised in the exception message.
Also allow error strings to be translated.
When you call close on any block device, udev kicks off a rule which
runs blkid to reexamine the device. We need to wait for this rule to
finish running since it holds the device open and can cause other
operations to fail, notably mkfs.
(cherry picked from commit a9c8123c72)
Estimate the amount of space required on the target by each source
disk after conversion. The estimate is approximately a ceiling on
this, and actual use should be considerably lower.
Provide an extra output method (#check_target_free_space) which output
modules may use to check that there is sufficient free space to
proceed, before conversion starts. None of the output modules
actually implement this at the moment.
In most C tools, virt-sysprep and virt-customize, you have to put the
--format parameter before the corresponding -a parameter. ie. The
following is correct:
guestfish --format qcow2 -a disk1 -a disk2
But the following is incorrect. The --format parameter is dangling
and prior to this commit would have been silently ignored:
guestfish -a disk1 -a disk2 --format qcow2
After this change, dangling --format parameters now lead to an error:
guestfish: --format parameter must appear before -a parameter
In virt-customize, also check that --attach-format parameter appears
before --attach parameter.
Thanks: Lingfei Kong
If there is an authentication error when getting the session cookie,
emphasize in the error message that the username can be specified in
the URI.
Unfortunately libvirt asks for the username previously, but we cannot
access that.
In theory this discards the output. Unfortunately in practice we have
to write the output to a temporary file and delete it (because of
limitations in qemu-img convert).
You will see an error like this:
$ virt-sysprep --remove-user-accounts foo,bar -a /dev/null
virt-sysprep: error: user-accounts: --remove-user-accounts parameter was
used, but the "user-account" operation is not enabled
The --user-accounts option, with its double-negative '-' prefix on
user names, is confusing. Replace it with '--remove-user-accounts'
and '--keep-user-accounts' options.
This updates commit 128d474095.
-o rhev: This is "traditional" output to a RHEV-M Export Storage Domain.
It requires no cooperation from RHEV itself, and in all other respects
works the same way as old virt-v2v did.
-o vdsm: This is the new mode which requires VDSM cooperation. VDSM
manages the conversion, creating the directories, suggesting UUIDs,
and cleaning up on failure. This allows direct import into a Data
Domain.
The --rhev* command arguments now only apply to -o vdsm, and therefore
have been renamed to --vdsm*
The --vmtype command line argument may be used with -o rhev or -o vdsm.