[libvirt] [PATCH v2 4/6] secret: add iscsi to possible usage types

Osier Yang jyang at redhat.com
Thu Mar 21 14:26:44 UTC 2013


On 2013年03月21日 19:53, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini<pbonzini at redhat.com>
> ---
>   docs/formatsecret.html.in    | 12 ++++++++++++
>   docs/schemas/secret.rng      | 10 ++++++++++
>   include/libvirt/libvirt.h.in |  1 +
>   src/conf/secret_conf.c       | 22 +++++++++++++++++++++-
>   src/conf/secret_conf.h       |  1 +
>   src/secret/secret_driver.c   |  8 ++++++++
>   6 files changed, 53 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/formatsecret.html.in b/docs/formatsecret.html.in
> index 01aff2d..c3c4a25 100644
> --- a/docs/formatsecret.html.in
> +++ b/docs/formatsecret.html.in
> @@ -66,6 +66,18 @@
>         device</a>.<span class="since">Since 0.9.7</span>.
>       </p>
> 
> +<h3>Usage type "iscsi"</h3>
> +
> +<p>
> +      This secret is associated with an iSCSI target for CHAP authentication.
> +      The<code><usage type='iscsi'></code>  element must contain
> +      a single<code>target</code>  element that specifies a usage name
> +      for the secret.  The iSCSI secret can then be used by UUID or by
> +      this usage name via the<code><auth></code>  element of
> +      a<a href="domain.html#elementsDisks">disk
> +      device</a>.<span class="since">Since 1.0.4</span>.
> +</p>
> +
>       <h2><a name="example">Example</a></h2>
> 
>       <pre>
> diff --git a/docs/schemas/secret.rng b/docs/schemas/secret.rng
> index e49bd5a..d7b8f83 100644
> --- a/docs/schemas/secret.rng
> +++ b/docs/schemas/secret.rng
> @@ -41,6 +41,7 @@
>               <choice>
>                 <ref name='usagevolume'/>
>                 <ref name='usageceph'/>
> +<ref name='usageiscsi'/>
>                 <!-- More choices later -->
>               </choice>
>             </element>
> @@ -67,4 +68,13 @@
>       </element>
>     </define>
> 
> +<define name='usageiscsi'>
> +<attribute name='type'>
> +<value>iscsi</value>
> +</attribute>
> +<element name='target'>
> +<ref name='genericName'/>
> +</element>
> +</define>
> +
>   </grammar>
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index f6a7aff..45b5638 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -3649,6 +3649,7 @@ typedef enum {
>       VIR_SECRET_USAGE_TYPE_NONE = 0,
>       VIR_SECRET_USAGE_TYPE_VOLUME = 1,
>       VIR_SECRET_USAGE_TYPE_CEPH = 2,
> +    VIR_SECRET_USAGE_TYPE_ISCSI = 3,
> 
>   #ifdef VIR_ENUM_SENTINELS
>       VIR_SECRET_USAGE_TYPE_LAST
> diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c
> index 891af65..06b9bb2 100644
> --- a/src/conf/secret_conf.c
> +++ b/src/conf/secret_conf.c
> @@ -36,7 +36,7 @@
>   #define VIR_FROM_THIS VIR_FROM_SECRET
> 
>   VIR_ENUM_IMPL(virSecretUsageType, VIR_SECRET_USAGE_TYPE_LAST,
> -              "none", "volume", "ceph")
> +              "none", "volume", "ceph", "iscsi")
> 
>   void
>   virSecretDefFree(virSecretDefPtr def)
> @@ -57,6 +57,10 @@ virSecretDefFree(virSecretDefPtr def)
>           VIR_FREE(def->usage.ceph);
>           break;
> 
> +    case VIR_SECRET_USAGE_TYPE_ISCSI:
> +        VIR_FREE(def->usage.target);
> +        break;
> +
>       default:
>           VIR_ERROR(_("unexpected secret usage type %d"), def->usage_type);
>           break;
> @@ -108,6 +112,15 @@ virSecretDefParseUsage(xmlXPathContextPtr ctxt,
>           }
>           break;
> 
> +    case VIR_SECRET_USAGE_TYPE_ISCSI:
> +        def->usage.target = virXPathString("string(./usage/target)", ctxt);
> +        if (!def->usage.target) {
> +            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                           _("Ceph usage specified, but target is missing"));

s/Ceph/iSCSI/,

ACK with this fixed.




More information about the libvir-list mailing list