Commit e20c2034 authored by Mike Hibler's avatar Mike Hibler
Browse files

Lovely, lovely hacks for BSD based Xen vnodes.

In dhclient-exit-hooks we stash the vnode name in $BOOTDIR/vmname where
libsetup would expect it.

In libsetup.pm we set the event server to the physical host (based on
node names!)

In libvnode_xen.pm we reflect that these hacks are now done elsewhere!
parent ee7974ab
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2009 University of Utah and the Flux Group. # Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
# TODO: Signal handlers for protecting db files. # TODO: Signal handlers for protecting db files.
...@@ -2254,13 +2254,22 @@ sub whatsmynickname() ...@@ -2254,13 +2254,22 @@ sub whatsmynickname()
# #
# Return the hostname or IP to use for a local event server. # Return the hostname or IP to use for a local event server.
# Normally this is "localhost", but for virtual nodes which share an # Defaults to "localhost" for most nodes or the physical host IP for Xen VMs.
# event server via the physical host, it may be the IP of the physical host. # The value can be overridden on a per-host basis via a local file.
# #
sub getlocalevserver() sub getlocalevserver()
{ {
my $evserver = "localhost"; my $evserver = "localhost";
if (INXENVM()) {
#
# XXX gawdawful hack alert!
# Will only work with Utah naming convention.
#
if ($vnodeid =~ /^pcvm(\d+)-\d+$/) {
$evserver = "pc$1";
}
}
if (-e "$BOOTDIR/localevserver") { if (-e "$BOOTDIR/localevserver") {
$evserver = `cat $BOOTDIR/localevserver`; $evserver = `cat $BOOTDIR/localevserver`;
chomp($evserver); chomp($evserver);
......
#!/bin/sh #!/bin/sh
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2009 University of Utah and the Flux Group. # Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
. /etc/emulab/paths.sh . /etc/emulab/paths.sh
...@@ -53,6 +53,16 @@ if [ -n "$interface" ]; then ...@@ -53,6 +53,16 @@ if [ -n "$interface" ]; then
echo $interface > $BOOTDIR/controlif echo $interface > $BOOTDIR/controlif
fi fi
#
# For Xen-based vnodes we record the vnode name where the scripts expect it.
# XXX this works because only Xen-based vnodes DHCP.
#
case "$new_host_name" in
pcvm*)
echo $new_host_name > $BOOTDIR/vmname
;;
esac
# #
# If this is a newnode boot, boss (inner or outer) will have returned with # If this is a newnode boot, boss (inner or outer) will have returned with
# no hostname. We don't need to record anything in this case, so skip it. # no hostname. We don't need to record anything in this case, so skip it.
......
#!/usr/bin/perl -wT #!/usr/bin/perl -wT
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2008-2009 University of Utah and the Flux Group. # Copyright (c) 2008-2010 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
# Implements the libvnode API for Xen support in Emulab. # Implements the libvnode API for Xen support in Emulab.
...@@ -530,21 +530,29 @@ sub vnodePreConfig($$$){ ...@@ -530,21 +530,29 @@ sub vnodePreConfig($$$){
my $vnoderoot = "/mnt/xen/$vnode_id"; my $vnoderoot = "/mnt/xen/$vnode_id";
mysystem("mount $dev $vnoderoot"); mysystem("mount $dev $vnoderoot");
# This is essential for libsetup to recognize us as a "genvnode" # XXX this should no longer be needed, but just in case
open(FD,">$vnoderoot/var/emulab/boot/vmname") if (! -e "$vnoderoot/var/emulab/boot/vmname" ) {
or die "vnodePreConfig: could not open vmname for $vnode_id: $!"; print STDERR
print FD "$vnode_id\n"; "libvnode_xen: WARNING: vmname not set by dhclient-exit-hook\n";
close(FD); open(FD,">$vnoderoot/var/emulab/boot/vmname")
or die "vnodePreConfig: could not open vmname for $vnode_id: $!";
print FD "$vnode_id\n";
close(FD);
}
# Use the physical host pubsub daemon # Use the physical host pubsub daemon
my (undef, $ctrlip) = findControlNet(); my (undef, $ctrlip) = findControlNet();
if (!$ctrlip || $ctrlip !~ /^(\d+\.\d+\.\d+\.\d+)$/) { if (!$ctrlip || $ctrlip !~ /^(\d+\.\d+\.\d+\.\d+)$/) {
die "vnodePreConfig: could not get control net IP for $vnode_id"; die "vnodePreConfig: could not get control net IP for $vnode_id";
} }
open(FD,">$vnoderoot/var/emulab/boot/localevserver")
or die "vnodePreConfig: could not open localevserver for $vnode_id: $!"; # Should be handled in libsetup.pm, but just in case
print FD "$ctrlip\n"; if (! -e "$vnoderoot/var/emulab/boot/localevserver" ) {
close(FD); open(FD,">$vnoderoot/var/emulab/boot/localevserver")
or die "vnodePreConfig: could not open localevserver for $vnode_id: $!";
print FD "$ctrlip\n";
close(FD);
}
my $ret = &$callback($vnoderoot); my $ret = &$callback($vnoderoot);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment