1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +03:00

Merge branch 'one-2.0' of dsa-research.org:one into one-2.0

This commit is contained in:
Tino Vázquez 2010-10-13 15:36:49 +02:00
commit dfb9114cf6
3 changed files with 29 additions and 7 deletions

View File

@ -48,7 +48,7 @@ DB = [ backend = "sqlite" ]
# passwd = "oneadmin", # passwd = "oneadmin",
# db_name = "opennebula" ] # db_name = "opennebula" ]
VNC_BASE_PORT = 5000 VNC_BASE_PORT = 5900
DEBUG_LEVEL=3 DEBUG_LEVEL=3

View File

@ -44,6 +44,10 @@ class CloudServer
@config = Configuration.new(config_file) @config = Configuration.new(config_file)
if @config[:vm_type] == nil
raise "No VM_TYPE defined."
end
@instance_types = Hash.new @instance_types = Hash.new
if @config[:vm_type].kind_of?(Array) if @config[:vm_type].kind_of?(Array)
@ -56,8 +60,9 @@ class CloudServer
# --- Start an OpenNebula Session --- # --- Start an OpenNebula Session ---
@one_client = Client.new() @one_client = Client.new(nil,@config[:one_xmlrpc])
@user_pool = UserPool.new(@one_client) @user_pool = UserPool.new(@one_client)
@img_repo = OpenNebula::ImageRepository.new @img_repo = OpenNebula::ImageRepository.new
end end
@ -123,7 +128,7 @@ class CloudServer
rc = @img_repo.create(image, template) rc = @img_repo.create(image, template)
file[:tempfile].unlink file[:tempfile].unlink
if OpenNebula.is_error?(rc) if OpenNebula.is_error?(rc)
return rc return rc
end end
@ -133,8 +138,8 @@ class CloudServer
# Finds out if a port is available on ip # Finds out if a port is available on ip
# ip:: _String_ IP address where the port to check is # ip:: _String_ IP address where the port to check is
# port:: _String_ port to find out whether is open # port:: _String_ port to find out whether is open
# [return] _Boolean_ Newly created image object # [return] _Boolean_ Newly created image object
def self.is_port_open?(ip, port) def self.is_port_open?(ip, port)
begin begin
Timeout::timeout(2) do Timeout::timeout(2) do

View File

@ -320,7 +320,7 @@ int XenDriver::deployment_description(
mac = nic->vector_value("MAC"); mac = nic->vector_value("MAC");
bridge = nic->vector_value("BRIDGE"); bridge = nic->vector_value("BRIDGE");
if( !mac.empty() ) if( !mac.empty() )
{ {
file << "mac=" << mac; file << "mac=" << mac;
@ -367,7 +367,17 @@ int XenDriver::deployment_description(
if ( !port.empty() ) if ( !port.empty() )
{ {
file << ",vncdisplay=" << port; istringstream iss(port);
int display;
iss >> display;
if ( iss.fail() || display < 5900 )
{
goto error_vncdisplay;
}
file << ",vncdisplay=" << display - 5900;
} }
if ( !passwd.empty() ) if ( !passwd.empty() )
@ -441,4 +451,11 @@ error_disk:
vm->log("VMM", Log::ERROR, "Wrong target value in DISK."); vm->log("VMM", Log::ERROR, "Wrong target value in DISK.");
file.close(); file.close();
return -1; return -1;
error_vncdisplay:
vm->log("VMM", Log::ERROR,
"Could not generate a valid xen vncdisplay number, "
"vnc port number must be equal or above 5900.");
file.close();
return -1;
} }