1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-13 13:17:39 +03:00

feature #3175: Move AR attributes for SG to class constants

This commit is contained in:
Ruben S. Montero 2014-10-31 16:57:54 +01:00
parent 60d161b257
commit 62b241df28
2 changed files with 19 additions and 5 deletions

View File

@ -522,6 +522,13 @@ private:
* The restricted attributes from oned.conf
*/
static set<string> restricted_attributes;
/**
* Attributes to be process for Security Group rules
*/
const static char * SG_RULE_ATTRIBUTES[];
const static int NUM_SG_RULE_ATTRIBUTES;
};
#endif

View File

@ -1073,18 +1073,25 @@ int AddressRange::free_addr_by_range(PoolObjectSQL::ObjectType ot, int obid,
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
const char * AddressRange::SG_RULE_ATTRIBUTES[] = {
"AR_ID",
"TYPE",
"SIZE",
"MAC",
"IP"};
const int AddressRange::NUM_SG_RULE_ATTRIBUTES = 5;
void AddressRange::process_security_rule(
VectorAttribute * rule)
{
string attrs [] = {"AR_ID", "TYPE", "SIZE", "MAC", "IP"};
for ( int i = 0; i < 5; i++ )
for ( int i = 0; i < NUM_SG_RULE_ATTRIBUTES; i++ )
{
string st = attr->vector_value(attrs[i].c_str());
string st = attr->vector_value(SG_RULE_ATTRIBUTES[i]);
if ( st != "" )
{
rule->replace(attrs[i], st);
rule->replace(SG_RULE_ATTRIBUTES[i], st);
}
}
}