From: Prasanna Kumar Kalever <prasanna.kalever@xxxxxxxxxx> Propagate the selected or default level to qemu if it's supported. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1376009 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@xxxxxxxxxx> Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_command.c | 19 +++++++++++++++---- src/qemu/qemu_command.h | 1 + src/qemu/qemu_hotplug.c | 6 +++--- .../qemuargv2xml-disk-drive-network-gluster.args | 7 ++++--- .../qemuxml2argv-disk-drive-network-gluster.args | 12 ++++++------ tests/qemuxml2argvtest.c | 3 ++- 6 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b68da3d..6528cbb 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1340,7 +1340,9 @@ qemuDiskBusNeedsDeviceArg(int bus) static int qemuBuildDriveSourceStr(virDomainDiskDefPtr disk, - virBufferPtr buf) + virQEMUDriverConfigPtr cfg, + virBufferPtr buf, + virQEMUCapsPtr qemuCaps) { int actualType = virStorageSourceGetActualType(disk->src); qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); @@ -1409,6 +1411,12 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk, } virBufferAddLit(buf, ","); + 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); + } + if (secinfo && secinfo->type == VIR_DOMAIN_SECRET_INFO_TYPE_AES) { /* NB: If libvirt starts using the more modern option based * syntax to build the command line (e.g., "-drive driver=rbd, @@ -1443,6 +1451,7 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk, char * qemuBuildDriveStr(virDomainDiskDefPtr disk, + virQEMUDriverConfigPtr cfg, bool bootable, virQEMUCapsPtr qemuCaps) { @@ -1534,7 +1543,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, break; } - if (qemuBuildDriveSourceStr(disk, &opt) < 0) + if (qemuBuildDriveSourceStr(disk, cfg, &opt, qemuCaps) < 0) goto error; if (emitDeviceSyntax) @@ -2183,6 +2192,7 @@ qemuBuildDriveDevStr(const virDomainDef *def, static int qemuBuildDiskDriveCommandLine(virCommandPtr cmd, + virQEMUDriverConfigPtr cfg, const virDomainDef *def, virQEMUCapsPtr qemuCaps) { @@ -2261,8 +2271,9 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd, virCommandAddArg(cmd, "-drive"); - if (!(optstr = qemuBuildDriveStr(disk, driveBoot, qemuCaps))) + if (!(optstr = qemuBuildDriveStr(disk, cfg, driveBoot, qemuCaps))) return -1; + virCommandAddArg(cmd, optstr); VIR_FREE(optstr); @@ -9490,7 +9501,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, if (qemuBuildHubCommandLine(cmd, def, qemuCaps) < 0) goto error; - if (qemuBuildDiskDriveCommandLine(cmd, def, qemuCaps) < 0) + if (qemuBuildDiskDriveCommandLine(cmd, cfg, def, qemuCaps) < 0) goto error; if (qemuBuildFSDevCommandLine(cmd, def, qemuCaps) < 0) diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index a793fb6..63d401a 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -107,6 +107,7 @@ char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk); /* Both legacy & current support */ char *qemuBuildDriveStr(virDomainDiskDefPtr disk, + virQEMUDriverConfigPtr cfg, bool bootable, virQEMUCapsPtr qemuCaps); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f60cf86..1bcbc4d 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -365,7 +365,7 @@ qemuDomainAttachVirtioDiskDevice(virConnectPtr conn, if (encinfo && qemuBuildSecretInfoProps(encinfo, &encobjProps) < 0) goto error; - if (!(drivestr = qemuBuildDriveStr(disk, false, priv->qemuCaps))) + if (!(drivestr = qemuBuildDriveStr(disk, cfg, false, priv->qemuCaps))) goto error; if (!(drivealias = qemuAliasFromDisk(disk))) @@ -655,7 +655,7 @@ qemuDomainAttachSCSIDisk(virConnectPtr conn, if (!(devstr = qemuBuildDriveDevStr(vm->def, disk, 0, priv->qemuCaps))) goto error; - if (!(drivestr = qemuBuildDriveStr(disk, false, priv->qemuCaps))) + if (!(drivestr = qemuBuildDriveStr(disk, cfg, false, priv->qemuCaps))) goto error; if (!(drivealias = qemuAliasFromDisk(disk))) @@ -769,7 +769,7 @@ qemuDomainAttachUSBMassStorageDevice(virQEMUDriverPtr driver, if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0) goto error; - if (!(drivestr = qemuBuildDriveStr(disk, false, priv->qemuCaps))) + if (!(drivestr = qemuBuildDriveStr(disk, cfg, false, priv->qemuCaps))) goto error; if (!(drivealias = qemuAliasFromDisk(disk))) diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-gluster.args b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-gluster.args index f560308..deec7a7 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-gluster.args +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-gluster.args @@ -16,9 +16,10 @@ QEMU_AUDIO_DRV=none \ -no-acpi \ -boot c \ -usb \ --drive file=gluster://example.org:6000/Volume1/Image,format=raw,if=virtio \ --drive 'file=gluster+unix:///Volume2/Image?socket=/path/to/sock,format=raw,\ -if=virtio' \ +-drive file=gluster://example.org:6000/Volume1/Image,file.debug=4,format=raw,\ +if=virtio \ +-drive 'file=gluster+unix:///Volume2/Image?socket=/path/to/sock,file.debug=4,\ +format=raw,if=virtio' \ -net none \ -serial none \ -parallel none diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-gluster.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-gluster.args index 634ed75..cd5294e 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-gluster.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-gluster.args @@ -17,18 +17,18 @@ QEMU_AUDIO_DRV=none \ -no-acpi \ -boot c \ -usb \ --drive file=gluster://example.org:6000/Volume1/Image,format=raw,if=none,\ -id=drive-virtio-disk0 \ +-drive file=gluster://example.org:6000/Volume1/Image,file.debug=4,format=raw,\ +if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,\ id=virtio-disk0 \ --drive 'file=gluster+unix:///Volume2/Image?socket=/path/to/sock,format=raw,\ -if=none,id=drive-virtio-disk1' \ +-drive 'file=gluster+unix:///Volume2/Image?socket=/path/to/sock,file.debug=4,\ +format=raw,if=none,id=drive-virtio-disk1' \ -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,\ id=virtio-disk1 \ -drive file.driver=gluster,file.volume=Volume3,file.path=/Image.qcow2,\ file.server.0.type=tcp,file.server.0.host=example.org,file.server.0.port=6000,\ file.server.1.type=tcp,file.server.1.host=example.org,file.server.1.port=24007,\ -file.server.2.type=unix,file.server.2.socket=/path/to/sock,format=qcow2,\ -if=none,id=drive-virtio-disk2 \ +file.server.2.type=unix,file.server.2.socket=/path/to/sock,file.debug=4,\ +format=qcow2,if=none,id=drive-virtio-disk2 \ -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk2,\ id=virtio-disk2 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 90d6aaf..f0e182d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -858,7 +858,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.10.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list