Setting cores per vcpu

asked 2013-06-26 11:41:33 -0600

Sam W. gravatar image

Hi all,

I notice when launching an instance with multiple vcpus the kvm command looks like the following: -smp 4,sockets=4,cores=1,threads=1

Windows only supports 2 sockets (or physical cpus) Is there a way to launch an instance that has multiple cores per socket?

Thanks, Sam

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2014-02-19 11:06:07 -0600

SamYaple gravatar image

There is a solution that involves modifing /usr/share/pyshared/nova/virt/libvirt/ and /usr/share/pyshared/nova/virt/libvirt/

But this is not eloquent as it does not let you specify the cpu topology you want. It will, however, allow you to get more than 2 cpus in Windows. I wish I could give proper credit for the code, but I honestly don't remember when it came from.

What the below code will do is take the number of vcpus assigned to the VM and assign 8 cores per socket. Adding additional sockets as needed. This will only work with KVM (this is the libvirt driver we are modifying).

I would attach patches if I could.

Add the following code to /usr/share/pyshared/nova/virt/libvirt/

    guest.cpu = self.get_guest_cpu_config()

    """ New Code Start """

    numSockets = int (guest.vcpus) / 8
    numCoresRemain = int (guest.vcpus) % 8
    if numCoresRemain > 0:
            numSockets = numSockets + 1
    if numSockets > 0:
            guest.cpu.sockets = str (numSockets)
            guest.cpu.cores = '8'
            guest.cpu.sockets = '1'
            guest.cpu.cores = '8'

    """ New Code Stop """

    if 'root' in disk_mapping:

Add the following code to /usr/share/pyshared/nova/virt/libvirt/

    self.match = "exact"

    """ New Code Start """

    self.sockets = '1'
    self.cores = '8'
    self.threads = '1'

    """ New Code Stop """

 def format_dom(self):
edit flag offensive delete link more

answered 2013-07-01 19:50:22 -0600

Sam W. gravatar image

unfortunately I have yet to find an answer.


edit flag offensive delete link more

answered 2013-06-28 12:55:04 -0600

I have noticed the same behaviour, have you found a solution? Not only is it an issue with OSes that limit the number of sockets, but it plays on big role with software that is licensed differently based on sockets vs. cores.

Any advice would be appreciated

Thanks, Mark

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2013-06-26 11:41:33 -0600

Seen: 2,302 times

Last updated: Feb 19 '14