mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
fix network add and change methods to handle bridge/mavctap differentation correctly.
This commit is contained in:
parent
2f1b11b3ca
commit
fa4a3149c9
2 changed files with 60 additions and 17 deletions
|
@ -25,6 +25,7 @@ from logs.views import addlogmsg
|
|||
from vrtManager import util
|
||||
from vrtManager.create import wvmCreate
|
||||
from vrtManager.instance import wvmInstances
|
||||
from vrtManager.interface import wvmInterface
|
||||
from vrtManager.storage import wvmStorage
|
||||
from vrtManager.util import randomPasswd
|
||||
|
||||
|
@ -121,6 +122,7 @@ def instance(request, pk):
|
|||
memory_host = instance.proxy.get_max_memory()
|
||||
bus_host = instance.proxy.get_disk_bus_types(instance.arch, instance.machine)
|
||||
networks_host = sorted(instance.proxy.get_networks())
|
||||
interfaces_host = sorted(instance.proxy.get_ifaces())
|
||||
nwfilters_host = instance.proxy.get_nwfilters()
|
||||
storages_host = sorted(instance.proxy.get_storages(True))
|
||||
net_models_host = instance.proxy.get_network_models()
|
||||
|
@ -904,6 +906,16 @@ def change_network(request, pk):
|
|||
(source, source_type) = utils.get_network_tuple(request.POST.get(post))
|
||||
network_data[post] = source
|
||||
network_data[post + "-type"] = source_type
|
||||
|
||||
if source_type == 'iface':
|
||||
iface = wvmInterface(
|
||||
instance.compute.hostname,
|
||||
instance.compute.login,
|
||||
instance.compute.password,
|
||||
instance.compute.type,
|
||||
source,
|
||||
)
|
||||
network_data[post + "-type"] = iface.get_type()
|
||||
elif post.startswith("net-"):
|
||||
network_data[post] = request.POST.get(post, "")
|
||||
|
||||
|
@ -923,6 +935,16 @@ def add_network(request, pk):
|
|||
nwfilter = request.POST.get("add-net-nwfilter")
|
||||
(source, source_type) = utils.get_network_tuple(request.POST.get("add-net-network"))
|
||||
|
||||
if source_type == 'iface':
|
||||
iface = wvmInterface(
|
||||
instance.compute.hostname,
|
||||
instance.compute.login,
|
||||
instance.compute.password,
|
||||
instance.compute.type,
|
||||
source,
|
||||
)
|
||||
source_type = iface.get_type()
|
||||
|
||||
instance.proxy.add_network(mac, source, source_type, nwfilter=nwfilter)
|
||||
msg = _("Add network: %(mac)s") % {"mac": mac}
|
||||
addlogmsg(request.user.username, instance.name, msg)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue