1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-03 13:47:01 +03:00

Feature #4084: Fix minor bug and error message

(cherry picked from commit 0b181da15dade8b3729ab41ec56fe9cf181a465a)
This commit is contained in:
Carlos Martín 2015-10-30 15:41:09 +01:00 committed by Tino Vazquez
parent 4a6d37cf74
commit ac8f45433e
2 changed files with 13 additions and 11 deletions

View File

@ -2084,17 +2084,18 @@ private:
*/
int get_public_clouds(set<string> &clouds) const
{
int num = get_public_clouds("PUBLIC_CLOUD", clouds);
num += get_public_clouds("EC2", clouds);
get_public_clouds("PUBLIC_CLOUD", clouds);
get_public_clouds("EC2", clouds);
return num;
return clouds.size();
};
/**
* Same as above but specifies the attribute name to handle old versions
* @param name Attribute name
* @param clouds list to store the cloud hypervisors in the template
*/
int get_public_clouds(const string& name, set<string> &clouds) const;
void get_public_clouds(const string& name, set<string> &clouds) const;
/**
* Parse the public cloud attributes and subsititue variable definition

View File

@ -4220,7 +4220,7 @@ void VirtualMachine::clear_template_monitor_error()
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int VirtualMachine::get_public_clouds(const string& pname, set<string> &clouds) const
void VirtualMachine::get_public_clouds(const string& pname, set<string> &clouds) const
{
vector<Attribute*> attrs;
vector<Attribute*>::const_iterator it;
@ -4232,7 +4232,6 @@ int VirtualMachine::get_public_clouds(const string& pname, set<string> &clouds)
if ( !attrs.empty() && pname == "EC2" )
{
clouds.insert("ec2");
return 1;
}
for (it = attrs.begin(); it != attrs.end(); it++)
@ -4251,8 +4250,6 @@ int VirtualMachine::get_public_clouds(const string& pname, set<string> &clouds)
clouds.insert(type);
}
}
return clouds.size();
}
/* -------------------------------------------------------------------------- */
@ -4276,7 +4273,9 @@ int VirtualMachine::parse_public_clouds(const char * pname, string& error)
if ( vatt == 0 )
{
error = "Wrong format for PUBLIC_CLOUD attribute";
ostringstream oss;
oss << "Wrong format for " << pname << " attribute";
error = oss.str();
rc = -1;
break;
}
@ -4285,7 +4284,9 @@ int VirtualMachine::parse_public_clouds(const char * pname, string& error)
if ( str == 0 )
{
error = "Internal error processing PUBLIC_CLOUD";
ostringstream oss;
oss << "Internal error processing " << pname;
error = oss.str();
rc = -1;
break;
}