mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 18:03:32 +00:00
virDomainBackupDefAssignStore: Restructure control flow
Return early for errors instead of using 'else' branches. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
a091edf9db
commit
de48ade195
@ -422,17 +422,19 @@ virDomainBackupDefAssignStore(virDomainBackupDiskDef *disk,
|
|||||||
_("disk '%1$s' has no media"), disk->name);
|
_("disk '%1$s' has no media"), disk->name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (!disk->store) {
|
}
|
||||||
if (virStorageSourceGetActualType(src) == VIR_STORAGE_TYPE_FILE) {
|
|
||||||
disk->store = virStorageSourceNew();
|
if (!disk->store) {
|
||||||
disk->store->type = VIR_STORAGE_TYPE_FILE;
|
if (virStorageSourceGetActualType(src) != VIR_STORAGE_TYPE_FILE) {
|
||||||
disk->store->path = g_strdup_printf("%s.%s", src->path, suffix);
|
|
||||||
} else {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("refusing to generate file name for disk '%1$s'"),
|
_("refusing to generate file name for disk '%1$s'"),
|
||||||
disk->name);
|
disk->name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disk->store = virStorageSourceNew();
|
||||||
|
disk->store->type = VIR_STORAGE_TYPE_FILE;
|
||||||
|
disk->store->path = g_strdup_printf("%s.%s", src->path, suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user