From f362e64c051564deff48f3fe608b80b3aa05e8f7 Mon Sep 17 00:00:00 2001 From: Daniel Dehennin Date: Tue, 13 Sep 2016 14:48:13 +0200 Subject: [PATCH] =?UTF-8?q?Feature=20#3510:=20authorize=20=E2=80=9CEMULATO?= =?UTF-8?q?R=E2=80=9D=20in=20VM=20TEMPLATE=20(#112)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- src/vm/VirtualMachine.cc | 12 ++++++++++++ src/vmm/LibVirtDriverKVM.cc | 10 +++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index 19702dfee3..4e4a312a55 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -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 // ------------------------------------------------------------------------ diff --git a/src/vmm/LibVirtDriverKVM.cc b/src/vmm/LibVirtDriverKVM.cc index 9a2c784a18..7f994b2171 100644 --- a/src/vmm/LibVirtDriverKVM.cc +++ b/src/vmm/LibVirtDriverKVM.cc @@ -379,11 +379,15 @@ int LibVirtDriver::deployment_description_kvm( // ------------------------------------------------------------------------ file << "\t" << 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" << one_util::escape_xml(emulator_path)