def create_virtual_network(template):
LI('Begin to create virtual network %s' % template)
output = commands.getoutput('cat %s' % template)
conn = libvirt.open('qemu:///system')
network = conn.networkDefineXML(output)
if network is None:
err_exit('Failed to define a virtual network %s' % template)
network.create() # set the network active
network.setAutostart(1)
conn.close()
LI('Virtual network %s is created' % network.name())
return network.name()
评论列表
文章目录