mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-04-29 21:51:52 +00:00
sdn: use sdn tap_create|plug
Signed-off-by: Alexandre Derumier <aderumier@odiso.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
86a2e85a26
commit
28e129cccb
@ -51,6 +51,12 @@ use PVE::QemuServer::Monitor qw(mon_cmd);
|
||||
use PVE::QemuServer::PCI qw(print_pci_addr print_pcie_addr print_pcie_root_port);
|
||||
use PVE::QemuServer::USB qw(parse_usb_device);
|
||||
|
||||
my $have_sdn;
|
||||
eval {
|
||||
require PVE::Network::SDN::Zones;
|
||||
$have_sdn = 1;
|
||||
};
|
||||
|
||||
my $EDK2_FW_BASE = '/usr/share/pve-edk2-firmware/';
|
||||
my $OVMF = {
|
||||
x86_64 => [
|
||||
@ -4562,7 +4568,12 @@ sub vmconfig_update_net {
|
||||
safe_string_ne($oldnet->{trunks}, $newnet->{trunks}) ||
|
||||
safe_num_ne($oldnet->{firewall}, $newnet->{firewall})) {
|
||||
PVE::Network::tap_unplug($iface);
|
||||
PVE::Network::tap_plug($iface, $newnet->{bridge}, $newnet->{tag}, $newnet->{firewall}, $newnet->{trunks}, $newnet->{rate});
|
||||
|
||||
if ($have_sdn) {
|
||||
PVE::Network::SDN::Zones::tap_plug($iface, $newnet->{bridge}, $newnet->{tag}, $newnet->{firewall}, $newnet->{trunks}, $newnet->{rate});
|
||||
} else {
|
||||
PVE::Network::tap_plug($iface, $newnet->{bridge}, $newnet->{tag}, $newnet->{firewall}, $newnet->{trunks}, $newnet->{rate});
|
||||
}
|
||||
} elsif (safe_num_ne($oldnet->{rate}, $newnet->{rate})) {
|
||||
# Rate can be applied on its own but any change above needs to
|
||||
# include the rate in tap_plug since OVS resets everything.
|
||||
|
@ -2,10 +2,17 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PVE::QemuServer;
|
||||
use PVE::Tools qw(run_command);
|
||||
use PVE::Network;
|
||||
|
||||
my $have_sdn;
|
||||
eval {
|
||||
require PVE::Network::SDN::Zones;
|
||||
$have_sdn = 1;
|
||||
};
|
||||
|
||||
my $iface = shift;
|
||||
|
||||
my $hotplug = 0;
|
||||
@ -36,8 +43,12 @@ die "unable to get network config '$netid'\n"
|
||||
my $net = PVE::QemuServer::parse_net($netconf);
|
||||
die "unable to parse network config '$netid'\n" if !$net;
|
||||
|
||||
PVE::Network::tap_create($iface, $net->{bridge});
|
||||
|
||||
PVE::Network::tap_plug($iface, $net->{bridge}, $net->{tag}, $net->{firewall}, $net->{trunks}, $net->{rate});
|
||||
if ($have_sdn) {
|
||||
PVE::Network::SDN::Zones::tap_create($iface, $net->{bridge});
|
||||
PVE::Network::SDN::Zones::tap_plug($iface, $net->{bridge}, $net->{tag}, $net->{firewall}, $net->{trunks}, $net->{rate});
|
||||
} else {
|
||||
PVE::Network::tap_create($iface, $net->{bridge});
|
||||
PVE::Network::tap_plug($iface, $net->{bridge}, $net->{tag}, $net->{firewall}, $net->{trunks}, $net->{rate});
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
Loading…
Reference in New Issue
Block a user