domain_conf: make virDomainPostParseCheckISCSIPath() void

The function only returns zero or aborts, so it might as well be void.
This has the added benefit of simplifying the code that calls it.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Matt Coleman 2020-11-05 22:32:38 -05:00 committed by Michal Privoznik
parent 3245d48b86
commit 0f3cedc676

View File

@ -5068,21 +5068,18 @@ virDomainHostdevAssignAddress(virDomainXMLOptionPtr xmlopt,
* provided, then default to zero. For an ISCSI LUN that is * provided, then default to zero. For an ISCSI LUN that is
* is provided by /dev/disk/by-path/... , then that path will * is provided by /dev/disk/by-path/... , then that path will
* have the specific lun requested. * have the specific lun requested.
*
* Returns 0 on success, -1 on failure
*/ */
static int static void
virDomainPostParseCheckISCSIPath(char **srcpath) virDomainPostParseCheckISCSIPath(char **srcpath)
{ {
char *path = NULL; char *path = NULL;
if (strchr(*srcpath, '/')) if (strchr(*srcpath, '/'))
return 0; return;
path = g_strdup_printf("%s/0", *srcpath); path = g_strdup_printf("%s/0", *srcpath);
VIR_FREE(*srcpath); VIR_FREE(*srcpath);
*srcpath = g_steal_pointer(&path); *srcpath = g_steal_pointer(&path);
return 0;
} }
@ -5101,9 +5098,7 @@ virDomainHostdevDefPostParse(virDomainHostdevDefPtr dev,
scsisrc = &dev->source.subsys.u.scsi; scsisrc = &dev->source.subsys.u.scsi;
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) { if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) {
virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi; virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi;
virDomainPostParseCheckISCSIPath(&iscsisrc->src->path);
if (virDomainPostParseCheckISCSIPath(&iscsisrc->src->path) < 0)
return -1;
} }
if (dev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && if (dev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
@ -5283,9 +5278,8 @@ virDomainDiskDefPostParse(virDomainDiskDefPtr disk,
} }
if (disk->src->type == VIR_STORAGE_TYPE_NETWORK && if (disk->src->type == VIR_STORAGE_TYPE_NETWORK &&
disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI && disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI) {
virDomainPostParseCheckISCSIPath(&disk->src->path) < 0) { virDomainPostParseCheckISCSIPath(&disk->src->path);
return -1;
} }
if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO && if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO &&