diff --git a/share/etc/oned.conf b/share/etc/oned.conf index 9fc39c6e41..8fd55313dc 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -15,6 +15,9 @@ # # PORT: Port where oned will listen for xmlrpc calls. # +# VNC_BASE_PORT: VNC ports for VMs can be automatically set to VNC_BASE_PORT + +# VMID +# # DEBUG_LEVEL: 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG #******************************************************************************* @@ -26,6 +29,8 @@ VM_POLLING_INTERVAL = 60 PORT=2633 +VNC_BASE_PORT = 5000 + DEBUG_LEVEL=3 #******************************************************************************* diff --git a/src/nebula/NebulaTemplate.cc b/src/nebula/NebulaTemplate.cc index 5dbffaf065..fa3b39ac61 100644 --- a/src/nebula/NebulaTemplate.cc +++ b/src/nebula/NebulaTemplate.cc @@ -75,6 +75,12 @@ NebulaTemplate::NebulaTemplate(string& etc_location, string& var_location) attribute = new SingleAttribute("NETWORK_SIZE",value); conf_default.insert(make_pair(attribute->name(),attribute)); + + //NETWORK_SIZE + value = "5900"; + + attribute = new SingleAttribute("VNC_BASE_PORT",value); + conf_default.insert(make_pair(attribute->name(),attribute)); //DEBUG_LEVEL value = Log::WARNING; diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index 062d9b15e0..be6c495475 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -468,10 +468,20 @@ void VirtualMachine::parse_graphics() if ( port.empty() ) { - ostringstream oss; + Nebula& nd = Nebula::instance(); - oss << ( 5900 + oid ); - graphics->replace("PORT", oss.str()); + ostringstream oss; + istringstream iss; + + int base_port; + string base_port_s; + + nd.get_configuration_attribute("VNC_BASE_PORT",base_port_s); + iss.str(base_port_s); + iss >> base_port; + + oss << ( base_port + oid ); + graphics->replace("PORT", oss.str()); } }