]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemuMigrationDriveMirror: Force raw format for NBD
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 15 Jun 2015 22:42:05 +0000 (01:42 +0300)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 18 Jun 2015 14:46:09 +0000 (16:46 +0200)
commitcb7297c150639e9f70e414f3a82d1cde9fa3d9d6
tree715307dc252d22fc9044f03a52b588029ecba53d
parent9c5efd1afd49a57c4d17fc9245995fc4e1e6f653
qemuMigrationDriveMirror: Force raw format for NBD

When playing with disk migration lately, I've noticed this warning in
domain logs:

WARNING: Image format was not specified for 'nbd://masina:49153/drive-virtio-disk0' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.

So I started digging into qemu source code to see what has triggered
the warning. I'd expect qemu to know formats of guest's disks since we
tell them on command line. This lead me to qmp_drive_mirror() where
the following can be found:

    if (!has_format) {
        format = mode == NEW_IMAGE_MODE_EXISTING ? NULL : bs->drv->format_name;
    }

So, format is automatically initialized from the disk iff mode !=
"existing". Unfortunately, in migration we are tied to use this mode
(NBD doesn't support creating new images). Therefore the only way to
avoid this warning is to pass format. The discussion on the mail-list [1]
resulted in the code that always forces NBD export as "raw" format.

[1] https://www.redhat.com/archives/libvir-list/2015-June/msg00153.html
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Pavel Boldin <pboldin@mirantis.com>
src/qemu/qemu_migration.c