Currently when the vcpu placement is static and
cpuset is not specified, CPU Affinity shows 0..
CPUMAX. This patchset will result in display of
only online CPU's under CPU Affinity on linux.

Fixes the following Bug:

virsh dumpxml Fedora

<domain type='kvm' id='4'>
  <name>Fedora</name>
  <uuid>aecf3e5e-6f9a-42a3-9d6a-223a75569a66</uuid>
  <maxMemory slots='32' unit='KiB'>3145728</maxMemory>
  <memory unit='KiB'>524288</memory>
  <currentMemory unit='KiB'>524288</currentMemory>
  <vcpu placement='static' current='8'>160</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
 .....................
.......................
.........................
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' 
function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+0:+0</label>
    <imagelabel>+0:+0</imagelabel>
  </seclabel>
</domain>

lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                8
On-line CPU(s) list:   0-2,4-7
Off-line CPU(s) list:  3
Thread(s) per core:    1
Core(s) per socket:    7
Socket(s):             1
..........
..........
NUMA node0 CPU(s):     0-2,4-7
NUMA node1 CPU(s):

cat /sys/devices/system/cpu/online
0-2,4-7

Before Patch

virsh vcpupin Fedora

VCPU: CPU Affinity
----------------------------------
   0: 0-7
   1: 0-7
...
...
 158: 0-7
 159: 0-7

virsh emulatorpin Fedora
emulator: CPU Affinity
----------------------------------
       *: 0-7


After  Patch

virsh vcpupin Fedora

VCPU: CPU Affinity
----------------------------------
   0: 0-2,4-7
   1: 0-2,4-7
...
...
 158: 0-2,4-7
 159: 0-2,4-7

virsh emulatorpin Fedora
emulator: CPU Affinity
----------------------------------
       *: 0-2,4-7

Nitesh Konkar (2):
  conf: List only online cpus for virsh vcpupin
  conf: List only online cpus for virsh emulatorpin

 src/conf/domain_conf.c | 6 ++++++
 src/qemu/qemu_driver.c | 5 +++++
 2 files changed, 11 insertions(+)

-- 
2.1.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to