Package: libvirtd
Version: libvirt-daemon-system
Severity: normal

Dear Maintainer,

This is on a fresh installation of debian stretch (9.3.0).

I use libvirt Resource Partitioning [1] [2]. The cgroup is created with
systemd:

root@debian9:~# cat /etc/systemd/system/machine-jonas.slice 
[Unit]
Description=Slice: jonas
Before=slices.target
Wants=machine.slice

[Slice]
CPUShares=1024
MemoryLimit=9.5G

root@debian9:~# stat /sys/fs/cgroup/cpu/machine.slice/machine-jonas.slice/
  File: /sys/fs/cgroup/cpu/machine.slice/machine-jonas.slice/
[…]


When creating a domain with the following XML (using that resource
partition/cgroup according to [2]):

root@debian9:~# cat test.xml
<domain type='qemu'>
  <name>test</name>
  <memory unit='KiB'>524288</memory>
  <currentMemory unit='KiB'>524288</currentMemory>
  <vcpu placement='static'>8</vcpu>
  <resource>
    <partition>/machine/jonas</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.1'>hvm</type>
    <bios useserial='yes'/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-model'>
    <model fallback='allow'/>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <pm>
    <suspend-to-mem enabled='yes'/>
    <suspend-to-disk enabled='yes'/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <serial type='pty'>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
  </devices>
</domain>
root@debian9:~# virsh define test.xml
Domain test defined from test.xml


Attempting to start the domain fails with:

root@debian9:~# virsh start test
error: Failed to start domain test
error: Failed to create controller cpu for group: No such file or directory


I attached strace to the libvirtd process to find out which cgroup path
it tries to use:

root@debian9:~# strace -ffp $(pidof libvirtd) 2>&1 | grep cpu
[pid 10876] lstat("/sys/fs/cgroup/cpu", {st_mode=S_IFLNK|0777, st_size=11, 
...}) = 0
[pid 10876] lstat("/sys/fs/cgroup/cpuacct", {st_mode=S_IFLNK|0777, st_size=11, 
...}) = 0
[pid 10876] lstat("/sys/fs/cgroup/cpu", {st_mode=S_IFLNK|0777, st_size=11, 
...}) = 0
[pid 10876] lstat("/sys/fs/cgroup/cpuacct", {st_mode=S_IFLNK|0777, st_size=11, 
...}) = 0
[pid 10876] access("/sys/fs/cgroup/cpu,cpuacct/machine/jonas.partition/", F_OK) 
= -1 ENOENT (No such file or directory)
[pid 10876] open("/sys/fs/cgroup/cpu,cpuacct/machine/jonas.partition/", 
O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or 
directory)
[pid 10876] open("/sys/fs/cgroup/cpu,cpuacct/machine/jonas.partition/", 
O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or 
directory)
[pid 10876] open("/sys/fs/cgroup/cpuset/machine/jonas.partition/", 
O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or 
directory)
[pid 10876] sendto(8, {{len=192, type=0x9c5 /* NLMSG_??? */, 
flags=NLM_F_REQUEST|NLM_F_ACK, seq=42, pid=0}, "virt=qemu resrc=vcpu 
reason=star"...}, 192, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 
12) = 192


It tries to use the ``/machine/jonas.partition`` path, which is,
according to [2], only used on non-systemd systems. It appears that
libvirt does not recognize the system as systemd-based, making the start
of the domain fail. Removing the <resource/> section from the domain
config makes the domain start.


I would expect that libvirt recognizes the system such that operation
according to [2] (with a machine-foo.slice file, a
<partition>/machine/foo</partition> should work) is possible.


kind regards,
Jonas

   [1]: https://libvirt.org/formatdomain.html#resPartition
   [2]: https://libvirt.org/cgroups.html#customPartiton


-- System Information:
Debian Release: 9.3
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Reply via email to