mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
feature #1678: Better handling of missing configuration attributes for TM_MAD
This commit is contained in:
parent
bf25bfda13
commit
b6d1960f89
@ -148,12 +148,12 @@ int Datastore::set_tm_mad(string &tm_mad, string &error_str)
|
||||
int rc;
|
||||
string st;
|
||||
|
||||
ostringstream oss;
|
||||
|
||||
rc = Nebula::instance().get_tm_conf_attribute(tm_mad, vatt);
|
||||
|
||||
if (rc != 0)
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "TM_MAD named \"" << tm_mad << "\" is not defined in oned.conf";
|
||||
|
||||
error_str = oss.str();
|
||||
@ -167,13 +167,11 @@ int Datastore::set_tm_mad(string &tm_mad, string &error_str)
|
||||
|
||||
if (st.empty())
|
||||
{
|
||||
st = "YES";
|
||||
}
|
||||
else
|
||||
{
|
||||
one_util::toupper(st);
|
||||
goto error;
|
||||
}
|
||||
|
||||
one_util::toupper(st);
|
||||
|
||||
replace_template_attribute("SHARED", st);
|
||||
}
|
||||
else
|
||||
@ -182,30 +180,34 @@ int Datastore::set_tm_mad(string &tm_mad, string &error_str)
|
||||
|
||||
if (st.empty())
|
||||
{
|
||||
st = "NONE";
|
||||
}
|
||||
else
|
||||
{
|
||||
one_util::toupper(st);
|
||||
goto error;
|
||||
}
|
||||
|
||||
one_util::toupper(st);
|
||||
|
||||
replace_template_attribute("LN_TARGET", st);
|
||||
|
||||
st = vatt->vector_value("CLONE_TARGET");
|
||||
|
||||
if (st.empty())
|
||||
{
|
||||
st = "SYSTEM";
|
||||
}
|
||||
else
|
||||
{
|
||||
one_util::toupper(st);
|
||||
goto error;
|
||||
}
|
||||
|
||||
one_util::toupper(st);
|
||||
|
||||
replace_template_attribute("CLONE_TARGET", st);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
oss << "Attribute TM_MAD_CONF for " << tm_mad
|
||||
<< " is missing shared, ln_target or clone_target in oned.conf";
|
||||
|
||||
error_str = oss.str();
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Datastore::insert(SqlDB *db, string& error_str)
|
||||
|
Loading…
x
Reference in New Issue
Block a user