mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
storage_conf: Adjust virStoragePoolAuthType enum
Generate and use the virStoragePoolAuthTypeType{To|From}String helpers
This commit is contained in:
parent
50336d871a
commit
26a8431144
@ -95,6 +95,10 @@ VIR_ENUM_IMPL(virStoragePoolSourceAdapterType,
|
|||||||
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_LAST,
|
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_LAST,
|
||||||
"default", "scsi_host", "fc_host")
|
"default", "scsi_host", "fc_host")
|
||||||
|
|
||||||
|
VIR_ENUM_IMPL(virStoragePoolAuthType,
|
||||||
|
VIR_STORAGE_POOL_AUTH_LAST,
|
||||||
|
"none", "chap", "ceph")
|
||||||
|
|
||||||
typedef const char *(*virStorageVolFormatToString)(int format);
|
typedef const char *(*virStorageVolFormatToString)(int format);
|
||||||
typedef int (*virStorageVolFormatFromString)(const char *format);
|
typedef int (*virStorageVolFormatFromString)(const char *format);
|
||||||
typedef const char *(*virStorageVolFeatureToString)(int feature);
|
typedef const char *(*virStorageVolFeatureToString)(int feature);
|
||||||
@ -676,11 +680,8 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
|
|||||||
if (authType == NULL) {
|
if (authType == NULL) {
|
||||||
source->authType = VIR_STORAGE_POOL_AUTH_NONE;
|
source->authType = VIR_STORAGE_POOL_AUTH_NONE;
|
||||||
} else {
|
} else {
|
||||||
if (STREQ(authType, "chap")) {
|
if ((source->authType =
|
||||||
source->authType = VIR_STORAGE_POOL_AUTH_CHAP;
|
virStoragePoolAuthTypeTypeFromString(authType)) < 0) {
|
||||||
} else if (STREQ(authType, "ceph")) {
|
|
||||||
source->authType = VIR_STORAGE_POOL_AUTH_CEPHX;
|
|
||||||
} else {
|
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown auth type '%s'"),
|
_("unknown auth type '%s'"),
|
||||||
authType);
|
authType);
|
||||||
@ -1117,13 +1118,15 @@ virStoragePoolSourceFormat(virBufferPtr buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (src->authType == VIR_STORAGE_POOL_AUTH_CHAP)
|
if (src->authType == VIR_STORAGE_POOL_AUTH_CHAP)
|
||||||
virBufferAsprintf(buf," <auth type='chap' login='%s' passwd='%s'/>\n",
|
virBufferAsprintf(buf," <auth type='%s' login='%s' passwd='%s'/>\n",
|
||||||
|
virStoragePoolAuthTypeTypeToString(src->authType),
|
||||||
src->auth.chap.login,
|
src->auth.chap.login,
|
||||||
src->auth.chap.passwd);
|
src->auth.chap.passwd);
|
||||||
|
|
||||||
if (src->authType == VIR_STORAGE_POOL_AUTH_CEPHX) {
|
if (src->authType == VIR_STORAGE_POOL_AUTH_CEPHX) {
|
||||||
virBufferAsprintf(buf," <auth username='%s' type='ceph'>\n",
|
virBufferAsprintf(buf," <auth username='%s' type='%s'>\n",
|
||||||
src->auth.cephx.username);
|
src->auth.cephx.username,
|
||||||
|
virStoragePoolAuthTypeTypeToString(src->authType));
|
||||||
|
|
||||||
virBufferAddLit(buf," <secret");
|
virBufferAddLit(buf," <secret");
|
||||||
if (src->auth.cephx.secret.uuidUsable) {
|
if (src->auth.cephx.secret.uuidUsable) {
|
||||||
|
@ -146,7 +146,10 @@ enum virStoragePoolAuthType {
|
|||||||
VIR_STORAGE_POOL_AUTH_NONE,
|
VIR_STORAGE_POOL_AUTH_NONE,
|
||||||
VIR_STORAGE_POOL_AUTH_CHAP,
|
VIR_STORAGE_POOL_AUTH_CHAP,
|
||||||
VIR_STORAGE_POOL_AUTH_CEPHX,
|
VIR_STORAGE_POOL_AUTH_CEPHX,
|
||||||
|
|
||||||
|
VIR_STORAGE_POOL_AUTH_LAST,
|
||||||
};
|
};
|
||||||
|
VIR_ENUM_DECL(virStoragePoolAuthType)
|
||||||
|
|
||||||
typedef struct _virStoragePoolAuthChap virStoragePoolAuthChap;
|
typedef struct _virStoragePoolAuthChap virStoragePoolAuthChap;
|
||||||
typedef virStoragePoolAuthChap *virStoragePoolAuthChapPtr;
|
typedef virStoragePoolAuthChap *virStoragePoolAuthChapPtr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user