mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-31 05:57:16 +00:00
qemu: driver: Use virDomainDiskDefParseSource in qemuDomainBlockCopy
qemuDomainBlockCopy needs just the source portion of the disk but uses the disk parser for it. Since we have a specific function now, refactor the code to avoid having to deal with the unused virDomainDiskDef. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
fb0238414e
commit
0202467c4b
@ -15273,7 +15273,6 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *disk, const char *destxml,
|
|||||||
unsigned long long bandwidth = 0;
|
unsigned long long bandwidth = 0;
|
||||||
unsigned int granularity = 0;
|
unsigned int granularity = 0;
|
||||||
unsigned long long buf_size = 0;
|
unsigned long long buf_size = 0;
|
||||||
virDomainDiskDef *diskdef = NULL;
|
|
||||||
virStorageSource *dest = NULL;
|
virStorageSource *dest = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -15326,18 +15325,14 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *disk, const char *destxml,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(diskdef = virDomainDiskDefParse(destxml, driver->xmlopt,
|
if (!(dest = virDomainDiskDefParseSource(destxml, driver->xmlopt,
|
||||||
VIR_DOMAIN_DEF_PARSE_INACTIVE |
|
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||||
VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)))
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
dest = g_steal_pointer(&diskdef->src);
|
|
||||||
|
|
||||||
ret = qemuDomainBlockCopyCommon(vm, dom->conn, disk, dest, bandwidth,
|
ret = qemuDomainBlockCopyCommon(vm, dom->conn, disk, dest, bandwidth,
|
||||||
granularity, buf_size, flags, false);
|
granularity, buf_size, flags, false);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainDiskDefFree(diskdef);
|
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user