Bug 1426220 - document that virsh setvcpus can't change the maximum cpu count with topology present in xml
Summary: document that virsh setvcpus can't change the maximum cpu count with topology...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: ppc64le
OS: Linux
unspecified
urgent
Target Milestone: ---
Assignee: Peter Krempa
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-23 13:11 UTC by Satheesh Rajendran
Modified: 2017-04-05 07:38 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-04-05 07:38:52 UTC
Embargoed:


Attachments (Terms of Use)

Description Satheesh Rajendran 2017-02-23 13:11:25 UTC
Description of problem:
setvcpu fails to change the maximum cpu with topology tags present in xml, it is common and valid scenario to have topology definition in the guest xml, that should not stop increasing/decreasing the maximum possible vcpus count of an guest.
Ideally the change should get reflected in topology tags too.

Version-Release number of selected component (if applicable):
Upstream libvirt compiled at 
Repo: https://github.com/libvirt/libvirt.git 
Branch: master 
Commit: ff029e4434408b7fa2838e07981368394a201d49
#libvirtd --version
libvirtd (libvirt) 3.1.0

Upstream qemu compiled at
Repo:  git://git.qemu.org/qemu.git 
Branch: master 
Commit: 796b288f7be875045670f963ce99991b3c8e96ac
#qemu-kvm -version
QEMU emulator version 2.8.50 (v2.8.0-1417-g796b288-dirty)
Copyright (c) 2003-2016 Fabrice Bellard and the QEMU Project developers


How reproducible:
Always

Steps to Reproduce:
1. start the guest 
2. virsh setvcpus virt-tests-vm1 128 --maximum --config 
error: invalid argument: CPU topology doesn't match the desired vcpu count-------------NOK

3. without topology definition, it is able to set the maximum vcpu number 
<cpu>
    <topology sockets='1' cores='64' threads='1'/>
 </cpu>

Actual results:
not able to change the maximum vcpu number in xml

Expected results:
Maximum vcpu number should be updated 

Additional info:
Guest XML:
<domain type='kvm' id='79'>
  <name>virt-tests-vm1</name>
  <uuid>5246d397-d331-4912-bf6a-fd3ae0a77376</uuid>
  <memory unit='KiB'>33554432</memory>
  <currentMemory unit='KiB'>33554432</currentMemory>
  <vcpu placement='static' current='10'>64</vcpu>
  <vcpus>
    <vcpu id='0' enabled='yes' hotpluggable='no' order='1'/>
    <vcpu id='1' enabled='yes' hotpluggable='yes' order='2'/>
    <vcpu id='2' enabled='yes' hotpluggable='yes' order='3'/>
    <vcpu id='3' enabled='yes' hotpluggable='yes' order='4'/>
    <vcpu id='4' enabled='yes' hotpluggable='yes' order='5'/>
    <vcpu id='5' enabled='yes' hotpluggable='yes' order='6'/>
    <vcpu id='6' enabled='yes' hotpluggable='yes' order='7'/>
    <vcpu id='7' enabled='yes' hotpluggable='yes' order='8'/>
    <vcpu id='8' enabled='yes' hotpluggable='yes' order='9'/>
    <vcpu id='9' enabled='yes' hotpluggable='yes' order='10'/>
    <vcpu id='10' enabled='no' hotpluggable='yes'/>
    <vcpu id='11' enabled='no' hotpluggable='yes'/>
    <vcpu id='12' enabled='no' hotpluggable='yes'/>
    <vcpu id='13' enabled='no' hotpluggable='yes'/>
    <vcpu id='14' enabled='no' hotpluggable='yes'/>
    <vcpu id='15' enabled='no' hotpluggable='yes'/>
    <vcpu id='16' enabled='no' hotpluggable='yes'/>
    <vcpu id='17' enabled='no' hotpluggable='yes'/>
    <vcpu id='18' enabled='no' hotpluggable='yes'/>
    <vcpu id='19' enabled='no' hotpluggable='yes'/>
    <vcpu id='20' enabled='no' hotpluggable='yes'/>
    <vcpu id='21' enabled='no' hotpluggable='yes'/>
    <vcpu id='22' enabled='no' hotpluggable='yes'/>
    <vcpu id='23' enabled='no' hotpluggable='yes'/>
    <vcpu id='24' enabled='no' hotpluggable='yes'/>
    <vcpu id='25' enabled='no' hotpluggable='yes'/>
    <vcpu id='26' enabled='no' hotpluggable='yes'/>
    <vcpu id='27' enabled='no' hotpluggable='yes'/>
    <vcpu id='28' enabled='no' hotpluggable='yes'/>
    <vcpu id='29' enabled='no' hotpluggable='yes'/>
    <vcpu id='30' enabled='no' hotpluggable='yes'/>
    <vcpu id='31' enabled='no' hotpluggable='yes'/>
    <vcpu id='32' enabled='no' hotpluggable='yes'/>
    <vcpu id='33' enabled='no' hotpluggable='yes'/>
    <vcpu id='34' enabled='no' hotpluggable='yes'/>
    <vcpu id='35' enabled='no' hotpluggable='yes'/>
    <vcpu id='36' enabled='no' hotpluggable='yes'/>
    <vcpu id='37' enabled='no' hotpluggable='yes'/>
    <vcpu id='38' enabled='no' hotpluggable='yes'/>
    <vcpu id='39' enabled='no' hotpluggable='yes'/>
    <vcpu id='40' enabled='no' hotpluggable='yes'/>
    <vcpu id='41' enabled='no' hotpluggable='yes'/>
    <vcpu id='42' enabled='no' hotpluggable='yes'/>
    <vcpu id='43' enabled='no' hotpluggable='yes'/>
    <vcpu id='44' enabled='no' hotpluggable='yes'/>
    <vcpu id='45' enabled='no' hotpluggable='yes'/>
    <vcpu id='46' enabled='no' hotpluggable='yes'/>
    <vcpu id='47' enabled='no' hotpluggable='yes'/>
    <vcpu id='48' enabled='no' hotpluggable='yes'/>
    <vcpu id='49' enabled='no' hotpluggable='yes'/>
    <vcpu id='50' enabled='no' hotpluggable='yes'/>
    <vcpu id='51' enabled='no' hotpluggable='yes'/>
    <vcpu id='52' enabled='no' hotpluggable='yes'/>
    <vcpu id='53' enabled='no' hotpluggable='yes'/>
    <vcpu id='54' enabled='no' hotpluggable='yes'/>
    <vcpu id='55' enabled='no' hotpluggable='yes'/>
    <vcpu id='56' enabled='no' hotpluggable='yes'/>
    <vcpu id='57' enabled='no' hotpluggable='yes'/>
    <vcpu id='58' enabled='no' hotpluggable='yes'/>
    <vcpu id='59' enabled='no' hotpluggable='yes'/>
    <vcpu id='60' enabled='no' hotpluggable='yes'/>
    <vcpu id='61' enabled='no' hotpluggable='yes'/>
    <vcpu id='62' enabled='no' hotpluggable='yes'/>
    <vcpu id='63' enabled='no' hotpluggable='yes'/>
  </vcpus>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='ppc64le' machine='pseries-2.9'>hvm</type>
    <boot dev='hd'/>
  </os>
  <cpu>
    <topology sockets='1' cores='64' threads='1'/>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/home/sath/runAvocadoFVTTest/avocado-fvt-wrapper/data/avocado-vt/images/f25-ppc64le.qcow2'/>
      <backingStore/>
      <target dev='sda' bus='scsi'/>
      <alias name='scsi0-0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='scsi' index='0' model='virtio-scsi'>
      <alias name='scsi0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </controller>
    <controller type='usb' index='0' model='pci-ohci'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:61:62:63'/>
      <source bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/3'/>
      <target port='0'/>
      <alias name='serial0'/>
      <address type='spapr-vio' reg='0x30000000'/>
    </serial>
    <console type='pty' tty='/dev/pts/3'>
      <source path='/dev/pts/3'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
      <address type='spapr-vio' reg='0x30000000'/>
    </console>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </memballoon>
    <panic model='pseries'/>
  </devices>
  <seclabel type='dynamic' model='selinux' relabel='yes'>
    <label>system_u:system_r:svirt_t:s0:c623,c787</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c623,c787</imagelabel>
  </seclabel>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+107:+107</label>
    <imagelabel>+107:+107</imagelabel>
  </seclabel>
</domain>

Comment 1 Peter Krempa 2017-02-23 13:52:02 UTC
If you explicitly specify the topology, you have to edit both the maximum count and the topology together. The existing API can't do it for you since there are multiple ways how to fix the topology. For such change, you need to define a new XML.

Comment 2 Satheesh Rajendran 2017-02-23 14:19:08 UTC
(In reply to Peter Krempa from comment #1)
> If you explicitly specify the topology, you have to edit both the maximum
> count and the topology together. The existing API can't do it for you since
> there are multiple ways how to fix the topology. For such change, you need
> to define a new XML.

Wont it be a limitation for the API, as explicit topology can be common.
If not fix, should be documented as limitation somewhere?

Comment 3 Peter Krempa 2017-02-24 15:24:51 UTC
Yes, documenting it should be worth while.

Comment 4 Peter Krempa 2017-04-05 07:38:52 UTC
commit 4661a1868bb4d918e43ed96c4ae14f5ecd37b3f7
Author: Peter Krempa <pkrempa>
Date:   Tue Apr 4 16:02:21 2017 +0200

    docs: Document limitation of maximum vcpu count used with <topology>
    
    qemu requires that the topology equals to the maximum vcpu count.
    Document this along with the API to set maximum vcpu count and the XML
    element.


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