[libvirt] [PATCH v3] schema: Allow space character in disk vendor/product

Daniel P. Berrange berrange at redhat.com
Tue Apr 26 14:36:03 UTC 2016


On Tue, Apr 26, 2016 at 10:30:41AM -0400, Cole Robinson wrote:
> The hex range already tried to allow for it, but it wasn't using
> the correct XML hex syntax. Fix it, and test it
> ---
> v3: use proper XML hex syntax (thanks danpb)
> 
>  docs/schemas/domaincommon.rng                                  | 6 ++++--
>  tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-disk-vpd.args    | 4 ++--
>  tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-disk-vpd.xml     | 4 ++--
>  tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-disk-vpd.xml | 4 ++--
>  4 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index 3605afe..66f4167 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -1165,14 +1165,16 @@
>        <optional>
>          <element name="vendor">
>            <data type="string">
> -            <param name="pattern">[x20-x7E]{0,8}</param>
> +            <!-- All printable characters -->
> +            <param name="pattern">[&#x20;-&#x7E;]{0,8}</param>
>            </data>
>          </element>
>        </optional>
>        <optional>
>          <element name="product">
>            <data type="string">
> -            <param name="pattern">[x20-x7E]{0,16}</param>
> +            <!-- All printable characters -->
> +            <param name="pattern">[&#x20;-&#x7E;]{0,16}</param>
>            </data>
>          </element>
>        </optional>
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-disk-vpd.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-disk-vpd.args
> index df118e3..1831ebd 100644
> --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-disk-vpd.args
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-disk-vpd.args
> @@ -24,6 +24,6 @@ QEMU_AUDIO_DRV=none \
>  -device scsi-cd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,\
>  id=scsi0-0-0-0,vendor=SEAGATE,product=ST3146707LC \
>  -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-scsi1-0-0 \
> --device scsi-hd,bus=scsi1.0,scsi-id=0,drive=drive-scsi1-0-0,id=scsi1-0-0,\
> -vendor=SEAGATE,product=ST3567807GD \
> +-device 'scsi-hd,bus=scsi1.0,scsi-id=0,drive=drive-scsi1-0-0,id=scsi1-0-0,\
> +vendor=SEA GATE,product=ST67 807GD' \
>  -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5

/me wonders if we correctly escape any ',' that exists in the product/vndor
name strings. Probably something to add another test for.

> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-disk-vpd.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-disk-vpd.xml
> index 13004c1..b32b746 100644
> --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-disk-vpd.xml
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-disk-vpd.xml
> @@ -26,8 +26,8 @@
>        <source dev='/dev/HostVG/QEMUGuest2'/>
>        <target dev='sdb' bus='scsi'/>
>        <readonly/>
> -      <vendor>SEAGATE</vendor>
> -      <product>ST3567807GD</product>
> +      <vendor>SEA GATE</vendor>
> +      <product>ST67 807GD</product>
>        <address type='drive' controller='1' bus='0' target='0' unit='0'/>
>      </disk>
>      <controller type='usb' index='0'/>
> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-disk-vpd.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-disk-vpd.xml
> index 42c7bcd..9e1e7af 100644
> --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-disk-vpd.xml
> +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-disk-vpd.xml
> @@ -26,8 +26,8 @@
>        <source dev='/dev/HostVG/QEMUGuest2'/>
>        <target dev='sdb' bus='scsi'/>
>        <readonly/>
> -      <vendor>SEAGATE</vendor>
> -      <product>ST3567807GD</product>
> +      <vendor>SEA GATE</vendor>
> +      <product>ST67 807GD</product>
>        <address type='drive' controller='1' bus='0' target='0' unit='0'/>
>      </disk>
>      <controller type='usb' index='0'>

ACK to this patch regardless

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list