mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
vircgroup: extract virCgroupV1StealPlacement
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
b549a66edf
commit
12264c12c8
@ -1319,8 +1319,7 @@ virCgroupNewMachineSystemd(const char *name,
|
||||
&init) < 0)
|
||||
return -1;
|
||||
|
||||
path = init->controllers[VIR_CGROUP_CONTROLLER_SYSTEMD].placement;
|
||||
init->controllers[VIR_CGROUP_CONTROLLER_SYSTEMD].placement = NULL;
|
||||
path = init->backend->stealPlacement(init);
|
||||
virCgroupFree(&init);
|
||||
|
||||
if (!path || STREQ(path, "/") || path[0] != '/') {
|
||||
|
@ -66,6 +66,9 @@ typedef int
|
||||
(*virCgroupValidatePlacementCB)(virCgroupPtr group,
|
||||
pid_t pid);
|
||||
|
||||
typedef char *
|
||||
(*virCgroupStealPlacementCB)(virCgroupPtr group);
|
||||
|
||||
struct _virCgroupBackend {
|
||||
virCgroupBackendType type;
|
||||
|
||||
@ -77,6 +80,7 @@ struct _virCgroupBackend {
|
||||
virCgroupDetectMountsCB detectMounts;
|
||||
virCgroupDetectPlacementCB detectPlacement;
|
||||
virCgroupValidatePlacementCB validatePlacement;
|
||||
virCgroupStealPlacementCB stealPlacement;
|
||||
};
|
||||
typedef struct _virCgroupBackend virCgroupBackend;
|
||||
typedef virCgroupBackend *virCgroupBackendPtr;
|
||||
|
@ -402,6 +402,17 @@ virCgroupV1ValidatePlacement(virCgroupPtr group,
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
virCgroupV1StealPlacement(virCgroupPtr group)
|
||||
{
|
||||
char *ret = NULL;
|
||||
|
||||
VIR_STEAL_PTR(ret, group->controllers[VIR_CGROUP_CONTROLLER_SYSTEMD].placement);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
virCgroupBackend virCgroupV1Backend = {
|
||||
.type = VIR_CGROUP_BACKEND_TYPE_V1,
|
||||
|
||||
@ -412,6 +423,7 @@ virCgroupBackend virCgroupV1Backend = {
|
||||
.detectMounts = virCgroupV1DetectMounts,
|
||||
.detectPlacement = virCgroupV1DetectPlacement,
|
||||
.validatePlacement = virCgroupV1ValidatePlacement,
|
||||
.stealPlacement = virCgroupV1StealPlacement,
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user