]> git.proxmox.com Git - qemu-server.git/blobdiff - pve-bridge
Add missing Build-Depends
[qemu-server.git] / pve-bridge
index f4ea56e8bc9e386bb615775e9642c7d62c0a6aba..64490b0a9b70278fc22e4a22c4c8007758457663 100755 (executable)
@@ -1,12 +1,19 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 
 use strict;
+use warnings;
 use PVE::QemuServer;
 use PVE::Tools qw(run_command);
 use PVE::Network;
 
 my $iface = shift;
 
+my $hotplug = 0;
+if ($iface eq '--hotplug') {
+    $hotplug = 1;
+    $iface = shift;
+}
+
 die "no interface specified\n" if !$iface;
 
 die "got strange interface name '$iface'\n" 
@@ -15,20 +22,22 @@ die "got strange interface name '$iface'\n"
 my $vmid = $1;
 my $netid = "net$2";
 
-my $migratedfrom = $ENV{PVE_MIGRATED_FROM};
+my $migratedfrom = $hotplug ? undef : $ENV{PVE_MIGRATED_FROM};
+
+my $conf = PVE::QemuConfig->load_config($vmid, $migratedfrom);
 
-my $conf = PVE::QemuServer::load_config($vmid, $migratedfrom);
+my $netconf = $conf->{$netid};
 
+$netconf = $conf->{pending}->{$netid} if !$migratedfrom && defined($conf->{pending}->{$netid}); 
 die "unable to get network config '$netid'\n"
-    if !$conf->{$netid};
+    if !defined($netconf);
 
-my $net = PVE::QemuServer::parse_net($conf->{$netid});
+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_rate_limit($iface, $net->{rate}) if $net->{rate};
-
-PVE::Network::tap_plug($iface, $net->{bridge}, $net->{tag});
+PVE::Network::tap_plug($iface, $net->{bridge}, $net->{tag}, $net->{firewall}, $net->{trunks}, $net->{rate});
 
 exit 0;