Bug 953187

Summary: Counting of physical CPU does not seems correct and return an error with virt-install
Product: [Community] Virtualization Tools Reporter: Laurent Pouilloux <laurent.pouilloux>
Component: libvirtAssignee: Martin Kletzander <mkletzan>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: berrange, crobinso, dyasny, mkletzan
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.10.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-05-09 08:22:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Image of the CPUs architecture none

Description Laurent Pouilloux 2013-04-17 14:50:46 UTC
Description of problem:
I'm trying to create virtual machine in a given cell. I get the pCPU id from the virsh capabilities command and use it for the cpuset option of the virt-install command. It return:
ERROR    cpuset's pCPU numbers must be less than pCPUs.

Version-Release number of selected component (if applicable):
 virtinst                            0.500.3-2
 libvirt-bin                         0.9.12-4~bpo60+1

How reproducible:
Every time

Steps to Reproduce:
1. get the xml structure of cpu topology using 'virsh capabilities'
In my case, with a 2 CPUs AMD, 12 cores/CPU
<topology>
      <cells num='4'>
        <cell id='0'>
          <cpus num='6'>
            <cpu id='0'/>
            <cpu id='1'/>
            <cpu id='2'/>
            <cpu id='3'/>
            <cpu id='4'/>
            <cpu id='5'/>
          </cpus>
        </cell>
        <cell id='1'>
          <cpus num='6'>
            <cpu id='6'/>
            <cpu id='7'/>
            <cpu id='8'/>
            <cpu id='9'/>
            <cpu id='10'/>
            <cpu id='11'/>
          </cpus>
        </cell>
        <cell id='2'>
          <cpus num='6'>
            <cpu id='18'/>
            <cpu id='19'/>
            <cpu id='20'/>
            <cpu id='21'/>
            <cpu id='22'/>
            <cpu id='23'/>
          </cpus>
        </cell>
        <cell id='3'>
          <cpus num='6'>
            <cpu id='12'/>
            <cpu id='13'/>
            <cpu id='14'/>
            <cpu id='15'/>
            <cpu id='16'/>
            <cpu id='17'/>
          </cpus>
        </cell>
      </cells>
    </topology>
2. Launch a virt-install command using cpuset. Ex:
virt-install -d --import --connect qemu:///system --nographics --noautoconsole --noreboot --name=vm-2 --network network=default,mac=00:16:3E:A8:00:03 --ram=1024 --disk path=/tmp/vm-2.qcow2,device=disk,format=qcow2,size=2,cache=none  --vcpus=6 --cpuset=18,19,20,21,22,23


Actual results:
Wed, 17 Apr 2013 14:10:22 DEBUG    Launched with command line:
/usr/bin/virt-install -d --import --connect qemu:///system --nographics --noautoconsole --noreboot --name=vm-2 --network network=default,mac=00:16:3E:A8:00:03 --ram=1024 --disk path=/tmp/vm-2.qcow2,device=disk,format=qcow2,size=2,cache=none --vcpus=6 --cpuset=18,19,20,21,22,23
Wed, 17 Apr 2013 14:10:22 DEBUG    Requesting libvirt URI qemu:///system
Wed, 17 Apr 2013 14:10:22 DEBUG    Received libvirt URI qemu:///system
Wed, 17 Apr 2013 14:10:22 DEBUG    Requesting virt method 'default', hv type 'default'.
Wed, 17 Apr 2013 14:10:22 DEBUG    Received virt method 'hvm'
Wed, 17 Apr 2013 14:10:22 DEBUG    Hypervisor name is 'kvm'
Wed, 17 Apr 2013 14:10:23 ERROR    cpuset's pCPU numbers must be less than pCPUs.
Traceback (most recent call last):
  File "/usr/bin/virt-install", line 1033, in <module>
    main()
  File "/usr/bin/virt-install", line 829, in main
    cli.get_cpuset(options.cpuset, guest.memory, guest, conn)
  File "/usr/lib/pymodules/python2.6/virtinst/cli.py", line 577, in get_cpuset
    guest.cpuset = cpuset
  File "/usr/lib/pymodules/python2.6/virtinst/Guest.py", line 278, in set_cpuset
    _validate_cpuset(self.conn, val)
  File "/usr/lib/pymodules/python2.6/virtinst/Guest.py", line 65, in _validate_cpuset
    raise ValueError, _("cpuset's pCPU numbers must be less "
ValueError: cpuset's pCPU numbers must be less than pCPUs.



Expected results:
Starting the VM pinned on core 18,19,20,21,22,23

Additional info:
None.

Comment 1 Cole Robinson 2013-04-21 19:12:32 UTC
virtinst has been merged into virt-manager.git. Moving all virtinst bugs to the virt-manager component.

Comment 2 Laurent Pouilloux 2013-04-30 09:23:01 UTC
I have tested using the virtinst 0.600 and the problem is not fixed.

It seems to come from the function util.get_phy_cpu that does not give the same number of CPU than the one which is returned by virsh capabilities.

I have added the PNG file of the architecture.

Comment 3 Laurent Pouilloux 2013-04-30 09:23:38 UTC
Created attachment 741804 [details]
Image of the CPUs architecture

Comment 4 Laurent Pouilloux 2013-04-30 15:05:25 UTC
(In reply to comment #0)
> Description of problem:
> I'm trying to create virtual machine in a given cell. I get the pCPU id from
> the virsh capabilities command and use it for the cpuset option of the
> virt-install command. It return:
> ERROR    cpuset's pCPU numbers must be less than pCPUs.
> 
> Version-Release number of selected component (if applicable):
>  virtinst                            0.500.3-2
>  libvirt-bin                         0.9.12-4~bpo60+1
> 
> How reproducible:
> Every time
> 
> Steps to Reproduce:
> 1. get the xml structure of cpu topology using 'virsh capabilities'
> In my case, with a 2 CPUs AMD, 12 cores/CPU
> <topology>
>       <cells num='4'>
>         <cell id='0'>
>           <cpus num='6'>
>             <cpu id='0'/>
>             <cpu id='1'/>
>             <cpu id='2'/>
>             <cpu id='3'/>
>             <cpu id='4'/>
>             <cpu id='5'/>
>           </cpus>
>         </cell>
>         <cell id='1'>
>           <cpus num='6'>
>             <cpu id='6'/>
>             <cpu id='7'/>
>             <cpu id='8'/>
>             <cpu id='9'/>
>             <cpu id='10'/>
>             <cpu id='11'/>
>           </cpus>
>         </cell>
>         <cell id='2'>
>           <cpus num='6'>
>             <cpu id='18'/>
>             <cpu id='19'/>
>             <cpu id='20'/>
>             <cpu id='21'/>
>             <cpu id='22'/>
>             <cpu id='23'/>
>           </cpus>
>         </cell>
>         <cell id='3'>
>           <cpus num='6'>
>             <cpu id='12'/>
>             <cpu id='13'/>
>             <cpu id='14'/>
>             <cpu id='15'/>
>             <cpu id='16'/>
>             <cpu id='17'/>
>           </cpus>
>         </cell>
>       </cells>
>     </topology>
> 2. Launch a virt-install command using cpuset. Ex:
> virt-install -d --import --connect qemu:///system --nographics
> --noautoconsole --noreboot --name=vm-2 --network
> network=default,mac=00:16:3E:A8:00:03 --ram=1024 --disk
> path=/tmp/vm-2.qcow2,device=disk,format=qcow2,size=2,cache=none  --vcpus=6
> --cpuset=18,19,20,21,22,23
> 
> 
> Actual results:
> Wed, 17 Apr 2013 14:10:22 DEBUG    Launched with command line:
> /usr/bin/virt-install -d --import --connect qemu:///system --nographics
> --noautoconsole --noreboot --name=vm-2 --network
> network=default,mac=00:16:3E:A8:00:03 --ram=1024 --disk
> path=/tmp/vm-2.qcow2,device=disk,format=qcow2,size=2,cache=none --vcpus=6
> --cpuset=18,19,20,21,22,23
> Wed, 17 Apr 2013 14:10:22 DEBUG    Requesting libvirt URI qemu:///system
> Wed, 17 Apr 2013 14:10:22 DEBUG    Received libvirt URI qemu:///system
> Wed, 17 Apr 2013 14:10:22 DEBUG    Requesting virt method 'default', hv type
> 'default'.
> Wed, 17 Apr 2013 14:10:22 DEBUG    Received virt method 'hvm'
> Wed, 17 Apr 2013 14:10:22 DEBUG    Hypervisor name is 'kvm'
> Wed, 17 Apr 2013 14:10:23 ERROR    cpuset's pCPU numbers must be less than
> pCPUs.
> Traceback (most recent call last):
>   File "/usr/bin/virt-install", line 1033, in <module>
>     main()
>   File "/usr/bin/virt-install", line 829, in main
>     cli.get_cpuset(options.cpuset, guest.memory, guest, conn)
>   File "/usr/lib/pymodules/python2.6/virtinst/cli.py", line 577, in
> get_cpuset
>     guest.cpuset = cpuset
>   File "/usr/lib/pymodules/python2.6/virtinst/Guest.py", line 278, in
> set_cpuset
>     _validate_cpuset(self.conn, val)
>   File "/usr/lib/pymodules/python2.6/virtinst/Guest.py", line 65, in
> _validate_cpuset
>     raise ValueError, _("cpuset's pCPU numbers must be less "
> ValueError: cpuset's pCPU numbers must be less than pCPUs.
> 
> 
> 
> Expected results:
> Starting the VM pinned on core 18,19,20,21,22,23
> 
> Additional info:
> None.
Hi again, 

I have run some more tests and the placement failed even with cpuset=auto

I have clone the git repository and try to investigate a bit more ..

Comment 5 Martin Kletzander 2013-05-09 06:52:41 UTC
What is the output of "virsh nodeinfo" and "python -c 'import libvirt; print libvirt.open(None).getInfo()'"?

Comment 6 Laurent Pouilloux 2013-05-09 07:19:03 UTC
(In reply to comment #5)
> What is the output of "virsh nodeinfo" and "python -c 'import libvirt; print
> libvirt.open(None).getInfo()'"?
lpouilloux@stremi-39:~$ virsh nodeinfo
CPU model:           x86_64
CPU(s):              24
CPU frequency:       1700 MHz
CPU socket(s):       2
Core(s) per socket:  6
Thread(s) per core:  1
NUMA cell(s):        1
Memory size:         47497428 KiB


lpouilloux@stremi-39:~$ python -c 'import libvirt; print libvirt.open(None).getInfo()'
['x86_64', 46384, 24, 1700, 1, 2, 6, 1]

Thank you for the answer.

Comment 7 Martin Kletzander 2013-05-09 08:22:38 UTC
This is problem of the old libvirt version, should be already fixed with commit v0.9.13-49-g80533ca

commit 80533ca25d809a2a3e81266a0acabf61a0f86ced
Author: Peter Krempa <pkrempa>
Date:   Mon Jul 9 16:57:49 2012 +0200

    nodeinfo: Fix gathering of nodeinfo data structure

Feel free to reopen if that's not the case.