1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 23:25:24 +00:00

fix macvtap network list

This commit is contained in:
catborise 2020-07-20 14:52:55 +03:00
parent de63d9746d
commit 46884304b0
2 changed files with 8 additions and 3 deletions

View file

@ -1342,8 +1342,8 @@ class wvmInstance(wvmConnect):
net_source_type = network_data.get('net-source-' + str(num) + '-type')
net_filter = network_data.get('net-nwfilter-' + str(num))
net_model = network_data.get('net-model-' + str(num))
bridge_name = self.get_bridge_name(net_source, net_source_type)
if interface.get('type') == 'bridge':
bridge_name = self.get_bridge_name(net_source, net_source_type)
source = interface.find('mac')
source.set('address', net_mac)
source = interface.find('source')

View file

@ -1,4 +1,5 @@
from lxml import etree
from libvirt import libvirtError
from libvirt import VIR_NETWORK_SECTION_IP_DHCP_HOST
from libvirt import VIR_NETWORK_UPDATE_COMMAND_ADD_LAST, VIR_NETWORK_UPDATE_COMMAND_DELETE, VIR_NETWORK_UPDATE_COMMAND_MODIFY
from libvirt import VIR_NETWORK_UPDATE_AFFECT_LIVE, VIR_NETWORK_UPDATE_AFFECT_CONFIG
@ -32,7 +33,11 @@ class wvmNetworks(wvmConnect):
for network in get_networks:
net = self.get_network(network)
net_status = net.isActive()
try:
net_bridge = net.bridgeName()
except libvirtError:
net_bridge = util.get_xml_path(net.XMLDesc(0), "/network/forward/interface/@dev")
net_forward = util.get_xml_path(net.XMLDesc(0), "/network/forward/@mode")
networks.append({'name': network, 'status': net_status,
'device': net_bridge, 'forward': net_forward})
@ -114,7 +119,7 @@ class wvmNetwork(wvmConnect):
try:
return self.net.bridgeName()
except:
return None
return util.get_xml_path(self._XMLDesc(0), "/network/forward/interface/@dev")
def start(self):
self.net.create()