diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index da5ccff35f8a5381f5060e86e0a132e7eca6dd5f..ff83ab0055dd3684626f0708987af0c0cb5dc210 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -261,6 +261,7 @@ virCgroupValidateMachineGroup(virCgroupPtr group, char *scopename_new = NULL; char *machinename = virSystemdMakeMachineName(drivername, id, name, privileged); + char *partmachinename = NULL; if (virAsprintf(&partname, "%s.libvirt-%s", name, drivername) < 0) @@ -269,6 +270,12 @@ virCgroupValidateMachineGroup(virCgroupPtr group, if (virCgroupPartitionEscape(&partname) < 0) goto cleanup; + if (machinename && + (virAsprintf(&partmachinename, "%s.libvirt-%s", + machinename, drivername) < 0 || + virCgroupPartitionEscape(&partmachinename) < 0)) + goto cleanup; + if (!(scopename_old = virSystemdMakeScopeName(name, drivername, true))) goto cleanup; @@ -315,6 +322,7 @@ virCgroupValidateMachineGroup(virCgroupPtr group, if (STRNEQ(tmp, name) && STRNEQ_NULLABLE(tmp, machinename) && STRNEQ(tmp, partname) && + STRNEQ_NULLABLE(tmp, partmachinename) && STRNEQ(tmp, scopename_old) && STRNEQ_NULLABLE(tmp, scopename_new)) { VIR_DEBUG("Name '%s' for controller '%s' does not match " @@ -329,6 +337,7 @@ virCgroupValidateMachineGroup(virCgroupPtr group, valid = true; cleanup: + VIR_FREE(partmachinename); VIR_FREE(partname); VIR_FREE(scopename_old); VIR_FREE(scopename_new);