mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 13:35:17 +00:00
qemuBlockDiskDetectNodes: just return when alias is null
Just return when alias is null and Remove the 'ret' variable. Signed-off-by: Yi Li <yili@winhong.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
33ddfaf4e6
commit
21d83d37ff
@ -280,25 +280,22 @@ qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk,
|
|||||||
qemuBlockNodeNameBackingChainDataPtr entry = NULL;
|
qemuBlockNodeNameBackingChainDataPtr entry = NULL;
|
||||||
virStorageSourcePtr src = disk->src;
|
virStorageSourcePtr src = disk->src;
|
||||||
g_autofree char *alias = NULL;
|
g_autofree char *alias = NULL;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
/* don't attempt the detection if the top level already has node names */
|
/* don't attempt the detection if the top level already has node names */
|
||||||
if (src->nodeformat || src->nodestorage)
|
if (src->nodeformat || src->nodestorage)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!(alias = qemuAliasDiskDriveFromDisk(disk)))
|
if (!(alias = qemuAliasDiskDriveFromDisk(disk)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (!(entry = virHashLookup(disktable, alias))) {
|
if (!(entry = virHashLookup(disktable, alias)))
|
||||||
ret = 0;
|
return 0;
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (virStorageSourceIsBacking(src) && entry) {
|
while (virStorageSourceIsBacking(src) && entry) {
|
||||||
if (src->nodeformat || src->nodestorage) {
|
if (src->nodeformat || src->nodestorage) {
|
||||||
if (STRNEQ_NULLABLE(src->nodeformat, entry->nodeformat) ||
|
if (STRNEQ_NULLABLE(src->nodeformat, entry->nodeformat) ||
|
||||||
STRNEQ_NULLABLE(src->nodestorage, entry->nodestorage))
|
STRNEQ_NULLABLE(src->nodestorage, entry->nodestorage))
|
||||||
goto cleanup;
|
goto error;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
@ -310,13 +307,11 @@ qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk,
|
|||||||
src = src->backingStore;
|
src = src->backingStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
error:
|
||||||
if (ret < 0)
|
|
||||||
qemuBlockDiskClearDetectedNodes(disk);
|
qemuBlockDiskClearDetectedNodes(disk);
|
||||||
|
return -1;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user