From 49cb0f2da9ecafc38d067d9eabb5ba11950ce9d2 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Fri, 7 Mar 2014 13:10:57 +0100 Subject: [PATCH] Feature #2749: Add localhost address to default zone --- src/zone/ZonePool.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/zone/ZonePool.cc b/src/zone/ZonePool.cc index aa001448ca..0b07ba498b 100644 --- a/src/zone/ZonePool.cc +++ b/src/zone/ZonePool.cc @@ -17,6 +17,9 @@ #include "ZonePool.h" #include "NebulaLog.h" #include "Nebula.h" +#include +#include +#include /* -------------------------------------------------------------------------- */ @@ -35,6 +38,14 @@ ZonePool::ZonePool(SqlDB * db, bool is_federation_slave) return; } + string one_port; + Nebula& nd = Nebula::instance(); + nd.get_configuration_attribute("PORT", one_port); + + ostringstream zone_tmpl; + zone_tmpl << "NAME=OpenNebula\n" + << "ENDPOINT=http://localhost:" << one_port << "/RPC2"; + //lastOID is set in PoolSQL::init_cb if (get_lastOID() == -1) { @@ -44,8 +55,7 @@ ZonePool::ZonePool(SqlDB * db, bool is_federation_slave) // Build the local zone tmpl = new Template; rc = tmpl->parse_str_or_xml( - "NAME = OpenNebula\n" - "ENDPOINT = -", + zone_tmpl.str(), error_str); if( rc < 0 )