mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-05 04:41:20 +00:00
vircgroup: machinename will never be NULL
Commit <eaf2c9f89107b9f60cf8db2c919f78b987ff7177> moved machineName generation before virCgroupNewDetectMachine() is called. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
fc221c053b
commit
f9d18f89f7
@ -266,27 +266,22 @@ virCgroupValidateMachineGroup(virCgroupPtr group,
|
|||||||
if (virCgroupPartitionEscape(&partname) < 0)
|
if (virCgroupPartitionEscape(&partname) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (machinename &&
|
if (virAsprintf(&partmachinename, "%s.libvirt-%s",
|
||||||
(virAsprintf(&partmachinename, "%s.libvirt-%s",
|
|
||||||
machinename, drivername) < 0 ||
|
machinename, drivername) < 0 ||
|
||||||
virCgroupPartitionEscape(&partmachinename) < 0))
|
virCgroupPartitionEscape(&partmachinename) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(scopename_old = virSystemdMakeScopeName(name, drivername, true)))
|
if (!(scopename_old = virSystemdMakeScopeName(name, drivername, true)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* We should keep trying even if this failed */
|
if (!(scopename_new = virSystemdMakeScopeName(machinename,
|
||||||
if (!machinename)
|
|
||||||
virResetLastError();
|
|
||||||
else if (!(scopename_new = virSystemdMakeScopeName(machinename,
|
|
||||||
drivername, false)))
|
drivername, false)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virCgroupPartitionEscape(&scopename_old) < 0)
|
if (virCgroupPartitionEscape(&scopename_old) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (scopename_new &&
|
if (virCgroupPartitionEscape(&scopename_new) < 0)
|
||||||
virCgroupPartitionEscape(&scopename_new) < 0)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
|
for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
|
||||||
@ -315,16 +310,16 @@ virCgroupValidateMachineGroup(virCgroupPtr group,
|
|||||||
tmp++;
|
tmp++;
|
||||||
|
|
||||||
if (STRNEQ(tmp, name) &&
|
if (STRNEQ(tmp, name) &&
|
||||||
STRNEQ_NULLABLE(tmp, machinename) &&
|
STRNEQ(tmp, machinename) &&
|
||||||
STRNEQ(tmp, partname) &&
|
STRNEQ(tmp, partname) &&
|
||||||
STRNEQ_NULLABLE(tmp, partmachinename) &&
|
STRNEQ(tmp, partmachinename) &&
|
||||||
STRNEQ(tmp, scopename_old) &&
|
STRNEQ(tmp, scopename_old) &&
|
||||||
STRNEQ_NULLABLE(tmp, scopename_new)) {
|
STRNEQ(tmp, scopename_new)) {
|
||||||
VIR_DEBUG("Name '%s' for controller '%s' does not match "
|
VIR_DEBUG("Name '%s' for controller '%s' does not match "
|
||||||
"'%s', '%s', '%s', '%s' or '%s'",
|
"'%s', '%s', '%s', '%s' or '%s'",
|
||||||
tmp, virCgroupControllerTypeToString(i),
|
tmp, virCgroupControllerTypeToString(i),
|
||||||
name, NULLSTR(machinename), partname,
|
name, machinename, partname,
|
||||||
scopename_old, NULLSTR(scopename_new));
|
scopename_old, scopename_new);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user