On 04/22/2013 02:43 PM, Ján Tomko wrote:
Assume format type is 'auto' when none is specified on
qemu command line.
---
src/conf/domain_conf.c | 2 +-
src/conf/domain_conf.h | 5 +++++
src/libvirt_private.syms | 1 +
src/qemu/qemu_command.c | 6 ++++++
tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.xml | 2 ++
tests/qemuxml2argvdata/qemuxml2argv-boot-network.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-clock-utc.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-console-compat.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-empty.xml | 2 ++
tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml | 2 ++
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml | 2 ++
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml | 2 ++
.../qemuxml2argv-disk-drive-network-rbd-ceph-env.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.xml | 3 +++
tests/qemuxml2argvdata/qemuxml2argv-disk-many.xml | 4 ++++
tests/qemuxml2argvdata/qemuxml2argv-disk-usb.xml | 2 ++
tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.xml | 4 ++++
tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml | 4 ++++
tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-address.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-machine-core-off.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-machine-core-on.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-migrate.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-misc-disable-s3.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-misc-disable-suspends.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-misc-enable-s4.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-net-eth-ifname.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-net-eth.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-net-user.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-net-virtio.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-qemu-ns-no-env.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-restore-v1.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-restore-v2.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-file.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-many.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-unix.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-smp.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-sound.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-watchdog.xml | 1 +
60 files changed, 86 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index dc0ecaa..8d57256 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2710,7 +2710,7 @@ virDomainDefPostParseDeviceIterator(virDomainDefPtr def
ATTRIBUTE_UNUSED,
}
-static int
+int
virDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index f1f01fa..89515de 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2031,6 +2031,11 @@ virDomainXMLNamespacePtr
virDomainXMLOptionGetNamespace(virDomainXMLOptionPtr xmlopt)
ATTRIBUTE_NONNULL(1);
+int
+virDomainDefPostParse(virDomainDefPtr def,
+ virCapsPtr caps,
+ virDomainXMLOptionPtr xmlopt);
+
static inline bool
virDomainObjIsActive(virDomainObjPtr dom)
{
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index f778e9c..32b4ae8 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -119,6 +119,7 @@ virDomainDefGetSecurityLabelDef;
virDomainDefParseFile;
virDomainDefParseNode;
virDomainDefParseString;
+virDomainDefPostParse;
virDomainDeleteConfig;
virDomainDeviceAddressIsValid;
virDomainDeviceAddressTypeToString;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 05c12b2..37a961d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8102,6 +8102,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
def->bus = VIR_DOMAIN_DISK_BUS_IDE;
def->device = VIR_DOMAIN_DISK_DEVICE_DISK;
def->type = VIR_DOMAIN_DISK_TYPE_FILE;
+ def->format = VIR_STORAGE_FILE_AUTO;
for (i = 0 ; i < nkeywords ; i++) {
if (STREQ(keywords[i], "file")) {
@@ -9349,6 +9350,8 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
if (VIR_ALLOC(disk) < 0)
goto no_memory;
+ disk->format = VIR_STORAGE_FILE_AUTO;
+
if (STRPREFIX(val, "/dev/"))
disk->type = VIR_DOMAIN_DISK_TYPE_BLOCK;
else if (STRPREFIX(val, "nbd:")) {
@@ -9994,6 +9997,9 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
if (virDomainDefAddImplicitControllers(def) < 0)
goto error;
+ if (virDomainDefPostParse(def, qemuCaps, xmlopt) < 0)
+ goto error;
+
if (cmd->num_args || cmd->num_env) {
def->ns = *virDomainXMLOptionGetNamespace(xmlopt);
def->namespaceData = cmd;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml
b/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml
index 6cb941d..775101d 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml
@@ -15,6 +15,7 @@
<devices>
<emulator>/usr/bin/qemu</emulator>
<disk type='block' device='cdrom'>
+ <driver name='qemu'/>
I assume that all of these additional <driver> elements are necessary
due to the argv->xml conversion now adding that in, and that's caused by
the new call to the PostParse callback, right?
If so, ACK, but it would be nice to just mention that in the commit log.