diff --git a/include/PoolObjectSQL.h b/include/PoolObjectSQL.h index 6304d6bb6c..dd6e3ab3de 100644 --- a/include/PoolObjectSQL.h +++ b/include/PoolObjectSQL.h @@ -348,23 +348,6 @@ public: return obj_template->replace(name, value); } - /** - * Adds a new attribute to the template (replacing it if - * already defined), the object's mutex SHOULD be locked - * @param name of the new attribute - * @param value of the new attribute - * @return 0 on success - */ - int replace_template_attribute( - const string& name, - const int& value) - { - ostringstream oss; - oss << value; - - return replace_template_attribute(name, oss.str()); - } - /** * Generates a XML string for the template of the Object * @param xml the string to store the XML description. diff --git a/src/template/Template.cc b/src/template/Template.cc index 79e93ae0e0..e461a4afbe 100644 --- a/src/template/Template.cc +++ b/src/template/Template.cc @@ -431,7 +431,7 @@ bool Template::get( iss >> value; - if ( iss.fail() ) + if (iss.fail() || !iss.eof()) { value = 0; return false; @@ -461,7 +461,7 @@ bool Template::get( iss >> value; - if ( iss.fail() ) + if (iss.fail() || !iss.eof()) { value = 0; return false; diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index 58649abe9f..17eaf9ca5a 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -252,23 +252,17 @@ int VirtualMachine::insert(SqlDB * db, string& error_str) goto error_memory; } - replace_template_attribute("MEMORY", ivalue); - if ( get_template_attribute("CPU", fvalue) == false || fvalue <= 0 ) { goto error_cpu; } - get_template_attribute("VCPU", value); - if ( value.empty() == false ) { if ( get_template_attribute("VCPU", ivalue) == false || ivalue <= 0 ) { goto error_vcpu; } - - replace_template_attribute("VCPU", ivalue); } // ------------------------------------------------------------------------