/[pxelator]/lib/PXElator/kvm.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /lib/PXElator/kvm.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 111 - (hide annotations)
Sun Aug 2 02:20:24 2009 UTC (11 years, 7 months ago) by dpavlin
File size: 900 byte(s)
start wireshark on tap0

1 dpavlin 54 package kvm;
2    
3     use warnings;
4     use strict;
5     use autodie;
6    
7     use server;
8    
9     our $memory_size = 512;
10 dpavlin 62 our $mac = 'AC:DE:48:00:00:01'; # AC = private, AD = multicast, AE = local
11 dpavlin 80 our $monitor = 'tcp:' . $server::ip . ':10000,server,nowait';
12 dpavlin 54
13 dpavlin 111 sub start_fork { qw/monitor wireshark/ }
14 dpavlin 80
15     sub monitor {
16 dpavlin 90 exec "xterm -fg red -e nc $server::ip 10000";
17 dpavlin 80 }
18    
19 dpavlin 111 sub wireshark {
20     exec "sudo wireshark -k -i tap0";
21     }
22    
23 dpavlin 92 sub actions { qw/reset window/ }
24 dpavlin 88
25     sub reset {
26     my $sock = IO::Socket::INET->new( $server::ip .':10000' );
27     print $sock "system_reset\n";
28     close $sock;
29     }
30    
31 dpavlin 92 sub window {
32     system "xdotool windowactivate `xdotool search --class kvm`"
33     }
34    
35 dpavlin 82 use network;
36    
37 dpavlin 54 sub start {
38    
39 dpavlin 85 warn 'tap ', network::tap();
40 dpavlin 82
41 dpavlin 54 my $kvm = qq|
42     vdeq kvm -m $memory_size -net nic,vlan=1,macaddr=$mac
43     -net vde,vlan=1,sock=/var/run/vde2/tap0.ctl
44     -boot n
45 dpavlin 80 -monitor $monitor
46 dpavlin 54 |;
47 dpavlin 80 $kvm =~ s{\s+}{ }gs;
48 dpavlin 56
49 dpavlin 54 warn $kvm;
50 dpavlin 56 exec $kvm;
51 dpavlin 54
52     }
53    
54     warn 'loaded';
55    
56     1;

  ViewVC Help
Powered by ViewVC 1.1.26