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

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

This commit is contained in:
Pavel Czerný 2020-10-08 18:56:58 +02:00 committed by GitHub
parent 09a821df60
commit 353ac3863d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 12 deletions

View File

@ -854,6 +854,8 @@ VM_RESTRICTED_ATTR = "NIC/MAC"
VM_RESTRICTED_ATTR = "NIC/VLAN_ID"
VM_RESTRICTED_ATTR = "NIC/BRIDGE"
VM_RESTRICTED_ATTR = "NIC/FILTER"
VM_RESTRICTED_ATTR = "NIC/FILTER_IP_SPOOFING"
VM_RESTRICTED_ATTR = "NIC/FILTER_MAC_SPOOFING"
VM_RESTRICTED_ATTR = "NIC/INBOUND_AVG_BW"
VM_RESTRICTED_ATTR = "NIC/INBOUND_PEAK_BW"
VM_RESTRICTED_ATTR = "NIC/INBOUND_PEAK_KB"

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
//--------------------------------------------------------------------------