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

This commit is contained in:
Pavel Czerný authored and GitHub committed 2020-10-08 19:06:20 +02:00
1 parent 069a207f54
commit a5ca150e4d
4 files changed
+20 -15

No files matched your search

+2
View File
@@ -845,6 +845,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"
+2 -1
View File
@@ -678,9 +678,10 @@ void Image::disk_attribute(VirtualMachineDisk * disk,
for (const auto& inherit : inherit_attrs)
{
string current_val = disk->vector_value(inherit);
get_template_attribute(inherit, inherit_val);
if (!inherit_val.empty())
if (current_val.empty() && !inherit_val.empty())
{
disk->replace(inherit, inherit_val);
}
+5 -4
View File
@@ -1258,13 +1258,14 @@ void AddressRange::set_vnet(VectorAttribute *nic, const vector<string> &inherit)
nic->replace("VLAN_ID", vlanid);
}
for (auto it = inherit.begin(); it != inherit.end(); it++)
for (const auto& inherited : inherit)
{
string inherit_val = attr->vector_value(*it);
string current_val = nic->vector_value(inherited);
string inherit_val = attr->vector_value(inherited);
if (!inherit_val.empty())
if (current_val.empty() && !inherit_val.empty())
{
nic->replace((*it).c_str(), inherit_val);
nic->replace(inherited, inherit_val);
}
}
}
+11 -10
View File
@@ -843,16 +843,6 @@ int VirtualNetwork::nic_attribute(
nic->replace("BRIDGE_TYPE", bridge_type);
}
for (const auto& inherited : inherit_attrs)
{
PoolObjectSQL::get_template_attribute(inherited, inherit_val);
if (!inherit_val.empty())
{
nic->replace(inherited, inherit_val);
}
}
//--------------------------------------------------------------------------
// Get the lease from the Virtual Network
//--------------------------------------------------------------------------
@@ -892,6 +882,17 @@ int VirtualNetwork::nic_attribute(
inherit_attrs);
}
for (const auto& inherited : inherit_attrs)
{
string current_val = nic->vector_value(inherited);
PoolObjectSQL::get_template_attribute(inherited, inherit_val);
if (current_val.empty() && !inherit_val.empty())
{
nic->replace(inherited, inherit_val);
}
}
//--------------------------------------------------------------------------
// Copy the security group IDs
//--------------------------------------------------------------------------