Commit e20c2034 authored by Mike Hibler's avatar Mike Hibler

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 @@
#
# 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.
#
# TODO: Signal handlers for protecting db files.
......@@ -2254,13 +2254,22 @@ sub whatsmynickname()
#
# Return the hostname or IP to use for a local event server.
# Normally this is "localhost", but for virtual nodes which share an
# event server via the physical host, it may be the IP of the physical host.
# Defaults to "localhost" for most nodes or the physical host IP for Xen VMs.
# The value can be overridden on a per-host basis via a local file.
#
sub getlocalevserver()
{
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") {
$evserver = `cat $BOOTDIR/localevserver`;
chomp($evserver);
......
#!/bin/sh
#
# 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.
#
. /etc/emulab/paths.sh
......@@ -53,6 +53,16 @@ if [ -n "$interface" ]; then
echo $interface > $BOOTDIR/controlif
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
# no hostname. We don't need to record anything in this case, so skip it.
......
#!/usr/bin/perl -wT
#
# 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.
#
# Implements the libvnode API for Xen support in Emulab.
......@@ -530,21 +530,29 @@ sub vnodePreConfig($$$){
my $vnoderoot = "/mnt/xen/$vnode_id";
mysystem("mount $dev $vnoderoot");
# This is essential for libsetup to recognize us as a "genvnode"
open(FD,">$vnoderoot/var/emulab/boot/vmname")
or die "vnodePreConfig: could not open vmname for $vnode_id: $!";
print FD "$vnode_id\n";
close(FD);
# XXX this should no longer be needed, but just in case
if (! -e "$vnoderoot/var/emulab/boot/vmname" ) {
print STDERR
"libvnode_xen: WARNING: vmname not set by dhclient-exit-hook\n";
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
my (undef, $ctrlip) = findControlNet();
if (!$ctrlip || $ctrlip !~ /^(\d+\.\d+\.\d+\.\d+)$/) {
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: $!";
print FD "$ctrlip\n";
close(FD);
# Should be handled in libsetup.pm, but just in case
if (! -e "$vnoderoot/var/emulab/boot/localevserver" ) {
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);
......
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