<dd>
Specifies what this secret is used for. A mandatory
<code>type</code> attribute specifies the usage category, currently
- only <code>volume</code> is defined. Specific usage categories are
- described below.
+ only <code>volume</code> and <code>ceph</code> are defined.
+ Specific usage categories are described below.
</dd>
</dl>
this secret is associated with.
</p>
+ <h3>Usage type "ceph"</h3>
+
+ <p>
+ This secret is associated with a Ceph RBD (rados block device).
+ The <code><usage type='ceph'></code> element must contain
+ a single <code>name</code> element that specifies a usage name
+ for the secret. The Ceph 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 0.9.7</span>.
+ </p>
+
<h2><a name="example">Example</a></h2>
<pre>
<element name='usage'>
<choice>
<ref name='usagevolume'/>
+ <ref name='usageceph'/>
<!-- More choices later -->
</choice>
</element>
</element>
</define>
+ <define name='usageceph'>
+ <attribute name='type'>
+ <value>ceph</value>
+ </attribute>
+ <element name='name'>
+ <text/>
+ </element>
+ </define>
+
<define name="UUID">
<choice>
<data type="string">
typedef enum {
VIR_SECRET_USAGE_TYPE_NONE = 0,
VIR_SECRET_USAGE_TYPE_VOLUME = 1,
- /* Expect more owner types later... */
+ VIR_SECRET_USAGE_TYPE_CEPH = 2,
+
+ /*
+ * NB: this enum value will increase over time as new events are
+ * added to the libvirt API. It reflects the last secret owner ID
+ * supported by this version of the libvirt API.
+ */
+ VIR_SECRET_USAGE_TYPE_LAST
} virSecretUsageType;
virConnectPtr virSecretGetConnect (virSecretPtr secret);
#define VIR_FROM_THIS VIR_FROM_SECRET
-VIR_ENUM_IMPL(virSecretUsageType, VIR_SECRET_USAGE_TYPE_VOLUME + 1, "none", "volume")
+VIR_ENUM_IMPL(virSecretUsageType, VIR_SECRET_USAGE_TYPE_LAST,
+ "none", "volume", "ceph")
void
virSecretDefFree(virSecretDefPtr def)
VIR_FREE(def->usage.volume);
break;
+ case VIR_SECRET_USAGE_TYPE_CEPH:
+ VIR_FREE(def->usage.ceph);
+
default:
VIR_ERROR(_("unexpected secret usage type %d"), def->usage_type);
break;
}
break;
+ case VIR_SECRET_USAGE_TYPE_CEPH:
+ def->usage.ceph = virXPathString("string(./usage/name)", ctxt);
+ if (!def->usage.ceph) {
+ virSecretReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Ceph usage specified, but name is missing"));
+ return -1;
+ }
+ break;
+
default:
virSecretReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected secret usage type %d"),
def->usage.volume);
break;
+ case VIR_SECRET_USAGE_TYPE_CEPH:
+ if (def->usage.ceph != NULL) {
+ virBufferEscapeString(buf, " <name>%s</name>\n",
+ def->usage.ceph);
+ }
+ break;
+
default:
virSecretReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected secret usage type %d"),
int usage_type;
union {
char *volume; /* May be NULL */
+ char *ceph;
} usage;
};
if (STREQ(s->def->usage.volume, usageID))
return s;
break;
+
+ case VIR_SECRET_USAGE_TYPE_CEPH:
+ if (STREQ(s->def->usage.ceph, usageID))
+ return s;
+ break;
}
}
return NULL;
case VIR_SECRET_USAGE_TYPE_VOLUME:
return def->usage.volume;
+ case VIR_SECRET_USAGE_TYPE_CEPH:
+ return def->usage.ceph;
+
default:
return NULL;
}