From cc6d43bb49815feada35a99f07f8ae6160847f3e Mon Sep 17 00:00:00 2001 From: Nikolay Shirokovskiy Date: Tue, 28 Mar 2017 11:10:53 +0300 Subject: [PATCH] qemu: command: align disk serial check to schema Disk serial schema has extra '.+' allowed characters in comparison with check in code. Looks like there is no reason for that as qemu allows any character AFAIK for serial. This discrepancy is originated in commit id '85d15b51' where the ability to add serial was added. Alter the disk-serial test to add a disk with all the possible characters listed as the serial value. --- src/qemu/qemu_command.c | 2 +- tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args | 3 +++ tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index da6ddff6cb..768b184794 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -475,7 +475,7 @@ qemuBuildIoEventFdStr(virBufferPtr buf, } #define QEMU_SERIAL_PARAM_ACCEPTED_CHARS \ - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ " + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ .+" static int qemuSafeSerialParamValue(const char *value) diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args index 6f512352be..a44af97fb7 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args @@ -22,4 +22,7 @@ server,nowait \ -drive 'file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-1,\ serial=\ \ WD-WMAP9A966149' \ -device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \ +-drive 'file=/dev/HostVG/AllSerialChars,format=raw,if=none,id=drive-ide0-0-2,\ +serial=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_\ .+' \ +-device ide-drive,bus=ide.0,unit=2,drive=drive-ide0-0-2,id=ide0-0-2 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml index 9c21443921..ccd78204bf 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml @@ -20,6 +20,12 @@ WD-WMAP9A966149
+ + + + abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ .+ +
+