我想使用python libvirt库并行创建多个kvm桥接口。
我尝试使用python线程创建多个kvm桥接口,但是libvirt引发错误:'libvirt.libvirtError:创建桥接口virbr4时出错:文件存在'。
这是我的线程代码:
thread_count = 10
threads = list()
for xml_file in network_xml_files:
thread = threading.Thread(target=conn.networkCreateXML,
args(xml_file))
threads.append(thread)
thread.start()
if len(threads) >= thread_count:
for thread in threads:
thread.join()
threads = list()
if threads:
for thread in threads:
thread.join()