mirror of
https://github.com/OpenNebula/one.git
synced 2025-08-24 17:49:28 +03:00
M #-: Fix possible NIC name collision (#962)
This commit is contained in:
@ -118,6 +118,15 @@ public:
|
||||
|
||||
if (!name.empty())
|
||||
{
|
||||
if (one_util::regex_match("^NIC[[:digit:]]+(_ALIAS[[:digit:]]+)?$",
|
||||
name.c_str()) == 0)
|
||||
{
|
||||
// Name collide with internal naming convention
|
||||
name = '_' + name;
|
||||
|
||||
replace("NAME", name);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
@ -141,6 +150,15 @@ public:
|
||||
|
||||
if (!name.empty())
|
||||
{
|
||||
if (one_util::regex_match("^NIC[[:digit:]]+(_ALIAS[[:digit:]]+)?$",
|
||||
name.c_str()) == 0)
|
||||
{
|
||||
// Name collide with internal naming convention
|
||||
name = '_' + name;
|
||||
|
||||
replace("NAME", name);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user