Backport from master, to make sure console-proxy always gets correct public.network.device

This commit is contained in:
edison 2010-09-02 19:58:49 -07:00
parent 9dc48bbdbb
commit 8eaeb5111c
2 changed files with 21 additions and 6 deletions

View File

@ -188,9 +188,6 @@ newhost = raw_input().strip()
if newhost: host = newhost
confopts["host"] = host
confopts["private.network.device"] = dev
confopts["public.network.device"] = dev
for opt,val in confopts.items():
line = "=".join([opt,val])
if opt not in confposes: lines.append(line)
@ -204,12 +201,16 @@ stderr("")
stderr("Cloud Console Proxy setup completed successfully")
stderr("Starting the Cloud Console Proxy")
try:
m = service("@PACKAGE@-console-proxy","stop")
print m.stdout + m.stderr
except CalledProcessError,e:
print e.stdout + e.stderr
try:
m = service("@PACKAGE@-console-proxy","start")
print m.stdout + m.stderr
except CalledProcessError,e:
print e.stdout + e.stderr
bail(E_CPFAILEDTOSTART,"@PACKAGE@-console-proxy failed to start")
# FIXMES: 1) nullify networkmanager on ubuntu (asking the user first) and enable the networking service permanently

View File

@ -23,6 +23,20 @@ cd "@CPLIBDIR@"
echo Current directory is "$PWD"
echo CLASSPATH to run the agent: "$CLASSPATH"
export PATH=/sbin:/usr/sbin:"$PATH"
SERVICEARGS=
for x in private public ; do
configuration=`grep -q "^$x.network.device" "@CPSYSCONFDIR@"/agent.properties || true`
if [ -n "$CONFIGURATION" ] ; then
echo "Using manually-configured network device $CONFIGURATION"
else
defaultroute=`ip route | grep ^default | cut -d ' ' -f 5`
test -n "$defaultroute"
echo "Using auto-discovered network device $defaultroute which is the default route"
SERVICEARGS="$SERVICEARGS $x.network.device="$defaultroute
fi
done
function termagent() {
if [ "$agentpid" != "" ] ; then
echo Killing VMOps Console Proxy "(PID $agentpid)" with SIGTERM >&2
@ -38,7 +52,7 @@ function termagent() {
trap termagent TERM
while true ; do
java -Xms128M -Xmx384M -cp "$CLASSPATH" "$@" com.cloud.agent.AgentShell &
java -Xms128M -Xmx384M -cp "$CLASSPATH" "$@" com.cloud.agent.AgentShell $SERVICEARGS &
agentpid=$!
echo "Console Proxy started. PID: $!" >&2
wait $agentpid