Python - libvirt
Python - libvirt
是否可以使用 libvirt-pythonAPI 从 KVM 管理程序创建 VM?
我有一个直接从云端下载的 iso。我在互联网上找不到任何示例。
干杯
确定 libvirt-python 就是为此而设计的。您只需要打开一个连接并使用格式良好的 XML.
调用 defineXML()
import libvirt
conn = libvirt.open('qemu+ssh://root@yourhost/system')
conn.defineXML(imagine_a_well_formated_domain_xml_here)
现在域已定义,您可以启动它:
dom = conn.lookupByName(the_domain_name)
dom.create() # start the domain
是否可以使用 libvirt-pythonAPI 从 KVM 管理程序创建 VM? 我有一个直接从云端下载的 iso。我在互联网上找不到任何示例。
干杯
确定 libvirt-python 就是为此而设计的。您只需要打开一个连接并使用格式良好的 XML.
调用 defineXML()import libvirt
conn = libvirt.open('qemu+ssh://root@yourhost/system')
conn.defineXML(imagine_a_well_formated_domain_xml_here)
现在域已定义,您可以启动它:
dom = conn.lookupByName(the_domain_name)
dom.create() # start the domain