[libvirt] [PATCH] Add support for Vendor and Model in Storage Pool XML

Daniel P. Berrange berrange at redhat.com
Tue Aug 17 17:06:47 UTC 2010


On Mon, Aug 09, 2010 at 02:32:55PM -0500, Patrick Dignan wrote:
> Somehow the git-send-email patch didn't make it to the mailing list, 
> though my reply to it did...I've attached the patch here, hopefully this 
> one doesn't get flattened.
> 
> I decided to allow vendor and product to be set independently of each 
> other in order to allow greater flexibility at the possible expense of 
> namespace clashes.

> From 3a2139c87a1d1c92a8bf947ecc5b431f0f67906c Mon Sep 17 00:00:00 2001
> From: Patrick Dignan <pat_dignan at dell.com>
> Date: Fri, 6 Aug 2010 11:08:03 -0500
> Subject: [PATCH] Add support for vendor/product
> 
> ---
>  docs/schemas/storagepool.rng                       |   52 ++++++++++++++++++++
>  src/conf/storage_conf.c                            |   14 +++++
>  src/conf/storage_conf.h                            |    6 ++
>  .../pool-iscsi-vendor-product.xml                  |   19 +++++++
>  .../pool-iscsi-vendor-product.xml                  |   22 ++++++++
>  tests/storagepoolxml2xmltest.c                     |    1 +
>  6 files changed, 114 insertions(+), 0 deletions(-)
>  create mode 100644 tests/storagepoolxml2xmlin/pool-iscsi-vendor-product.xml
>  create mode 100644 tests/storagepoolxml2xmlout/pool-iscsi-vendor-product.xml
> 
> @@ -838,6 +843,15 @@ virStoragePoolSourceFormat(virBufferPtr buf,
>          virBufferVSprintf(buf,"    <auth type='chap' login='%s' passwd='%s'/>\n",
>                            src->auth.chap.login,
>                            src->auth.chap.passwd);
> +
> +    if (src->vendor != NULL) { 
> +        virBufferVSprintf(buf,"    <vendor name='%s'/>\n", src->vendor);
> +    }
> +     
> +    if (src->product != NULL) {
> +        virBufferVSprintf(buf,"    <product name='%s'/>\n", src->product);
> +    }   
> + 
>      virBufferAddLit(buf,"  </source>\n");

The only change is that these should use virBufferEscapeString
since vendor/product strings might contain <, > or & characters
which would make the XML unhappy


Regards,
Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list