Teach qemu driver to detect whether qemu supports this configuration factor or not. Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@xxxxxxxxxx> --- src/qemu/qemu_capabilities.c | 5 +++++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 6 ++++-- tests/qemuxml2argvtest.c | 3 ++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index c71b4dc..721e1ce 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -344,6 +344,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "query-hotpluggable-cpus", "virtio-net.rx_queue_size", /* 235 */ + "gluster.debug_level", ); @@ -2496,6 +2497,10 @@ virQEMUCapsProbeQMPCommands(virQEMUCapsPtr qemuCaps, qemuMonitorSupportsActiveCommit(mon)) virQEMUCapsSet(qemuCaps, QEMU_CAPS_ACTIVE_COMMIT); + /* Since qemu 2.7.0 */ + if (qemuCaps->version >= 2007000) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_GLUSTER_DEBUG_LEVEL); + return 0; } diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 26ac1fa..ce0fd95 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -378,6 +378,7 @@ typedef enum { /* 235 */ QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE, /* virtio-net-*.rx_queue_size */ + QEMU_CAPS_GLUSTER_DEBUG_LEVEL, /* -drive gluster.debug_level={0..9} */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 3ce609d..5204e4a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1315,7 +1315,8 @@ qemuDiskBusNeedsDeviceArg(int bus) static int qemuBuildDriveSourceStr(virDomainDiskDefPtr disk, virQEMUDriverConfigPtr cfg, - virBufferPtr buf) + virBufferPtr buf, + virQEMUCapsPtr qemuCaps) { int actualType = virStorageSourceGetActualType(disk->src); qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); @@ -1386,6 +1387,7 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk, if (disk->src && disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_GLUSTER) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_GLUSTER_DEBUG_LEVEL)) virBufferAsprintf(buf, "file.debug=%d,", cfg->glusterDebugLevel); } @@ -1515,7 +1517,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, break; } - if (qemuBuildDriveSourceStr(disk, cfg, &opt) < 0) + if (qemuBuildDriveSourceStr(disk, cfg, &opt, qemuCaps) < 0) goto error; if (emitDeviceSyntax) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index dbb0e4d..b29a63b 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -832,7 +832,8 @@ mymain(void) DO_TEST("disk-drive-network-iscsi-lun", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_BLOCK); - DO_TEST("disk-drive-network-gluster", NONE); + DO_TEST("disk-drive-network-gluster", + QEMU_CAPS_GLUSTER_DEBUG_LEVEL); DO_TEST("disk-drive-network-rbd", NONE); DO_TEST("disk-drive-network-sheepdog", NONE); DO_TEST("disk-drive-network-rbd-auth", NONE); -- 2.7.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list