[PVE-User] Proposal to increase vmbr limit to 4094

Derek W. Poon derekp+pve at ece.ubc.ca
Fri Apr 23 01:35:17 CEST 2010


On 2010-04-21, at 1:36 AM, Dietmar Maurer wrote:

> OK, I added that. But displaying 4095 entries in a combobox is too
> much for IE - the GUI is quite slow. Any better idea how to select the bridge?


I suppose the dropdown box should become a text field instead.  Here is the same patch with that UI change and tougher validation.

Derek


diff -urN usr/share/pve-manager/root/system/index.htm /usr/share/pve-manager/root/system/index.htm
--- usr/share/pve-manager/root/system/index.htm	2010-02-23 05:32:28.000000000 -0800
+++ /usr/share/pve-manager/root/system/index.htm	2010-04-22 16:20:22.000000000 -0700
@@ -61,10 +61,4 @@
  my $changes = $cdata->{changes};
 
- my $bridge_avail;
- for (my $i = 0; $i < 1000; $i++) {
-   if (!defined ($ifaces->{"vmbr$i"})) {
-     push @$bridge_avail, "vmbr$i";
-   }
- }
  my $bond_avail;
  for (my $i = 0; $i < 10; $i++) {
@@ -127,4 +121,11 @@
      check_write_mode ($udat{AM});
 
+     unless ($fdat{edit} == 1) {
+       # Creating new interface; normalize interface name
+       $iface =~ s/^(bond|vmbr)0*([0-9]+)$/$1$2/;
+
+       die "Device $iface already exists" if $ifaces->{$iface};
+     }
+
      my $newif;
      if (!($fdat{address} && $fdat{address} ne '127.0.0.1' &&
@@ -149,5 +150,6 @@
 
 
-     if ($iface =~ m/^vmbr[0-9]{1,3}$/) {
+     my $br_num;
+     if ((($br_num) = $iface =~ m/^vmbr([0-9]{1,4})$/) && $br_num < 4095) {
        #$ifaces->{$iface}->{autostart} = 1;
        $ifaces->{$iface}->{'bridge_ports'} = {};
@@ -192,4 +194,6 @@
        }
 
+     } else {
+       die "invalid interface name for bridge or bonding device";
      }
 
@@ -250,8 +254,8 @@
    if ($fdat{edit} == 2) {
      if ($fdat{itype} eq 'bridge') {
-       die "no more free bridges\n" if !$bridge_avail;
-
        $grid->add_row (__("Bridge name") . ':',
-		       $form->create_element ('iface', 'dropdown', undef, $bridge_avail));
+		       $form->create_element ('iface', 'text', 'vmbr'));
+       $grid->add_row (undef,
+		       __("Allowable bridge names: <tt>vmbr</tt><i>n</i>, where 0 &#x2264; <i>n</i> &#x2264; 4094"));
 
      } elsif ($fdat{itype} eq 'bond') {
@@ -367,5 +371,5 @@
    if ($iface =~ m/^eth(\d)$/) {
      next if device_is_used ($ifaces, $iface);
-   } elsif ($iface =~ m/^vmbr[0-9]{1,3}$/) {
+   } elsif ($iface =~ m/^vmbr[0-9]{1,4}$/) {
    } elsif ($iface =~ m/^bond[0-9]$/) {
    } else {
diff -urN usr/sbin/qm /usr/sbin/qm
--- usr/sbin/qm	2010-01-10 23:32:12.000000000 -0800
+++ /usr/sbin/qm	2010-04-20 16:14:38.000000000 -0700
@@ -929,7 +929,7 @@

XX:XX:XX:XX:XX:XX should be an unique MAC address

-=item vlan[1-999]: MODEL=XX:XX:XX:XX:XX:XX[,MODEL=YY:YY:YY:YY:YY:YY]
+=item vlan[1-4094]: MODEL=XX:XX:XX:XX:XX:XX[,MODEL=YY:YY:YY:YY:YY:YY]

Same as vlan0, but vlanX is bridged to vmbrX

diff -urN usr/share/perl5/PVE/QemuServer.pm /usr/share/perl5/PVE/QemuServer.pm
--- usr/share/perl5/PVE/QemuServer.pm	2010-01-10 23:32:12.000000000 -0800
+++ /usr/share/perl5/PVE/QemuServer.pm	2010-04-20 15:46:50.000000000 -0700
@@ -166,7 +166,7 @@
my $MAX_IDE_DISKS = 4;
my $MAX_SCSI_DISKS = 16;
my $MAX_VIRTIO_DISKS = 16;
-my $MAX_VLANS = 1000;
+my $MAX_VLANS = 4095;

for (my $i = 0; $i < $MAX_VLANS; $i++)  {
    $confvars->{"vlan$i"} = 'vlan';
diff -urN usr/share/perl5/PVE/Utils.pm /usr/share/perl5/PVE/Utils.pm
--- usr/share/perl5/PVE/Utils.pm	2010-02-23 05:32:28.000000000 -0800
+++ /usr/share/perl5/PVE/Utils.pm	2010-04-20 13:45:43.000000000 -0700
@@ -634,7 +634,7 @@
    if ($fd2 = IO::File->new ("/proc/net/dev", "r")) {
	while (defined ($line = <$fd2>)) {
	    chomp ($line);
-	    if ($line =~ m/^\s*(vmbr([0-9]{1,3})):.*/) {
+	    if ($line =~ m/^\s*(vmbr([0-9]{1,4})):.*/) {
		my ($name, $num) = ($1, $2);
		push @$res, $name if int($num) eq $num; # no leading zero
	    }
diff -urN usr/share/pve-manager/root/qemu/hardware.htm /usr/share/pve-manager/root/qemu/hardware.htm
--- usr/share/pve-manager/root/qemu/hardware.htm	2010-02-23 05:32:28.000000000 -0800
+++ /usr/share/pve-manager/root/qemu/hardware.htm	2010-04-20 15:42:20.000000000 -0700
@@ -423,7 +423,7 @@
     my $bridges = PVE::Utils::get_bridges ();
     my $brg;
     foreach my $bn (@$bridges) {
-       if ($bn =~ m/^vmbr([0-9]{1,3})$/) {
+       if ($bn =~ m/^vmbr([0-9]{1,4})$/) {
	 push @$brg, [ "vlan$1", $bn ];
       }
     }
diff -urN usr/share/pve-manager/root/vmlist/create.htm /usr/share/pve-manager/root/vmlist/create.htm
--- usr/share/pve-manager/root/vmlist/create.htm	2010-02-23 05:32:28.000000000 -0800
+++ /usr/share/pve-manager/root/vmlist/create.htm	2010-04-20 15:14:45.000000000 -0700
@@ -362,7 +362,7 @@

   my $brg;
   foreach my $bn (@$bridges) {
-     if ($bn =~ m/^vmbr([0-9]{1,3})$/) {
+     if ($bn =~ m/^vmbr([0-9]{1,4})$/) {
       push @$brg, [ "vlan$1", "vmbr$1" ];
     }
   }


More information about the pve-user mailing list