first try to ifup tap0 and report suggestion if it fails
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 4 Aug 2009 17:16:11 +0000 (17:16 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 4 Aug 2009 17:16:11 +0000 (17:16 +0000)
lib/PXElator/httpd.pm
lib/PXElator/kvm.pm
lib/PXElator/network.pm

index 9d72108..58051ff 100644 (file)
@@ -242,9 +242,12 @@ chain http://$server::ip:$httpd::port/
 }
 
 use browser;
+use network;
 
 sub start {
 
+       warn 'tap ', network::tap();
+
        my $server = IO::Socket::INET->new(
                        Proto     => 'tcp',
                        LocalPort => $httpd::port,
index b28f91b..299255e 100644 (file)
@@ -32,12 +32,8 @@ sub window {
        system "xdotool windowactivate `xdotool search --class kvm`"
 }
 
-use network;
-
 sub start {
 
-       warn 'tap ', network::tap();
-
        my $kvm = qq|
                vdeq kvm -m $memory_size -net nic,vlan=1,macaddr=$mac
                -net vde,vlan=1,sock=/var/run/vde2/tap0.ctl
index d8d26ea..b05919f 100644 (file)
@@ -40,9 +40,9 @@ iface tap0 inet static
                 $ifconfig =~ m{$server::ip}s && return 'up';
                system("sudo /sbin/ifconfig tap0 $server::ip netmask $server::netmask") == 0 && return "ip changed $server::ip";
                die "can't change IP address of tap0 to $server::ip";
+       } else {
+               die "bring interface up with: sudo ifup tap0\n";
        }
-       system("sudo ifup tap0") == 0                           &&      return 'started';
-       die "can't start tap0: $!";
 }
 
 1;