--- PVE/QemuServer.pm | 12 +++++++++++- vm-network-scripts/pve-bridge | 15 ++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 0a0475b..d1cda70 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -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 => [ @@ -4582,7 +4588,11 @@ 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. diff --git a/vm-network-scripts/pve-bridge b/vm-network-scripts/pve-bridge index 64490b0..fa84507 100755 --- a/vm-network-scripts/pve-bridge +++ b/vm-network-scripts/pve-bridge @@ -5,6 +5,11 @@ 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; @@ -36,8 +41,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; -- 2.20.1 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel