mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: cgroup: Change qemu[Setup|Teardown]DiskCgroup to take virStorageSource
Since the disk is necessary only to get the source modify the functions to take the source directly and rename them to qemu[Setup|Teardown]ImageChainCgroup. Additionally drop a pointless comment containing the old function name. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
33b0a3bab8
commit
e7d14bf965
@ -204,13 +204,13 @@ qemuTeardownImageCgroup(virDomainObjPtr vm,
|
||||
|
||||
|
||||
int
|
||||
qemuSetupDiskCgroup(virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk)
|
||||
qemuSetupImageChainCgroup(virDomainObjPtr vm,
|
||||
virStorageSourcePtr src)
|
||||
{
|
||||
virStorageSourcePtr next;
|
||||
bool forceReadonly = false;
|
||||
|
||||
for (next = disk->src; virStorageSourceIsBacking(next); next = next->backingStore) {
|
||||
for (next = src; virStorageSourceIsBacking(next); next = next->backingStore) {
|
||||
if (qemuSetupImageCgroupInternal(vm, next, forceReadonly) < 0)
|
||||
return -1;
|
||||
|
||||
@ -223,12 +223,12 @@ qemuSetupDiskCgroup(virDomainObjPtr vm,
|
||||
|
||||
|
||||
int
|
||||
qemuTeardownDiskCgroup(virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk)
|
||||
qemuTeardownImageChainCgroup(virDomainObjPtr vm,
|
||||
virStorageSourcePtr src)
|
||||
{
|
||||
virStorageSourcePtr next;
|
||||
|
||||
for (next = disk->src; virStorageSourceIsBacking(next); next = next->backingStore) {
|
||||
for (next = src; virStorageSourceIsBacking(next); next = next->backingStore) {
|
||||
if (qemuTeardownImageCgroup(vm, next) < 0)
|
||||
return -1;
|
||||
}
|
||||
@ -720,7 +720,7 @@ qemuSetupDevicesCgroup(virDomainObjPtr vm)
|
||||
goto cleanup;
|
||||
|
||||
for (i = 0; i < vm->def->ndisks; i++) {
|
||||
if (qemuSetupDiskCgroup(vm, vm->def->disks[i]) < 0)
|
||||
if (qemuSetupImageChainCgroup(vm, vm->def->disks[i]->src) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -31,10 +31,10 @@ int qemuSetupImageCgroup(virDomainObjPtr vm,
|
||||
virStorageSourcePtr src);
|
||||
int qemuTeardownImageCgroup(virDomainObjPtr vm,
|
||||
virStorageSourcePtr src);
|
||||
int qemuSetupDiskCgroup(virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk);
|
||||
int qemuTeardownDiskCgroup(virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk);
|
||||
int qemuSetupImageChainCgroup(virDomainObjPtr vm,
|
||||
virStorageSourcePtr src);
|
||||
int qemuTeardownImageChainCgroup(virDomainObjPtr vm,
|
||||
virStorageSourcePtr src);
|
||||
int qemuSetupInputCgroup(virDomainObjPtr vm,
|
||||
virDomainInputDefPtr dev);
|
||||
int qemuTeardownInputCgroup(virDomainObjPtr vm,
|
||||
|
@ -11311,9 +11311,6 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
|
||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
|
||||
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) {
|
||||
virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi;
|
||||
/* Follow qemuSetupDiskCgroup() and qemuSetImageCgroupInternal()
|
||||
* which does nothing for non local storage
|
||||
*/
|
||||
VIR_DEBUG("Not updating /dev for hostdev iSCSI path '%s'", iscsisrc->src->path);
|
||||
} else {
|
||||
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
|
||||
|
@ -17169,7 +17169,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
|
||||
if (disk->mirror->format &&
|
||||
disk->mirror->format != VIR_STORAGE_FILE_RAW &&
|
||||
(qemuDomainNamespaceSetupDisk(vm, disk->src) < 0 ||
|
||||
qemuSetupDiskCgroup(vm, disk) < 0 ||
|
||||
qemuSetupImageChainCgroup(vm, disk->src) < 0 ||
|
||||
qemuSecuritySetDiskLabel(driver, vm, disk) < 0))
|
||||
goto cleanup;
|
||||
|
||||
|
@ -116,14 +116,14 @@ qemuHotplugPrepareDiskAccess(virQEMUDriverPtr driver,
|
||||
if (qemuSecuritySetDiskLabel(driver, vm, disk) < 0)
|
||||
goto rollback_namespace;
|
||||
|
||||
if (qemuSetupDiskCgroup(vm, disk) < 0)
|
||||
if (qemuSetupImageChainCgroup(vm, disk->src) < 0)
|
||||
goto rollback_label;
|
||||
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
|
||||
rollback_cgroup:
|
||||
if (qemuTeardownDiskCgroup(vm, disk) < 0)
|
||||
if (qemuTeardownImageChainCgroup(vm, disk->src) < 0)
|
||||
VIR_WARN("Unable to tear down cgroup access on %s",
|
||||
NULLSTR(virDomainDiskGetSource(disk)));
|
||||
rollback_label:
|
||||
|
Loading…
x
Reference in New Issue
Block a user