1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

F #1512: Do not overwrite attributes already defined in the image

This commit is contained in:
juanmont 2017-11-28 15:18:38 +01:00 committed by Ruben S. Montero
parent 5ed8aaa47b
commit 22e06f49e0

View File

@ -118,14 +118,14 @@ void Datastore::disk_attribute(
get_template_attribute("CLONE_TARGET", st);
if(!st.empty())
if(!st.empty() && disk->vector_value("CLONE_TARGET").empty())
{
disk->replace("CLONE_TARGET", st);
}
get_template_attribute("LN_TARGET", st);
if(!st.empty())
if(!st.empty() && disk->vector_value("LN_TARGET").empty())
{
disk->replace("LN_TARGET", st);
}
@ -135,13 +135,13 @@ void Datastore::disk_attribute(
current_val = disk->vector_value((*it).c_str());
get_template_attribute((*it).c_str(), inherit_val);
if ( current_val.empty() && !inherit_val.empty() )
if ( current_val.empty() && !inherit_val.empty() && disk->vector_value((*it).c_str()).empty())
{
disk->replace(*it, inherit_val);
}
}
if (disk->is_volatile())
if (disk->is_volatile() && disk->vector_value("DISK_TYPE").empty())
{
disk->replace("DISK_TYPE", Image::disk_type_to_str(get_disk_type()));
}
@ -152,7 +152,7 @@ void Datastore::disk_attribute(
{
get_template_attribute("DRIVER", st);
if(!st.empty())
if(!st.empty() && disk->vector_value("DRIVER").empty())
{
disk->replace("DRIVER", st);
}