mirror of https://gitee.com/openkylin/libvirt.git
Revert "vircgroup: cleanup controllers not managed by systemd on error"
This reverts commit 1602aa28f8
.
There is no need to call virCgroupRemove() nor virCgroupFree() if
virCgroupEnableMissingControllers() fails because it will not modify
'group' at all.
The cleanup of directories is done in virCgroupMakeGroup().
Reviewed-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
b1a0f691ce
commit
199eee6aae
|
@ -1055,7 +1055,6 @@ virCgroupNewMachineSystemd(const char *name,
|
|||
int rv;
|
||||
virCgroupPtr init;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
virErrorPtr saved = NULL;
|
||||
|
||||
VIR_DEBUG("Trying to setup machine '%s' via systemd", name);
|
||||
if ((rv = virSystemdCreateMachine(name,
|
||||
|
@ -1088,24 +1087,20 @@ virCgroupNewMachineSystemd(const char *name,
|
|||
|
||||
if (virCgroupEnableMissingControllers(path, pidleader,
|
||||
controllers, group) < 0) {
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virCgroupAddProcess(*group, pidleader) < 0)
|
||||
goto error;
|
||||
if (virCgroupAddProcess(*group, pidleader) < 0) {
|
||||
virErrorPtr saved = virSaveLastError();
|
||||
virCgroupRemove(*group);
|
||||
virCgroupFree(group);
|
||||
if (saved) {
|
||||
virSetError(saved);
|
||||
virFreeError(saved);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
saved = virSaveLastError();
|
||||
virCgroupRemove(*group);
|
||||
virCgroupFree(group);
|
||||
if (saved) {
|
||||
virSetError(saved);
|
||||
virFreeError(saved);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue