mirror of
				https://git.proxmox.com/git/qemu-server
				synced 2025-10-31 13:20:09 +00:00 
			
		
		
		
	 4f4fbeb048
			
		
	
	
		4f4fbeb048
		
	
	
	
	
		
			
			When using OVS tap_plug() resets rate limiting so we need to pass it along to reapply it. The rate on its own can still be hot-plugged with the regular tap_rate_limit() call.
		
			
				
	
	
		
			44 lines
		
	
	
		
			996 B
		
	
	
	
		
			Perl
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			996 B
		
	
	
	
		
			Perl
		
	
	
		
			Executable File
		
	
	
	
	
| #!/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" 
 | |
|     if $iface !~ m/^tap(\d+)i(\d+)$/;
 | |
| 
 | |
| my $vmid = $1;
 | |
| my $netid = "net$2";
 | |
| 
 | |
| my $migratedfrom = $hotplug ? undef : $ENV{PVE_MIGRATED_FROM};
 | |
| 
 | |
| my $conf = PVE::QemuConfig->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 !defined($netconf);
 | |
| 
 | |
| 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});
 | |
| 
 | |
| exit 0;
 |