1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

feature #538: Changes using the new split function.

This commit is contained in:
Ruben S. Montero 2013-11-20 17:18:06 +01:00
parent e5114aac33
commit 0cee3d7ac0
3 changed files with 73 additions and 2 deletions

View File

@ -47,6 +47,8 @@ int LibVirtDriver::deployment_description_kvm(
string bootloader = "";
string arch = "";
vector<string> boots;
const VectorAttribute * disk;
const VectorAttribute * context;
@ -261,8 +263,12 @@ int LibVirtDriver::deployment_description_kvm(
file << "\t\t<bootloader>" << bootloader << "</bootloader>" << endl;
}
boots = one_util::split(boot, ',');
file << "\t\t<boot dev='" << boot << "'/>" << endl;
for (vector<string>::const_iterator it=boots.begin(); it!=boots.end(); it++)
{
file << "\t\t<boot dev='" << *it << "'/>" << endl;
}
file << "\t</os>" << endl;

View File

@ -46,6 +46,9 @@ int LibVirtDriver::deployment_description_vmware(
string arch = "";
string guestOS = "";
string pciBridge = "";
string boot = "";
vector<string> boots;
const VectorAttribute * features;
@ -156,6 +159,7 @@ int LibVirtDriver::deployment_description_vmware(
{
arch = os->vector_value("ARCH");
guestOS = os->vector_value("GUESTOS");
boot = os->vector_value("BOOT");
}
}
@ -174,12 +178,27 @@ int LibVirtDriver::deployment_description_vmware(
metadata << "<guestos>" << guestOS << "</guestos>" << endl;
}
if ( boot.empty() )
{
get_default("OS","BOOT",boot);
}
// Start writing to the file with the info we got
file << "\t<os>" << endl;
file << "\t\t<type arch='" << arch << "'>hvm</type>" << endl;
if (!boot.empty())
{
boots = one_util::split(boot, ',');
for (vector<string>::const_iterator it=boots.begin(); it!=boots.end(); it++)
{
file << "\t\t<boot dev='" << *it << "'/>" << endl;
}
}
file << "\t</os>" << endl;
attrs.clear();

View File

@ -43,7 +43,10 @@ int XenDriver::deployment_description(
string root = "";
string kernel_cmd = "";
string bootloader = "";
string hvm = "";
string hvm = "";
string boot = "";
vector<string> boots;
const VectorAttribute * disk;
const VectorAttribute * context;
@ -158,6 +161,7 @@ int XenDriver::deployment_description(
kernel_cmd = os->vector_value("KERNEL_CMD");
bootloader = os->vector_value("BOOTLOADER");
hvm = os->vector_value("HVM");
boot = os->vector_value("BOOT");
}
}
@ -217,6 +221,43 @@ int XenDriver::deployment_description(
else //No kernel & no bootloader use hvm
{
file << "builder = \"hvm\"" << endl;
if ( !boot.empty() )
{
file << "boot = \"";
boots = one_util::split(boot, ',');
for (vector<string>::const_iterator it=boots.begin(); it!=boots.end(); it++)
{
string boot_option = *it;
one_util::tolower(boot_option);
if ( boot_option == "hd" )
{
file << "c";
}
else if ( boot_option == "fd" )
{
file << "a";
}
else if ( boot_option == "cdrom" )
{
file << "d";
}
else if ( boot_option == "network" )
{
file << "n";
}
else
{
goto error_boot;
}
}
file << "\"" << endl;
}
}
attrs.clear();
@ -521,6 +562,11 @@ error_file:
vm->log("VMM", Log::ERROR, "Could not open Xen deployment file.");
return -1;
error_boot:
vm->log("VMM", Log::ERROR, "Boot option not supported.");
file.close();
return -1;
error_memory:
vm->log("VMM", Log::ERROR, "No memory defined and no default provided.");
file.close();