domain_cgroup: Fix a condition in virDomainCgroupConnectCgroup()

While parts of QEMU's CGroup code were moved under hypervisor
agnostic location (src/hypervisor/) a typo sneaked in. The
inspiration for virDomainCgroupConnectCgroup() comes from
qemuConnectCgroup(). The former is called upon reconnecting to a
running domain (after daemon restart). While the latter returned
early if the daemon was running unprivileged, the former returns
early if the daemon runs privileged. This is obviously wrong,
because root can set up CGroups.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2075765
Fixes: 788e2b58cb
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2022-04-19 17:22:22 +02:00
parent 136b821f18
commit eac8de54a6

View File

@ -485,7 +485,7 @@ virDomainCgroupConnectCgroup(const char *prefix,
bool privileged, bool privileged,
char *machineName) char *machineName)
{ {
if (privileged) if (!privileged)
return 0; return 0;
if (!virCgroupAvailable()) if (!virCgroupAvailable())