mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-05 05:45:46 +00:00
virStorageSourcePoolDef: Turn 'mode' member into proper enum type
Use proper enum type and refactor the formatter accordingly. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3822424459
commit
31274a1eda
@ -7011,7 +7011,6 @@ virDomainDiskSourcePoolDefParse(xmlNodePtr node,
|
|||||||
{
|
{
|
||||||
virStorageSourcePoolDef *source;
|
virStorageSourcePoolDef *source;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
g_autofree char *mode = NULL;
|
|
||||||
|
|
||||||
*srcpool = NULL;
|
*srcpool = NULL;
|
||||||
|
|
||||||
@ -7019,7 +7018,6 @@ virDomainDiskSourcePoolDefParse(xmlNodePtr node,
|
|||||||
|
|
||||||
source->pool = virXMLPropString(node, "pool");
|
source->pool = virXMLPropString(node, "pool");
|
||||||
source->volume = virXMLPropString(node, "volume");
|
source->volume = virXMLPropString(node, "volume");
|
||||||
mode = virXMLPropString(node, "mode");
|
|
||||||
|
|
||||||
/* CD-ROM and Floppy allows no source */
|
/* CD-ROM and Floppy allows no source */
|
||||||
if (!source->pool && !source->volume) {
|
if (!source->pool && !source->volume) {
|
||||||
@ -7033,13 +7031,11 @@ virDomainDiskSourcePoolDefParse(xmlNodePtr node,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode &&
|
if (virXMLPropEnum(node, "mode",
|
||||||
(source->mode = virStorageSourcePoolModeTypeFromString(mode)) <= 0) {
|
virStorageSourcePoolModeTypeFromString,
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
VIR_XML_PROP_NONZERO,
|
||||||
_("unknown source mode '%1$s' for volume type disk"),
|
&source->mode) < 0)
|
||||||
mode);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
*srcpool = g_steal_pointer(&source);
|
*srcpool = g_steal_pointer(&source);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -201,7 +201,7 @@ struct _virStorageSourcePoolDef {
|
|||||||
int voltype; /* virStorageVolType, internal only */
|
int voltype; /* virStorageVolType, internal only */
|
||||||
int pooltype; /* virStoragePoolType from storage_conf.h, internal only */
|
int pooltype; /* virStoragePoolType from storage_conf.h, internal only */
|
||||||
virStorageType actualtype; /* internal only */
|
virStorageType actualtype; /* internal only */
|
||||||
int mode; /* virStorageSourcePoolMode, currently makes sense only for iscsi pool */
|
virStorageSourcePoolMode mode; /* currently makes sense only for iscsi pool */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user