1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-29 18:50:08 +03:00

Improving kernel_cmd support. Now works for XEN as well.

git-svn-id: http://svn.opennebula.org/one/trunk@245 3034c82b-c49b-4eb3-8279-a7acafdc01c0
This commit is contained in:
Constantino Vázquez Blanco 2008-11-18 14:21:21 +00:00
parent 92ec8ed659
commit fdf1f01faa
5 changed files with 69 additions and 41 deletions

View File

@ -25,7 +25,7 @@ MEMORY = "amount_of_requested_MEM" # Mandatory, XEN, KVM
OS = [
kernel = "path_to_os_kernel", # XEN: Mandatory,default. KVM: Optional
initrd = "path_to_initrd_image", # XEN: Mandatory,default. KVM: Optional
kernel_cmd = "kernel_command_line", # Optional, default, KVM
kernel_cmd = "kernel_command_line", # Optional, default, KVM, XEN
root = "device to be mounted as root" # XEN: Mandatory,default. KVM: Optional
boot = "device to boot from" ] # KVM: Mandatory,default XEN: Optional

View File

@ -37,37 +37,38 @@ int LibVirtDriver::deployment_description(
int memory_in_kb = 0;
string kernel = "";
string initrd = "";
string boot = "";
string root = "";
string kernel = "";
string initrd = "";
string boot = "";
string root = "";
string kernel_cmd = "";
const VectorAttribute * disk;
const VectorAttribute * disk;
string type = "";
string target = "";
string bus = "";
string ro = "";
string type = "";
string target = "";
string bus = "";
string ro = "";
bool readonly;
const VectorAttribute * nic;
string mac = "";
string bridge = "";
string script = "";
string mac = "";
string bridge = "";
string script = "";
const VectorAttribute * graphics;
string listen = "";
string port = "";
string passwd = "";
string listen = "";
string port = "";
string passwd = "";
const VectorAttribute * input;
const VectorAttribute * features;
string pae = "";
string acpi = "";
string pae = "";
string acpi = "";
const VectorAttribute * raw;
string data;
@ -164,6 +165,7 @@ int LibVirtDriver::deployment_description(
initrd = os->vector_value("INITRD");
boot = os->vector_value("BOOT");
root = os->vector_value("ROOT");
kernel_cmd = os->vector_value("KERNEL_CMD");
}
}
@ -189,7 +191,12 @@ int LibVirtDriver::deployment_description(
if ( root.empty() )
{
get_default("OS","ROOT",root);
get_default("OS","ROOT",root);
}
if ( kernel_cmd.empty() )
{
get_default("OS","KERNEL_CMD",kernel_cmd);
}
// Start writing to the file with the info we got
@ -208,7 +215,14 @@ int LibVirtDriver::deployment_description(
if ( !root.empty() )
{
file << "\t\t<cmdline>root=/dev/" << root << " ro</cmdline>" << endl;
file << "\t\t<cmdline>root=/dev/" << root;
if (kernel_cmd.empty())
{
file << " " << kernel_cmd;
}
file << "</cmdline>" << endl;
}

View File

@ -37,27 +37,28 @@ int XenDriver::deployment_description(
float base_credit = 1.0;
float cpu_units = 1.0;
string kernel = "";
string initrd = "";
string root = "";
string kernel = "";
string initrd = "";
string root = "";
string kernel_cmd = "";
const VectorAttribute * disk;
const VectorAttribute * disk;
string target = "";
string ro = "";
string target = "";
string ro = "";
string mode;
const VectorAttribute * nic;
string mac = "";
string bridge = "";
string mac = "";
string bridge = "";
const VectorAttribute * graphics;
string type = "";
string listen = "";
string port = "";
string passwd = "";
string type = "";
string listen = "";
string port = "";
string passwd = "";
const VectorAttribute * raw;
string data;
@ -129,9 +130,10 @@ int XenDriver::deployment_description(
if ( os != 0 )
{
kernel = os->vector_value("KERNEL");
initrd = os->vector_value("INITRD");
root = os->vector_value("ROOT");
kernel = os->vector_value("KERNEL");
initrd = os->vector_value("INITRD");
root = os->vector_value("ROOT");
kernel_cmd = os->vector_value("KERNEL_CMD");
}
}
@ -149,6 +151,11 @@ int XenDriver::deployment_description(
{
get_default("OS","ROOT",root);
}
if ( kernel_cmd.empty() )
{
get_default("OS","KERNEL_CMD",kernel_cmd);
}
if ( kernel.empty() )
{
@ -165,13 +172,19 @@ int XenDriver::deployment_description(
}
else
{
file << "root = '/dev/" << root << " ro'" << endl;
file << "root = '/dev/" << root << "'" << endl;
}
if ( !initrd.empty() )
{
file << "ramdisk = '" << initrd << "'" << endl;
file << "ramdisk = '" << initrd << "'" << endl;
}
if ( !kernel_cmd.empty() )
{
file << "extra = '" << kernel_cmd << "'" << endl;
}
attrs.clear();

View File

@ -1,8 +1,8 @@
# Default configuration attributes for the KVM driver
# (all domains will use these values as defaults)
# Valid atributes are:
# - os [kernel,initrd,boot,root]
# - os [kernel,initrd,boot,root,kernel_cmd]
# - memory
#MEMORY = 128
#OS = [ kernel="/vmlinuz", initrd="/initrd.img", root="sda1", boot=hd]
#OS = [ kernel="/vmlinuz", initrd="/initrd.img", root="sda1", boot=hd,kernel_cmd="ro"]

View File

@ -2,9 +2,10 @@
# (all domains will use these values as defaults)
# Valid atributes:
# - credit
# - os [kernel,initrd,root]
# - os [kernel,initrd,root,kernel_cmd]
# - memory
#MEMORY = 128
#OS = [ kernel="/vmlinuz", initrd="/initrd.img", root="sda1" ]
#OS = [ kernel="/vmlinuz", initrd="/initrd.img", root="sda1", kernel_cmd="ro" ]
CREDIT = 256