mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
util: Extract and rename qemuDomainDelCgroupForThread to virCgroupDelThread
This commit is contained in:
parent
133be0a9e2
commit
c84c2cb389
@ -1269,6 +1269,7 @@ virCgroupBindMount;
|
||||
virCgroupControllerAvailable;
|
||||
virCgroupControllerTypeFromString;
|
||||
virCgroupControllerTypeToString;
|
||||
virCgroupDelThread;
|
||||
virCgroupDenyAllDevices;
|
||||
virCgroupDenyDevice;
|
||||
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
|
||||
qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
@ -4701,8 +4682,7 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver,
|
||||
|
||||
virDomainAuditVcpu(vm, oldvcpus, oldvcpus - 1, "update", true);
|
||||
|
||||
if (qemuDomainDelCgroupForThread(priv->cgroup,
|
||||
VIR_CGROUP_THREAD_VCPU, vcpu) < 0)
|
||||
if (virCgroupDelThread(priv->cgroup, VIR_CGROUP_THREAD_VCPU, vcpu) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
@ -5904,8 +5884,7 @@ qemuDomainHotplugDelIOThread(virQEMUDriverPtr driver,
|
||||
|
||||
virDomainIOThreadIDDel(vm->def, iothread_id);
|
||||
|
||||
if (qemuDomainDelCgroupForThread(priv->cgroup,
|
||||
VIR_CGROUP_THREAD_IOTHREAD,
|
||||
if (virCgroupDelThread(priv->cgroup, VIR_CGROUP_THREAD_IOTHREAD,
|
||||
iothread_id) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -4821,3 +4821,23 @@ virCgroupControllerAvailable(int controller ATTRIBUTE_UNUSED)
|
||||
return false;
|
||||
}
|
||||
#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)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(5);
|
||||
|
||||
int virCgroupDelThread(virCgroupPtr cgroup,
|
||||
virCgroupThreadName nameval,
|
||||
int idx);
|
||||
|
||||
int virCgroupNewDetect(pid_t pid,
|
||||
int controllers,
|
||||
virCgroupPtr *group);
|
||||
|
Loading…
Reference in New Issue
Block a user