基于python调用libvirt API 1.程序代码 #!/usr/bin/python import libvirt import sys def createConnection(): conn = libvirt.openReadOnly(None) if conn == None: print 'Failed to open connection to QEMU/KVM' sys.exit(1) else: print '-----Connection is created succ…