mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
util: Extract and rename qemuDomainDelCgroupForThread to virCgroupDelThread
This commit is contained in:
parent
133be0a9e2
commit
c84c2cb389
@ -1269,6 +1269,7 @@ virCgroupBindMount;
|
|||||||
virCgroupControllerAvailable;
|
virCgroupControllerAvailable;
|
||||||
virCgroupControllerTypeFromString;
|
virCgroupControllerTypeFromString;
|
||||||
virCgroupControllerTypeToString;
|
virCgroupControllerTypeToString;
|
||||||
|
virCgroupDelThread;
|
||||||
virCgroupDenyAllDevices;
|
virCgroupDenyAllDevices;
|
||||||
virCgroupDenyDevice;
|
virCgroupDenyDevice;
|
||||||
virCgroupDenyDevicePath;
|
virCgroupDenyDevicePath;
|
||||||
|
@ -4589,25 +4589,6 @@ static void qemuProcessEventHandler(void *data, void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
qemuDomainDelCgroupForThread(virCgroupPtr cgroup,
|
|
||||||
virCgroupThreadName nameval,
|
|
||||||
int idx)
|
|
||||||
{
|
|
||||||
virCgroupPtr new_cgroup = NULL;
|
|
||||||
|
|
||||||
if (cgroup) {
|
|
||||||
if (virCgroupNewThread(cgroup, nameval, idx, false, &new_cgroup) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* Remove the offlined cgroup */
|
|
||||||
virCgroupRemove(new_cgroup);
|
|
||||||
virCgroupFree(&new_cgroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver,
|
qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
@ -4701,8 +4682,7 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
virDomainAuditVcpu(vm, oldvcpus, oldvcpus - 1, "update", true);
|
virDomainAuditVcpu(vm, oldvcpus, oldvcpus - 1, "update", true);
|
||||||
|
|
||||||
if (qemuDomainDelCgroupForThread(priv->cgroup,
|
if (virCgroupDelThread(priv->cgroup, VIR_CGROUP_THREAD_VCPU, vcpu) < 0)
|
||||||
VIR_CGROUP_THREAD_VCPU, vcpu) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -5904,9 +5884,8 @@ qemuDomainHotplugDelIOThread(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
virDomainIOThreadIDDel(vm->def, iothread_id);
|
virDomainIOThreadIDDel(vm->def, iothread_id);
|
||||||
|
|
||||||
if (qemuDomainDelCgroupForThread(priv->cgroup,
|
if (virCgroupDelThread(priv->cgroup, VIR_CGROUP_THREAD_IOTHREAD,
|
||||||
VIR_CGROUP_THREAD_IOTHREAD,
|
iothread_id) < 0)
|
||||||
iothread_id) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -4821,3 +4821,23 @@ virCgroupControllerAvailable(int controller ATTRIBUTE_UNUSED)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif /* !VIR_CGROUP_SUPPORTED */
|
#endif /* !VIR_CGROUP_SUPPORTED */
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virCgroupDelThread(virCgroupPtr cgroup,
|
||||||
|
virCgroupThreadName nameval,
|
||||||
|
int idx)
|
||||||
|
{
|
||||||
|
virCgroupPtr new_cgroup = NULL;
|
||||||
|
|
||||||
|
if (cgroup) {
|
||||||
|
if (virCgroupNewThread(cgroup, nameval, idx, false, &new_cgroup) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* Remove the offlined cgroup */
|
||||||
|
virCgroupRemove(new_cgroup);
|
||||||
|
virCgroupFree(&new_cgroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -86,6 +86,10 @@ int virCgroupNewThread(virCgroupPtr domain,
|
|||||||
virCgroupPtr *group)
|
virCgroupPtr *group)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(5);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(5);
|
||||||
|
|
||||||
|
int virCgroupDelThread(virCgroupPtr cgroup,
|
||||||
|
virCgroupThreadName nameval,
|
||||||
|
int idx);
|
||||||
|
|
||||||
int virCgroupNewDetect(pid_t pid,
|
int virCgroupNewDetect(pid_t pid,
|
||||||
int controllers,
|
int controllers,
|
||||||
virCgroupPtr *group);
|
virCgroupPtr *group);
|
||||||
|
Loading…
Reference in New Issue
Block a user