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

B #5095: Custom NIC attributes overrides VNET (#282).

Do not modify one.conf
This commit is contained in:
Ruben S. Montero 2020-10-08 19:04:33 +02:00
parent 2d985fb581
commit 7b5b065364
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
3 changed files with 15 additions and 12 deletions

View File

@ -658,9 +658,10 @@ void Image::disk_attribute(VirtualMachineDisk * disk,
for (it = inherit_attrs.begin(); it != inherit_attrs.end(); it++)
{
string current_val = disk->vector_value(*it);
get_template_attribute(*it, inherit_val);
if (!inherit_val.empty())
if (current_val.empty() && !inherit_val.empty())
{
disk->replace(*it, inherit_val);
}

View File

@ -1266,9 +1266,10 @@ void AddressRange::set_vnet(VectorAttribute *nic, const vector<string> &inherit)
for (it = inherit.begin(); it != inherit.end(); it++)
{
string current_val = nic->vector_value(*it);
string inherit_val = attr->vector_value(*it);
if (!inherit_val.empty())
if (current_val.empty() && !inherit_val.empty())
{
nic->replace((*it).c_str(), inherit_val);
}

View File

@ -850,16 +850,6 @@ int VirtualNetwork::nic_attribute(
nic->replace("BRIDGE_TYPE", bridge_type);
}
for (it = inherit_attrs.begin(); it != inherit_attrs.end(); it++)
{
PoolObjectSQL::get_template_attribute(*it, inherit_val);
if (!inherit_val.empty())
{
nic->replace(*it, inherit_val);
}
}
//--------------------------------------------------------------------------
// Get the lease from the Virtual Network
//--------------------------------------------------------------------------
@ -899,6 +889,17 @@ int VirtualNetwork::nic_attribute(
inherit_attrs);
}
for (it = inherit_attrs.begin(); it != inherit_attrs.end(); it++)
{
string current_val = nic->vector_value(*it);
PoolObjectSQL::get_template_attribute(*it, inherit_val);
if (current_val.empty() && !inherit_val.empty())
{
nic->replace(*it, inherit_val);
}
}
//--------------------------------------------------------------------------
// Copy the security group IDs
//--------------------------------------------------------------------------