qemu: Sanitize argument names and empty disk check in qemuDomainDetermineDiskChain

Reuse virStorageSourceIsEmpty and rename "force" argument to
"force_probe".
This commit is contained in:
Peter Krempa 2014-09-18 11:21:10 +02:00
parent b8549877a1
commit 172ca0e748
2 changed files with 4 additions and 6 deletions

View File

@ -2707,20 +2707,18 @@ int
qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainDiskDefPtr disk, virDomainDiskDefPtr disk,
bool force) bool force_probe)
{ {
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
int ret = 0; int ret = 0;
uid_t uid; uid_t uid;
gid_t gid; gid_t gid;
int type = virStorageSourceGetActualType(disk->src);
if (type != VIR_STORAGE_TYPE_NETWORK && if (virStorageSourceIsEmpty(disk->src))
!disk->src->path)
goto cleanup; goto cleanup;
if (disk->src->backingStore) { if (disk->src->backingStore) {
if (force) if (force_probe)
virStorageSourceBackingStoreClear(disk->src); virStorageSourceBackingStoreClear(disk->src);
else else
goto cleanup; goto cleanup;

View File

@ -370,7 +370,7 @@ int qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
int qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, int qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainDiskDefPtr disk, virDomainDiskDefPtr disk,
bool force); bool force_probe);
int qemuDomainStorageFileInit(virQEMUDriverPtr driver, int qemuDomainStorageFileInit(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,