1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-19 06:50:07 +03:00

Feature #3510: authorize “EMULATOR” in VM TEMPLATE (#112)

* src/vm/VirtualMachine.cc (insert): Add “EMULATOR” to the list of
  VM attributes understood by opennebula.

* src/vmm/LibVirtDriverKVM.cc (deployment_description_kvm): Get
  “EMULATOR” from VM template first, then from default and finally from
  hardcoded path.

Thanks Vladislav Gorbunov for the patch
This commit is contained in:
Daniel Dehennin 2016-09-13 14:48:13 +02:00 committed by Ruben S. Montero
parent ecc8be7c20
commit f362e64c05
2 changed files with 19 additions and 3 deletions

View File

@ -471,6 +471,18 @@ int VirtualMachine::insert(SqlDB * db, string& error_str)
goto error_public;
}
// ------------------------------------------------------------------------
// Check for EMULATOR attribute
// ------------------------------------------------------------------------
user_obj_template->get("EMULATOR", value);
if (!value.empty())
{
user_obj_template->erase("EMULATOR");
obj_template->add("EMULATOR", value);
}
// ------------------------------------------------------------------------
// Check for CPU, VCPU and MEMORY attributes
// ------------------------------------------------------------------------

View File

@ -379,11 +379,15 @@ int LibVirtDriver::deployment_description_kvm(
// ------------------------------------------------------------------------
file << "\t<devices>" << endl;
get_default("EMULATOR",emulator_path);
vm->get_template_attribute("EMULATOR", emulator_path);
if(emulator_path.empty())
{
emulator_path = "/usr/bin/kvm";
get_default("EMULATOR",emulator_path);
if(emulator_path.empty())
{
emulator_path = "/usr/bin/kvm";
}
}
file << "\t\t<emulator>" << one_util::escape_xml(emulator_path)