pf-tools commit: r706 [parmelan-guest] - in /branches/0.33-stable: debian/changelog lib/PFTools/Net.pm lib/PFTools/Update.pm tools/kvmlaunch tools/kvmlaunch-helper

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Tue Mar 31 21:56:44 UTC 2009


Author: parmelan-guest
Date: Tue Mar 31 21:56:44 2009
New Revision: 706

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=706
Log:
* WORK IN PROGRESS...
* lib/PFTools/Net.pm:
  - in cmpif(), sort eth* before bond*.
* lib/PFTools/Update.pm:
  - in Get_conf(), don't emit a Perl warning when there is no 'action'
    keyword in a config section.
* tools/kvmlaunch-helper:
  - new script.
* tools/kvmlaunch:
  - use -nographics and -monitor instead of -curses.
  - use kvmlaunch-helper to have the kvm monitor in the first screen window
    and the guest serial port in the second screen window.
  - prepend the serial console configuration to the kernel cmdline if needed.
  - new tun devices naming scheme to differentiate betwen bond0 and eth0 in
    the same guest (use guest.b0 and guest.e0 instead of just guest.0).

Added:
    branches/0.33-stable/tools/kvmlaunch-helper   (with props)
Modified:
    branches/0.33-stable/debian/changelog
    branches/0.33-stable/lib/PFTools/Net.pm
    branches/0.33-stable/lib/PFTools/Update.pm
    branches/0.33-stable/tools/kvmlaunch

Modified: branches/0.33-stable/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.33-stable/debian/changelog?rev=706&op=diff
==============================================================================
--- branches/0.33-stable/debian/changelog (original)
+++ branches/0.33-stable/debian/changelog Tue Mar 31 21:56:44 2009
@@ -1,3 +1,27 @@
+pf-tools (0.33.18-0.WIP) unstable; urgency=low
+
+  * WORK IN PROGRESS...
+
+  * lib/PFTools/Net.pm:
+    - in cmpif(), sort eth* before bond*.
+
+  * lib/PFTools/Update.pm:
+    - in Get_conf(), don't emit a Perl warning when there is no 'action'
+      keyword in a config section.
+
+  * tools/kvmlaunch-helper:
+    - new script.
+
+  * tools/kvmlaunch:
+    - use -nographics and -monitor instead of -curses.
+    - use kvmlaunch-helper to have the kvm monitor in the first screen window
+      and the guest serial port in the second screen window.
+    - prepend the serial console configuration to the kernel cmdline if needed.
+    - new tun devices naming scheme to differentiate betwen bond0 and eth0 in
+      the same guest (use guest.b0 and guest.e0 instead of just guest.0).
+
+ -- Thomas Parmelan <tom+pf-tools at ankh.fr.EU.org>  Tue, 31 Mar 2009 23:55:47 +0200
+
 pf-tools (0.33.17-1) unstable; urgency=low
 
   * conf/pf-tools.conf:

Modified: branches/0.33-stable/lib/PFTools/Net.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.33-stable/lib/PFTools/Net.pm?rev=706&op=diff
==============================================================================
--- branches/0.33-stable/lib/PFTools/Net.pm (original)
+++ branches/0.33-stable/lib/PFTools/Net.pm Tue Mar 31 21:56:44 2009
@@ -146,6 +146,11 @@
 	if ( defined $4 ) { $bv = $4 }
 	if ( defined $6 ) { $ba = $6 }
     }
+
+    # sort eth* before bond*
+    return -1 if $ai eq 'eth' and $bi eq 'bond';
+    return  1 if $ai eq 'bond' and $bi eq 'eth';
+
     ( $ai cmp $bi ) || ( $an <=> $bn ) || ( $av <=> $bv ) || ( $aa <=> $ba );
 }
 

Modified: branches/0.33-stable/lib/PFTools/Update.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.33-stable/lib/PFTools/Update.pm?rev=706&op=diff
==============================================================================
--- branches/0.33-stable/lib/PFTools/Update.pm (original)
+++ branches/0.33-stable/lib/PFTools/Update.pm Tue Mar 31 21:56:44 2009
@@ -1851,7 +1851,7 @@
     foreach $conf ( $COMMON, grep ( /^$template$/, readdir(CONFIG) ) ) {
 	my $c = Load_conf( Get_source( "GLOBAL:" . $conf ), 1 );
 	foreach ( keys %$c ) {
-	    if ( $c->{$_}->{'action'} eq 'ignore' && !defined( $C->{$_} ) ) {
+	    if ( $c->{$_}->{'action'} and $c->{$_}->{'action'} eq 'ignore' && !defined( $C->{$_} ) ) {
 		Warn( $ERR_OPEN,
 		    "ignoring previous inexistant [" . $_ . "] in " . $conf );
 	    }
@@ -1863,7 +1863,7 @@
     return $C;
 }
 
-# Enregsitre le nom de la branche utilise actuellement dans le dossier
+# Enregistre le nom de la branche utilise actuellement dans le dossier
 # PF_STATUS_DIR, le but de ce fichier est de permettre a update-config
 # retrouver la branche du CVS qu'il doit MAJ.
 sub SaveRunningBrancheName($) {

Modified: branches/0.33-stable/tools/kvmlaunch
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.33-stable/tools/kvmlaunch?rev=706&op=diff
==============================================================================
--- branches/0.33-stable/tools/kvmlaunch (original)
+++ branches/0.33-stable/tools/kvmlaunch Tue Mar 31 21:56:44 2009
@@ -185,23 +185,13 @@
 	exit 0;
     }
 
-    # TODO: prepend console=ttyS0.... to the cmdline in order to use kvm's
-    # 'monitor' mode instead of the 'curses' mode (this mode has, let's
-    # say, an "interesting" keymap) ?
-    #
-    # NB: monitor mode is good, but gives only one screen for both the kvm
-    # monitor and the vm serial console. Having a separate screen window
-    # for each of them would really rock! Unfortunately, I don't know
-    # (yet?) how to do that.
-
     my @kvm_cmd = (
 	'screen',	@screen_args,
+	'kvmlaunch-helper',
 	'kvm',
 	'-drive',	"file=$vm_disk_file,if=scsi,boot=on",
 	'-m',		$option->{'ram-size'},
 	@net_args,
-	'-curses',	'-k', 'fr',
-#	'-nographic',	'-monitor', qx{tty},
     );
 
     if ($option->{'mode'} eq 'install') {
@@ -232,12 +222,23 @@
 	# especially when connected via the "curses" or "monitor" KVM modes!
 	$cmdline =~ s{vga=normal}{fb=false}xms;
 
+	# Prepend the serial console configuration (unless there already is
+	# one) in order to use kvm's 'monitor' mode instead of the 'curses'
+	# mode (this mode has, let's say, an "interesting" keymap).
+	$cmdline =~ s{\A}{console=ttyS0,115200n8 }xms
+	    unless $cmdline =~ m{console=ttyS};
+
 	push @kvm_cmd,
 	    '-no-reboot',
 	    '-kernel',	$kernel,
 	    '-initrd',	$initrd,
 	    '-append',	$cmdline;
     }
+
+    push @kvm_cmd,
+#	'-curses',	'-k', 'fr',
+	'-nographic',
+	'-monitor'; # kvmlaunch-helper will add the correct tty name
 
     __system_or_croak(@kvm_cmd);
 }
@@ -397,12 +398,12 @@
 sub __get_virtual_ifname { my ($host, $ifname) = @_;
 
     my $IFNAMESIZ         = 16;             # <linux/if.h>
-    my $MAX_HOSTNAME_SIZE = $IFNAMESIZ - 3; # '.' + one digit + NULL
-
-    my ($iface_number) = $ifname =~ m{\A \D+ (\d+) \z}xms;
+    my $MAX_HOSTNAME_SIZE = $IFNAMESIZ - 4; # '.' + type + digit + NULL
+
+    my ($iface_type, $iface_number) = $ifname =~ m{\A (\D)\D* (\d+) \z}xms;
     my $mangled_hostname = length($host) > $MAX_HOSTNAME_SIZE ? "m-" . crc32_hex($host) : $host;
 
-    my $virtual_ifname = join '.', $mangled_hostname, $iface_number;
+    my $virtual_ifname = "$mangled_hostname.$iface_type$iface_number";
 
     return $virtual_ifname;
 }

Added: branches/0.33-stable/tools/kvmlaunch-helper
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.33-stable/tools/kvmlaunch-helper?rev=706&op=file
==============================================================================
--- branches/0.33-stable/tools/kvmlaunch-helper (added)
+++ branches/0.33-stable/tools/kvmlaunch-helper Tue Mar 31 21:56:44 2009
@@ -1,0 +1,37 @@
+#!/bin/sh
+#
+#   $Id$
+#
+
+#
+#  Copyright (C) 2009      Thomas Parmelan <tom+pf-tools at ankh.fr.EU.org>
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+
+# Original idea from Denis Bodor, see
+# http://www.lefinnois.net/wp/index.php/2007/10/14/kvm-dans-un-screen-encore-avec-le-monitor-kvm/
+
+THIS_TTY=$(tty)
+
+COMMAND="$1"
+shift
+
+echo $COMMAND "$@" $THIS_TTY
+screen -t KVM $COMMAND "$@" $THIS_TTY
+
+# keep this screen open!
+for ((;;)); do sleep 10000; done
+

Propchange: branches/0.33-stable/tools/kvmlaunch-helper
------------------------------------------------------------------------------
    svn:executable = *

Propchange: branches/0.33-stable/tools/kvmlaunch-helper
------------------------------------------------------------------------------
    svn:keywords = Id Revision




More information about the pf-tools-commits mailing list