]> git.proxmox.com Git - qemu-server.git/blame_incremental - pve-bridge
Add a FIXME to the Q35 config to rm audio0 dev
[qemu-server.git] / pve-bridge
... / ...
CommitLineData
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use PVE::QemuServer;
6use PVE::Tools qw(run_command);
7use PVE::Network;
8
9my $iface = shift;
10
11my $hotplug = 0;
12if ($iface eq '--hotplug') {
13 $hotplug = 1;
14 $iface = shift;
15}
16
17die "no interface specified\n" if !$iface;
18
19die "got strange interface name '$iface'\n"
20 if $iface !~ m/^tap(\d+)i(\d+)$/;
21
22my $vmid = $1;
23my $netid = "net$2";
24
25my $migratedfrom = $hotplug ? undef : $ENV{PVE_MIGRATED_FROM};
26
27my $conf = PVE::QemuConfig->load_config($vmid, $migratedfrom);
28
29my $netconf = $conf->{$netid};
30
31$netconf = $conf->{pending}->{$netid} if !$migratedfrom && defined($conf->{pending}->{$netid});
32
33die "unable to get network config '$netid'\n"
34 if !defined($netconf);
35
36my $net = PVE::QemuServer::parse_net($netconf);
37die "unable to parse network config '$netid'\n" if !$net;
38
39PVE::Network::tap_create($iface, $net->{bridge});
40
41PVE::Network::tap_plug($iface, $net->{bridge}, $net->{tag}, $net->{firewall}, $net->{trunks}, $net->{rate});
42
43exit 0;