[libvirt-users] Proper XML for compareCPU method

David Ashley w.david.ashley at gmail.com
Sun Aug 7 19:43:27 UTC 2016


All -

What is the proper XML to supply to the Python Connections compareCPU 
method? I have looked at the cpu_map.xml file and I believe I have the 
proper XML configured but the method always throws an exception with a 
missing CPU architecture error. Here is the code.

from __future__ import print_function
import sys
import libvirt

conn = libvirt.open('qemu:///system')
if conn == None:
     print('Failed to open connection to qemu:///system', file=sys.stderr)
     exit(1)

retc = conn.compareCPU('<cpu><arch name="x86"><model 
name="kvm64"/></arch></cpu>')

if retc == -1:
     print("CPUs are not the same.")
else:
     print("CPUs are the same.")

conn.close()
exit(0)

This probably just a simple error on my part but I have tried more that 
a few permutations of the XML with no success. So I guess I need some 
help with this.

Thanks,
David Ashley




More information about the libvirt-users mailing list