mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-20 03:42:52 +09:00
(cherry picked from commit a3d4d35340)
This commit is contained in:
1 parent
099d7bc5f3
commit
0db63e538d
1 file changed
+37
-33
@@ -40,6 +40,40 @@ static const History::VMAction action[15] = {
|
||||
|
||||
const ActionSet<History::VMAction> VirtualRouter::SUPPORTED_ACTIONS(action, 15);
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
static void vrouter_prefix(VectorAttribute* nic, const string& attr)
|
||||
{
|
||||
string val;
|
||||
|
||||
if (nic->vector_value(attr.c_str(), val) == 0)
|
||||
{
|
||||
nic->remove(attr);
|
||||
nic->replace("VROUTER_"+attr, val);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
static void prepare_nic_vm(VectorAttribute * nic)
|
||||
{
|
||||
bool floating = false;
|
||||
nic->vector_value("FLOATING_IP", floating);
|
||||
|
||||
if (floating)
|
||||
{
|
||||
vrouter_prefix(nic, "MAC");
|
||||
vrouter_prefix(nic, "IP");
|
||||
vrouter_prefix(nic, "IP6_LINK");
|
||||
vrouter_prefix(nic, "IP6_ULA");
|
||||
vrouter_prefix(nic, "IP6_GLOBAL");
|
||||
|
||||
// TODO: remove all other attrs, such as AR, BRIDGE, etc?
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* ************************************************************************ */
|
||||
/* VirtualRouter :: Constructor/Destructor */
|
||||
/* ************************************************************************ */
|
||||
@@ -209,6 +243,9 @@ int VirtualRouter::get_network_leases(string& estr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
prepare_nic_vm(nics[i]);
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -434,39 +471,6 @@ int VirtualRouter::release_network_leases(const VectorAttribute * nic)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void vrouter_prefix(VectorAttribute* nic, const string& attr)
|
||||
{
|
||||
string val;
|
||||
|
||||
if (nic->vector_value(attr.c_str(), val) == 0)
|
||||
{
|
||||
nic->remove(attr);
|
||||
nic->replace("VROUTER_"+attr, val);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
static void prepare_nic_vm(VectorAttribute * nic)
|
||||
{
|
||||
bool floating = false;
|
||||
nic->vector_value("FLOATING_IP", floating);
|
||||
|
||||
if (floating)
|
||||
{
|
||||
vrouter_prefix(nic, "MAC");
|
||||
vrouter_prefix(nic, "IP");
|
||||
vrouter_prefix(nic, "IP6_LINK");
|
||||
vrouter_prefix(nic, "IP6_ULA");
|
||||
vrouter_prefix(nic, "IP6_GLOBAL");
|
||||
|
||||
// TODO: remove all other attrs, such as AR, BRIDGE, etc?
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
Template * VirtualRouter::get_vm_template() const
|
||||
|
||||
Reference in new issue
Block a user