From 406877743eb3bd264eabf67bb356bd317585417b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Thu, 20 Dec 2012 18:57:20 +0100 Subject: [PATCH] Feature #1103: Finish integrating the new oned.conf att. VM_SUBMIT_ON_HOLD --- include/NebulaTemplate.h | 1 - share/etc/oned.conf | 5 +++++ src/nebula/NebulaTemplate.cc | 7 +++++++ src/template/Template.cc | 7 ++++++- src/vm/VirtualMachinePool.cc | 2 +- 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/include/NebulaTemplate.h b/include/NebulaTemplate.h index ce0510c0d1..4254d8544c 100644 --- a/include/NebulaTemplate.h +++ b/include/NebulaTemplate.h @@ -109,7 +109,6 @@ public: Template::get(_name,value); }; - // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- diff --git a/share/etc/oned.conf b/share/etc/oned.conf index 8660300863..de90413f55 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -38,6 +38,9 @@ # VMID # # DEBUG_LEVEL: 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG +# +# VM_SUBMIT_ON_HOLD: Forces VMs to be created on hold state instead of pending. +# Values: YES or NO. #******************************************************************************* #MANAGER_TIMER = 30 @@ -68,6 +71,8 @@ VNC_BASE_PORT = 5900 DEBUG_LEVEL = 3 +#VM_SUBMIT_ON_HOLD = "NO" + #******************************************************************************* # Physical Networks configuration #******************************************************************************* diff --git a/src/nebula/NebulaTemplate.cc b/src/nebula/NebulaTemplate.cc index 7a86acdda2..578d359167 100644 --- a/src/nebula/NebulaTemplate.cc +++ b/src/nebula/NebulaTemplate.cc @@ -98,6 +98,7 @@ void OpenNebulaTemplate::set_conf_default() # DB # VNC_BASE_PORT # SCRIPTS_REMOTE_DIR +# VM_SUBMIT_ON_HOLD #******************************************************************************* */ // MONITOR_INTERVAL @@ -167,6 +168,12 @@ void OpenNebulaTemplate::set_conf_default() attribute = new SingleAttribute("SCRIPTS_REMOTE_DIR",value); conf_default.insert(make_pair(attribute->name(),attribute)); + // VM_SUBMIT_ON_HOLD + value = "NO"; + + attribute = new SingleAttribute("VM_SUBMIT_ON_HOLD",value); + conf_default.insert(make_pair(attribute->name(),attribute)); + /* #******************************************************************************* # Physical Networks configuration diff --git a/src/template/Template.cc b/src/template/Template.cc index 15ddd21622..5e8725b093 100644 --- a/src/template/Template.cc +++ b/src/template/Template.cc @@ -22,6 +22,8 @@ #include #include +#define TO_UPPER(S) transform(S.begin(),S.end(),S.begin(),(int(*)(int))toupper) + /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ @@ -487,7 +489,10 @@ bool Template::get( return false; } - if ( sval == "1" || sval == "true" || sval == "YES" ) { + TO_UPPER(sval); + + if ( sval == "YES" ) + { value = true; } else diff --git a/src/vm/VirtualMachinePool.cc b/src/vm/VirtualMachinePool.cc index 5399724b43..8c40ffcd92 100644 --- a/src/vm/VirtualMachinePool.cc +++ b/src/vm/VirtualMachinePool.cc @@ -235,7 +235,7 @@ int VirtualMachinePool::allocate ( // ------------------------------------------------------------------------ vm = new VirtualMachine(-1, uid, gid, uname, gname, vm_template); - if (_submit_on_hold == true) + if ( _submit_on_hold == true || on_hold ) { vm->state = VirtualMachine::HOLD; }