]> git.proxmox.com Git - qemu-server.git/blame - pve-bridge
add hyper-v enlightments for windows guests
[qemu-server.git] / pve-bridge
CommitLineData
1e3baf05
DM
1#!/usr/bin/perl -w
2
3use strict;
4use PVE::QemuServer;
5use PVE::Tools qw(run_command);
9f03d50d 6use PVE::Network;
1e3baf05
DM
7
8my $iface = shift;
9
10die "no interface specified\n" if !$iface;
11
12die "got strange interface name '$iface'\n"
13 if $iface !~ m/^tap(\d+)i(\d+)$/;
14
15my $vmid = $1;
16my $netid = "net$2";
17
d691e6d3
DM
18my $migratedfrom = $ENV{PVE_MIGRATED_FROM};
19
20my $conf = PVE::QemuServer::load_config($vmid, $migratedfrom);
1e3baf05
DM
21
22die "unable to get network config '$netid'\n"
23 if !$conf->{$netid};
24
25my $net = PVE::QemuServer::parse_net($conf->{$netid});
26die "unable to parse network config '$netid'\n" if !$net;
27
56ccc25d 28PVE::Network::tap_create($iface, $net->{bridge});
1e3baf05 29
041dd2d8 30PVE::Network::tap_rate_limit($iface, $net->{rate}) if $net->{rate};
3c720aea 31
9d791466 32PVE::Network::tap_plug($iface, $net->{bridge}, $net->{tag});
1e3baf05
DM
33
34exit 0;