Re: [libvirt] [PATCH] qemu: Escape commas for qemuBuildDiskThrottling

2018-06-21 Thread John Ferlan



On 06/19/2018 12:20 PM, Anya Harter wrote:
> Add comma escaping for disk->blkdeviotune.group_name.
> 
> Signed-off-by: Anya Harter 
> ---
>  src/qemu/qemu_command.c |  4 ++--
>  tests/qemuxml2argvdata/name-escape.args |  5 +
>  tests/qemuxml2argvdata/name-escape.xml  | 13 +
>  tests/qemuxml2argvtest.c|  2 ++
>  4 files changed, 22 insertions(+), 2 deletions(-)
> 

Reviewed-by: John Ferlan 

(and pushed)

Tks -

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] qemu: Escape commas for qemuBuildDiskThrottling

2018-06-19 Thread Anya Harter
Add comma escaping for disk->blkdeviotune.group_name.

Signed-off-by: Anya Harter 
---
 src/qemu/qemu_command.c |  4 ++--
 tests/qemuxml2argvdata/name-escape.args |  5 +
 tests/qemuxml2argvdata/name-escape.xml  | 13 +
 tests/qemuxml2argvtest.c|  2 ++
 4 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 20c6ac2a04..e05b106a5e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1554,8 +1554,8 @@ qemuBuildDiskThrottling(virDomainDiskDefPtr disk,
 
 IOTUNE_ADD(size_iops_sec, "iops-size");
 if (disk->blkdeviotune.group_name) {
-virBufferEscapeString(buf, ",throttling.group=%s",
-  disk->blkdeviotune.group_name);
+virBufferAddLit(buf, ",throttling.group=");
+virQEMUBuildBufferEscapeComma(buf, disk->blkdeviotune.group_name);
 }
 
 IOTUNE_ADD(total_bytes_sec_max_length, "bps-total-max-length");
diff --git a/tests/qemuxml2argvdata/name-escape.args 
b/tests/qemuxml2argvdata/name-escape.args
index 72ed2e8410..aef7c238ca 100644
--- a/tests/qemuxml2argvdata/name-escape.args
+++ b/tests/qemuxml2argvdata/name-escape.args
@@ -24,6 +24,11 @@ bar=2/monitor.sock,server,nowait \
 -boot c \
 -device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-ide0-0-0,\
+cache=none,throttling.bps-total=5000,throttling.iops-total=6000,\
+throttling.bps-total-max=1,throttling.iops-total-max=11000,\
+throttling.group=libvirt_iotune_group1,,foo \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
 -device ccid-card-emulated,backend=certificates,cert1=cert1,,foo,cert2=cert2,\
 cert3=cert3,db=/etc/pki/nssdb,,foo,id=smartcard0,bus=ccid0.0 \
 -chardev tty,id=charserial0,path=/dev/ttyS2,,foo \
diff --git a/tests/qemuxml2argvdata/name-escape.xml 
b/tests/qemuxml2argvdata/name-escape.xml
index 0580de1813..70a1ce09d3 100644
--- a/tests/qemuxml2argvdata/name-escape.xml
+++ b/tests/qemuxml2argvdata/name-escape.xml
@@ -14,6 +14,19 @@
   destroy
   
 /usr/bin/qemu-system-i686
+
+  
+  
+  
+  
+5000
+6000
+1
+11000
+libvirt_iotune_group1,foo
+  
+  
+
 
   
 
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a9a493e308..582a9de7bb 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2758,6 +2758,8 @@ mymain(void)
 DO_TEST("name-escape",
 QEMU_CAPS_NAME_DEBUG_THREADS,
 QEMU_CAPS_OBJECT_SECRET,
+QEMU_CAPS_DRIVE_IOTUNE_MAX,
+QEMU_CAPS_DRIVE_IOTUNE_GROUP,
 QEMU_CAPS_VNC,
 QEMU_CAPS_NAME_GUEST,
 QEMU_CAPS_DEVICE_CIRRUS_VGA,
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list