Commit 4a2b75a5 authored by Leigh B Stoller's avatar Leigh B Stoller

Start a capture process on the console pty and boss.

Also fix for xl toolstack error; teardown called with no XENBUS path,
so no way to find the bridge name. But we know what it is, so add it
to the env so that vif-bridge does not croak.
parent 1c8032c7
......@@ -79,8 +79,30 @@ my $vnode_ip = shift(@ARGV);
my $vif = $ENV{'vif'};
my $XENBUS_PATH = $ENV{'XENBUS_PATH'};
my $bridge = `xenstore-read "$XENBUS_PATH/bridge"`;
#
# Well, this is interesting; we could get called with the XEN store
# gone and so not able to find the bridge. vif-bridge does the same
# thing and just ignores it! So if we cannot get, default to what
# currently think is the control network bridge.
#
if ($?) {
$bridge = "xenbr0";
# For vif-bridge
$ENV{"bridge"} = $bridge;
}
chomp($bridge);
#
# We need the domid below; we can figure that out from the XENBUS_PATH.
#
my $domid;
if ($XENBUS_PATH =~ /vif\/(\d*)\//) {
$domid = $1;
}
else {
die("Could not determine domid from $XENBUS_PATH\n");
}
my ($bossdomain) = tmccbossinfo();
die("Could not get bossname from tmcc!")
if (!defined($bossdomain));
......@@ -161,6 +183,23 @@ sub Online()
die("Failed to exec tmcc proxy");
}
# Start a capture for the serial console.
if (-e "$BINDIR/capture") {
my $tty = `xenstore-read /local/domain/$domid/console/tty`;
if (! $?) {
chomp($tty);
$tty =~ s,\/dev\/,,;
mysystem2("$BINDIR/capture -C -n -i $vnode_id $tty");
#
# We need to tell tmcd about it. But do not hang, use timeout.
#
if (! $?) {
mysystem2("$BINDIR/tmcc.bin -n $vnode_id -t 5 ".
" -f /var/log/tiplogs/$vnode_id.acl tiplineinfo");
}
}
}
# Reroute tmcd calls to the proxy on the physical host
DoIPtables("-t nat -A PREROUTING -j DNAT -p tcp ".
" --dport $TMCD_PORT -d $boss_ip -s $vnode_ip ".
......@@ -271,6 +310,12 @@ sub Offline()
mysystem2("/bin/kill $pid");
}
if (-e "/var/log/tiplogs/$vnode_id.pid") {
my $pid = `cat /var/log/tiplogs/$vnode_id.pid`;
chomp($pid);
mysystem2("/bin/kill $pid");
}
if (!SHAREDHOST()) {
DoIPtables("-t nat -D POSTROUTING -j SNAT ".
" --to-source $host_ip -s $vnode_ip -d $fs_ip,$fs_jailip ".
......
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