conf: Use virTristateXXX in virStoragePoolSourceDevice

Note that the comment for virStoragePoolSourceDevice::part_separator was wrong.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Tim Wiederhake 2021-04-07 13:48:40 +02:00 committed by Peter Krempa
parent 62f06ffe8a
commit 975e2cb39d
2 changed files with 5 additions and 4 deletions

View File

@ -614,14 +614,15 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
partsep = virXMLPropString(nodeset[i], "part_separator"); partsep = virXMLPropString(nodeset[i], "part_separator");
if (partsep) { if (partsep) {
dev.part_separator = virTristateBoolTypeFromString(partsep); int value = virTristateBoolTypeFromString(partsep);
if (dev.part_separator <= 0) { if (value <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("invalid part_separator setting '%s'"), _("invalid part_separator setting '%s'"),
partsep); partsep);
virStoragePoolSourceDeviceClear(&dev); virStoragePoolSourceDeviceClear(&dev);
goto cleanup; goto cleanup;
} }
dev.part_separator = value;
} }
if (VIR_APPEND_ELEMENT(source->devices, source->ndevice, dev) < 0) { if (VIR_APPEND_ELEMENT(source->devices, source->ndevice, dev) < 0) {
@ -1094,7 +1095,7 @@ virStoragePoolSourceFormat(virBuffer *buf,
virBufferEscapeString(buf, "<device path='%s'", virBufferEscapeString(buf, "<device path='%s'",
src->devices[i].path); src->devices[i].path);
if (src->devices[i].part_separator != if (src->devices[i].part_separator !=
VIR_TRISTATE_SWITCH_ABSENT) { VIR_TRISTATE_BOOL_ABSENT) {
virBufferAsprintf(buf, " part_separator='%s'", virBufferAsprintf(buf, " part_separator='%s'",
virTristateBoolTypeToString(src->devices[i].part_separator)); virTristateBoolTypeToString(src->devices[i].part_separator));
} }

View File

@ -161,7 +161,7 @@ struct _virStoragePoolSourceDevice {
virStoragePoolSourceDeviceExtent *freeExtents; virStoragePoolSourceDeviceExtent *freeExtents;
char *path; char *path;
int format; /* Pool specific source format */ int format; /* Pool specific source format */
int part_separator; /* enum virTristateSwitch */ virTristateBool part_separator;
/* When the source device is a physical disk, /* When the source device is a physical disk,
* the geometry data is needed * the geometry data is needed