mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-23 22:50:09 +03:00
feature #1558 & #1563: Add default value for model (NIC=[model]) and for raw attributes as (RAW="raw value"), for KVM, Xen and VMware
This commit is contained in:
parent
b553c4ad53
commit
678bb84940
@ -69,7 +69,9 @@ int LibVirtDriver::deployment_description_kvm(
|
||||
string model = "";
|
||||
string ip = "";
|
||||
string filter = "";
|
||||
|
||||
string default_filter = "";
|
||||
string default_model = "";
|
||||
|
||||
const VectorAttribute * graphics;
|
||||
|
||||
@ -86,6 +88,7 @@ int LibVirtDriver::deployment_description_kvm(
|
||||
string acpi = "";
|
||||
|
||||
const VectorAttribute * raw;
|
||||
string default_raw;
|
||||
string data;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@ -438,9 +441,11 @@ int LibVirtDriver::deployment_description_kvm(
|
||||
// Network interfaces
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
get_default("NIC","FILTER",default_filter);
|
||||
get_default("NIC", "FILTER", default_filter);
|
||||
|
||||
num = vm->get_template_attribute("NIC",attrs);
|
||||
get_default("NIC", "MODEL", default_model);
|
||||
|
||||
num = vm->get_template_attribute("NIC", attrs);
|
||||
|
||||
for(int i=0; i<num; i++)
|
||||
{
|
||||
@ -484,9 +489,20 @@ int LibVirtDriver::deployment_description_kvm(
|
||||
file << "\t\t\t<script path='" << script << "'/>" << endl;
|
||||
}
|
||||
|
||||
if( !model.empty() )
|
||||
string * the_model = 0;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
file << "\t\t\t<model type='" << model << "'/>" << endl;
|
||||
the_model = &model;
|
||||
}
|
||||
else if (!default_model.empty())
|
||||
{
|
||||
the_model = &default_model;
|
||||
}
|
||||
|
||||
if (the_model != 0)
|
||||
{
|
||||
file << "\t\t\t<model type='" << *the_model << "'/>" << endl;
|
||||
}
|
||||
|
||||
if (!ip.empty() )
|
||||
@ -679,6 +695,13 @@ int LibVirtDriver::deployment_description_kvm(
|
||||
}
|
||||
}
|
||||
|
||||
get_default("RAW", default_raw);
|
||||
|
||||
if ( !default_raw.empty() )
|
||||
{
|
||||
file << "\t" << default_raw << endl;
|
||||
}
|
||||
|
||||
file << "</domain>" << endl;
|
||||
|
||||
file.close();
|
||||
|
@ -65,6 +65,8 @@ int LibVirtDriver::deployment_description_vmware(
|
||||
string script = "";
|
||||
string model = "";
|
||||
|
||||
string default_model = "";
|
||||
|
||||
const VectorAttribute * graphics;
|
||||
|
||||
string listen = "";
|
||||
@ -74,6 +76,7 @@ int LibVirtDriver::deployment_description_vmware(
|
||||
|
||||
const VectorAttribute * raw;
|
||||
string data;
|
||||
string default_raw;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@ -301,6 +304,8 @@ int LibVirtDriver::deployment_description_vmware(
|
||||
// Network interfaces
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
get_default("NIC", "MODEL", default_model);
|
||||
|
||||
num = vm->get_template_attribute("NIC",attrs);
|
||||
|
||||
for(int i=0; i<num; i++)
|
||||
@ -346,9 +351,20 @@ int LibVirtDriver::deployment_description_vmware(
|
||||
file << "\t\t\t<script path='" << script << "'/>" << endl;
|
||||
}
|
||||
|
||||
if( !model.empty() )
|
||||
string * the_model = 0;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
file << "\t\t\t<model type='" << model << "'/>" << endl;
|
||||
the_model = &model;
|
||||
}
|
||||
else if (!default_model.empty())
|
||||
{
|
||||
the_model = &default_model;
|
||||
}
|
||||
|
||||
if (the_model != 0)
|
||||
{
|
||||
file << "\t\t\t<model type='" << *the_model << "'/>" << endl;
|
||||
}
|
||||
|
||||
file << "\t\t</interface>" << endl;
|
||||
@ -437,6 +453,13 @@ int LibVirtDriver::deployment_description_vmware(
|
||||
}
|
||||
}
|
||||
|
||||
get_default("RAW", default_raw);
|
||||
|
||||
if ( !default_raw.empty() )
|
||||
{
|
||||
file << "\t" << default_raw << endl;
|
||||
}
|
||||
|
||||
file << "</domain>" << endl;
|
||||
|
||||
file.close();
|
||||
|
@ -61,6 +61,8 @@ int XenDriver::deployment_description(
|
||||
string bridge = "";
|
||||
string model = "";
|
||||
|
||||
string default_model = "";
|
||||
|
||||
const VectorAttribute * graphics;
|
||||
|
||||
string listen = "";
|
||||
@ -70,6 +72,7 @@ int XenDriver::deployment_description(
|
||||
|
||||
const VectorAttribute * raw;
|
||||
string data;
|
||||
string default_raw;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@ -331,6 +334,8 @@ int XenDriver::deployment_description(
|
||||
|
||||
num = vm->get_template_attribute("NIC",attrs);
|
||||
|
||||
get_default("NIC", "MODEL", default_model);
|
||||
|
||||
file << "vif = [" << endl;
|
||||
|
||||
for(int i=0; i<num;i++)
|
||||
@ -351,9 +356,20 @@ int XenDriver::deployment_description(
|
||||
bridge = nic->vector_value("BRIDGE");
|
||||
model = nic->vector_value("MODEL");
|
||||
|
||||
if( !model.empty() )
|
||||
string * the_model = 0;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
file << "model=" << model;
|
||||
the_model = &model;
|
||||
}
|
||||
else if (!default_model.empty())
|
||||
{
|
||||
the_model = &default_model;
|
||||
}
|
||||
|
||||
if (the_model != 0)
|
||||
{
|
||||
file << "model=" << *the_model;
|
||||
pre_char = ',';
|
||||
}
|
||||
|
||||
@ -470,6 +486,13 @@ int XenDriver::deployment_description(
|
||||
}
|
||||
}
|
||||
|
||||
get_default("RAW", default_raw);
|
||||
|
||||
if ( !default_raw.empty() )
|
||||
{
|
||||
file << default_raw << endl;
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
return 0;
|
||||
|
@ -15,14 +15,15 @@
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
# Default configuration attributes for the KVM driver
|
||||
# (all domains will use these values as defaults). These values can
|
||||
# (all domains will use these values as defaults). These values can
|
||||
# be overridden in each VM template. Valid atributes are:
|
||||
# - emulator
|
||||
# - os [kernel,initrd,boot,root,kernel_cmd,arch]
|
||||
# - vcpu
|
||||
# - features [acpi, pae]
|
||||
# - disk [driver, cache]
|
||||
# - nic [filter]
|
||||
# - nic [filter, model]
|
||||
# - raw
|
||||
|
||||
#EMULATOR = /usr/libexec/qemu-kvm
|
||||
|
||||
@ -33,4 +34,5 @@ FEATURES = [ PAE = "no", ACPI = "yes" ]
|
||||
|
||||
DISK = [ driver = "raw" , cache = "default"]
|
||||
|
||||
#NIC = [ filter = "clean-traffic" ]
|
||||
#NIC = [ filter = "clean-traffic", model="virtio" ]
|
||||
#RAW = "<devices><serial type=\"pty\"><source path=\"/dev/pts/5\"/><target port=\"0\"/></serial><console type=\"pty\" tty=\"/dev/pts/5\"><source path=\"/dev/pts/5\"/><target port=\"0\"/></console></devices>"
|
||||
|
@ -20,7 +20,8 @@
|
||||
# - vcpu
|
||||
# - os[arch]
|
||||
# - disk[dirver]
|
||||
# - datastore
|
||||
# - nic[model]
|
||||
# - raw
|
||||
|
||||
#VCPU = 1
|
||||
|
||||
|
@ -15,15 +15,19 @@
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
# Default configuration attributes for the Xen driver
|
||||
# (all domains will use these values as defaults). These values can
|
||||
# (all domains will use these values as defaults). These values can
|
||||
# be overridden in each VM template. Valid atributes are:
|
||||
# - credit
|
||||
# - os [kernel,initrd,root,kernel_cmd]
|
||||
# - vcpu
|
||||
# - disk[driver]
|
||||
# - nic[model]
|
||||
# - raw
|
||||
|
||||
#VCPU = 1
|
||||
#OS = [ kernel="/vmlinuz", initrd="/initrd.img", root="sda1", kernel_cmd="ro" ]
|
||||
|
||||
CREDIT = 256
|
||||
DISK = [ driver = "tap:aio:" ]
|
||||
|
||||
#RAW = "data=\"on_crash=destroy\""
|
||||
|
Loading…
x
Reference in New Issue
Block a user