Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1686648 - Creating domain fails when cpuset is limited by systemd slice
Summary: Creating domain fails when cpuset is limited by systemd slice
Keywords:
Status: NEW
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-07 23:16 UTC by Charlie Smurthwaite
Modified: 2019-03-08 09:03 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:


Attachments (Terms of Use)

Description Charlie Smurthwaite 2019-03-07 23:16:13 UTC
When using a systemd "machine" slice to restrict the CPU cores used for virtualization, libvirt fails to create a kvm domain.

Domain XML:

<domain type="kvm">
  <name>csdev_vm_q52a4in7jQIDCmxY</name>
  <uuid>a11a1e1c-c487-4542-8e57-dcd51f82a25b</uuid>
  <memory unit="MiB">2048</memory>
  <vcpu cpuset="0,3-20,23-39">2</vcpu>
  <os>
    <type arch="x86_64">hvm</type>
  </os>
</domain>

Creation error:

Call to virDomainCreateXML failed: Invalid value '0-39' for 'cpuset.cpus': Invalid argument

Systemd slice configuration:

group machine.slice {
    cpuset {
        cpuset.cpus="0,3-20,23-39";
        cpuset.mems="0-1";
    }
    memory {
        memory.use_hierarchy="1";
        memory.move_charge_at_immigrate="1";
        memory.limit_in_bytes="508214M";
        memory.memsw.limit_in_bytes="508214M";
    }
}

OS: Ubuntu 18.04
libvirt version: 4.0.0

It appears at a glance that libvirt always attempts to set CPU affinity to all CPUs, even those not accessible to it, however I do not fully understand the mechanisms here.

Comment 1 Charlie Smurthwaite 2019-03-08 09:03:43 UTC
It was recommended that I install the Ubuntu package "systemd-container". I have done so and this resolves the problem. Not sure if this is the correct solution or if there is still an underlying bug here.


Note You need to log in before you can comment on or make changes to this bug.