Ask Your Question

# Revision history [back]

There is a solution that involves modifing /usr/share/pyshared/nova/virt/libvirt/config.py and /usr/share/pyshared/nova/virt/libvirt/driver.py

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/driver.py

    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'
else:
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/config.py

    self.match = "exact"

""" New Code Start """

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

""" New Code Stop """

def format_dom(self):