mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: factor out qemuDomainPrepareStorageSource()
This refactoring will simplify next changes. Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
9ba2bef816
commit
cb5371a8bd
@ -6114,6 +6114,32 @@ qemuDomainPrepareStorageSourceConfig(virStorageSource *src,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
qemuDomainPrepareStorageSource(virStorageSource *src,
|
||||||
|
virDomainObj *vm,
|
||||||
|
virDomainDiskDef *disk,
|
||||||
|
virQEMUDriverConfig *cfg)
|
||||||
|
{
|
||||||
|
qemuDomainObjPrivate *priv = vm->privateData;
|
||||||
|
|
||||||
|
/* convert detected ISO format to 'raw' as qemu would not understand it */
|
||||||
|
if (src->format == VIR_STORAGE_FILE_ISO)
|
||||||
|
src->format = VIR_STORAGE_FILE_RAW;
|
||||||
|
|
||||||
|
if (qemuDomainValidateStorageSource(src, priv->qemuCaps) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
qemuDomainPrepareStorageSourceConfig(src, cfg);
|
||||||
|
qemuDomainPrepareDiskSourceData(disk, src);
|
||||||
|
|
||||||
|
if (!qemuDiskBusIsSD(disk->bus) &&
|
||||||
|
qemuDomainPrepareStorageSourceBlockdev(disk, src, priv, cfg) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qemuDomainDetermineDiskChain:
|
* qemuDomainDetermineDiskChain:
|
||||||
* @driver: qemu driver object
|
* @driver: qemu driver object
|
||||||
@ -6134,7 +6160,6 @@ qemuDomainDetermineDiskChain(virQEMUDriver *driver,
|
|||||||
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
||||||
virStorageSource *src; /* iterator for the backing chain declared in XML */
|
virStorageSource *src; /* iterator for the backing chain declared in XML */
|
||||||
virStorageSource *n; /* iterator for the backing chain detected from disk */
|
virStorageSource *n; /* iterator for the backing chain detected from disk */
|
||||||
qemuDomainObjPrivate *priv = vm->privateData;
|
|
||||||
uid_t uid;
|
uid_t uid;
|
||||||
gid_t gid;
|
gid_t gid;
|
||||||
|
|
||||||
@ -6218,18 +6243,7 @@ qemuDomainDetermineDiskChain(virQEMUDriver *driver,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (n = src->backingStore; virStorageSourceIsBacking(n); n = n->backingStore) {
|
for (n = src->backingStore; virStorageSourceIsBacking(n); n = n->backingStore) {
|
||||||
/* convert detected ISO format to 'raw' as qemu would not understand it */
|
if (qemuDomainPrepareStorageSource(n, vm, disk, cfg) < 0)
|
||||||
if (n->format == VIR_STORAGE_FILE_ISO)
|
|
||||||
n->format = VIR_STORAGE_FILE_RAW;
|
|
||||||
|
|
||||||
if (qemuDomainValidateStorageSource(n, priv->qemuCaps) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
qemuDomainPrepareStorageSourceConfig(n, cfg);
|
|
||||||
qemuDomainPrepareDiskSourceData(disk, n);
|
|
||||||
|
|
||||||
if (!qemuDiskBusIsSD(disk->bus) &&
|
|
||||||
qemuDomainPrepareStorageSourceBlockdev(disk, n, priv, cfg) < 0)
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user