display client mac addresses
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 6 Aug 2009 18:51:57 +0000 (18:51 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 6 Aug 2009 18:51:57 +0000 (18:51 +0000)
lib/PXElator/client.pm
lib/PXElator/httpd.pm

index 1c062f5..857e8e3 100644 (file)
@@ -39,4 +39,13 @@ sub conf {
        return $value;
 }
 
+sub mac {
+       my $ip = shift;
+       my $mac = client::conf( $ip, 'mac' );
+       $mac =~ s{(..)}{$1:}g;
+       $mac =~ s{:$}{};
+       $mac = qq|<tt>$mac</tt>| if (caller(1))[3] =~ m{^httpd};
+       return uc($mac);
+}
+
 1;
index 44e88cc..009fc6e 100644 (file)
@@ -106,6 +106,7 @@ sub static {
 use boolean;
 
 use kvm;
+use qemu; $pids->{qemu} = 'stopped';
 
 $SIG{CHLD} = 'IGNORE';
 
@@ -235,6 +236,7 @@ sub get_request {
                                , qq|<form method=get>|
                                , html::table( 2,
                                        'ip' => $ip,
+                                       'mac' => client::mac( $ip ),
                                        'hostname' => qq|<input type=text name=hostname value=$hostname>|,
                                        'deploy' => html::select( 'deploy', $deploy, config::available ),
                                )
@@ -251,7 +253,7 @@ sub get_request {
                                        map {
                                                my $ip = $_;
                                                $ip =~ s{^.+/ip/}{};
-                                               qq|<li><a href=/client/$ip>$ip</a></li>|
+                                               qq|<li><a href=/client/$ip>$ip</a> |, client::mac($ip), qq|</li>|;
                                        }
                                        glob("$server::conf/ip/*") 
                                )