Revision 229

Date:
2009/08/16 21:35:23
Author:
dpavlin
Revision Log:
use kernel bridge (named virtual) instead of vde

it's much faster, and we know all commands to use it :-)
Files:

Legend:

 
Added
 
Removed
 
Modified
  • lib/PXElator/httpd.pm

     
    24 24 <div style="font-size: 80%; color: #888">
    25 25 <a href=/>home</a>
    26 26 <a href=/server>server</a>
    27 <a href=/brctl>brctl</a>
    27 28 <a href=/ip>ip</a>
    28 29 <a href=/client>client</a>
    29 30 </div>
     
    272 273 )
    273 274 ;
    274 275 }
    276 } elsif ( $path =~ m{^/brctl} ) {
    277 print $client ok
    278 ,html::pre( `brctl show` )
    279 ;
    275 280 } elsif ( $path =~ m{^/ip/?(\w+)?} ) {
    276 281 print $client ok
    277 282 , join("\n", map { qq|<a href=/ip/$_>$_</a>| } ( qw/link addr route neigh ntable tunnel maddr mroute xfrm/ ))
     
    299 304
    300 305 sub start {
    301 306
    302 warn 'tap ', network::tap();
    307 warn 'network ', network::setup();
    303 308
    304 309 daemons::start_stop 'browser', $url;
    305 310 daemons::start_stop $_ foreach ( qw/dhcpd tftpd dnsd/ );
  • lib/PXElator/kvm.pm

     
    46 46 my $mac = sprintf('AC:DE:48:00:00:%02x', $nr);
    47 47 my $mon = port(':');
    48 48
    49 my $ifname = 'kvm0';
    50
    51 # system "ifconfig $ifname down";
    52 # system "brctl delif virtual $ifname";
    53 # system "tunctl -d $ifname";
    54
    55 system "tunctl -t $ifname"; # -u $server::user
    56 system "ifconfig $ifname up";
    57 system "brctl addif virtual $ifname";
    58
    49 59 my $kvm = qq|
    50 vdeq kvm -m $memory_size -net nic,vlan=1,macaddr=$mac
    51 -net vde,vlan=1,sock=/var/run/vde2/tap0.ctl
    60 kvm -m $memory_size -net nic,macaddr=$mac
    61 -net tap,ifname=$ifname,script=no
    52 62 -boot n
    53 63 -monitor tcp:$mon,server,nowait
    54 64 |;
    65 # -runas $server::user
    55 66 $kvm =~ s{\s+}{ }gs;
    56 67
    57 68 warn $kvm;
  • lib/PXElator/network.pm

     
    12 12 `/sbin/ifconfig $dev`
    13 13 }
    14 14
    15 sub setup {
    16
    17 if ( my $dev = $ENV{DEV} ) {
    18 warn "W: running under device $dev, not configuring network\n";
    19 return;
    20 }
    21
    22 my $ifconfig = ifconfig('virtual');
    23 if ( $ifconfig !~ m{UP} ) {
    24 system "brctl addbr virtual";
    25 system "brctl setfd virtual 0";
    26 system("/sbin/ifconfig virtual $server::ip netmask $server::netmask") == 0 || warn "W: $!";
    27 } else {
    28 warn "OK $ifconfig\n";
    29 }
    30 }
    31
    15 32 sub tap {
    16 33
    17 34 if ( my $dev = $ENV{DEV} ) {