mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Bug #3168: Rollback in Datastore::post_update_template
This commit is contained in:
parent
930c13ae76
commit
24a50d6188
@ -594,12 +594,15 @@ int Datastore::post_update_template(string& error_str)
|
||||
|
||||
Image::DiskType new_disk_type;
|
||||
|
||||
DatastoreType old_ds_type;
|
||||
DatastoreType new_ds_type;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Set the TYPE of the Datastore (class & template) */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
old_ds_type = type;
|
||||
|
||||
get_template_attribute("TYPE", s_ds_type);
|
||||
|
||||
if (!s_ds_type.empty())
|
||||
@ -626,6 +629,36 @@ int Datastore::post_update_template(string& error_str)
|
||||
|
||||
replace_template_attribute("TYPE", type_to_str(type));
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Set the TM_MAD of the Datastore (class & template) */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
get_template_attribute("TM_MAD", new_tm_mad);
|
||||
|
||||
if ( !new_tm_mad.empty() )
|
||||
{
|
||||
// System DS are monitored by the TM mad, reset information
|
||||
if ( type == SYSTEM_DS && new_tm_mad != tm_mad )
|
||||
{
|
||||
update_monitor(0, 0, 0);
|
||||
}
|
||||
|
||||
if (set_tm_mad(new_tm_mad, error_str) != 0)
|
||||
{
|
||||
replace_template_attribute("TM_MAD", tm_mad);
|
||||
|
||||
type = old_ds_type;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
tm_mad = new_tm_mad;
|
||||
}
|
||||
else
|
||||
{
|
||||
replace_template_attribute("TM_MAD", tm_mad);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Set the DISK_TYPE (class & template) */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -651,13 +684,12 @@ int Datastore::post_update_template(string& error_str)
|
||||
disk_type = Image::FILE;
|
||||
}
|
||||
|
||||
get_template_attribute("DS_MAD", new_ds_mad);
|
||||
get_template_attribute("TM_MAD", new_tm_mad);
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Set the DS_MAD of the Datastore (class & template) */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
get_template_attribute("DS_MAD", new_ds_mad);
|
||||
|
||||
if ( type == SYSTEM_DS )
|
||||
{
|
||||
ds_mad = "-";
|
||||
@ -679,32 +711,6 @@ int Datastore::post_update_template(string& error_str)
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Set the TM_MAD of the Datastore (class & template) */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
if ( !new_tm_mad.empty() )
|
||||
{
|
||||
// System DS are monitored by the TM mad, reset information
|
||||
if ( type == SYSTEM_DS && new_tm_mad != tm_mad )
|
||||
{
|
||||
update_monitor(0, 0, 0);
|
||||
}
|
||||
|
||||
if (set_tm_mad(new_tm_mad, error_str) != 0)
|
||||
{
|
||||
replace_template_attribute("TM_MAD", tm_mad);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
tm_mad = new_tm_mad;
|
||||
}
|
||||
else
|
||||
{
|
||||
replace_template_attribute("TM_MAD", tm_mad);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Set the BASE_PATH of the Datastore (class & template) */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
Loading…
x
Reference in New Issue
Block a user