mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-23 17:33:56 +03:00
Feature #4215: Add keepalived_id/password
This commit is contained in:
parent
546301463c
commit
c41d43f09a
@ -1988,6 +1988,13 @@ private:
|
|||||||
*/
|
*/
|
||||||
int parse_vrouter(string& error_str);
|
int parse_vrouter(string& error_str);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Known Virtual Router attributes, to be moved from the user template
|
||||||
|
* to the template
|
||||||
|
*/
|
||||||
|
static const char* VROUTER_ATTRIBUTES[];
|
||||||
|
static const int NUM_VROUTER_ATTRIBUTES;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Known attributes for network contextualization rendered as:
|
* Known attributes for network contextualization rendered as:
|
||||||
* ETH_<nicid>_<context[0]> = $NETWORK[context[1], vnet_name]
|
* ETH_<nicid>_<context[0]> = $NETWORK[context[1], vnet_name]
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="medium-6 columns">
|
<div class="medium-6 columns">
|
||||||
<label for="name" >
|
<label for="name" >
|
||||||
{{tr "Name"}}:
|
{{tr "Name"}}
|
||||||
</label>
|
</label>
|
||||||
<input type="text" wizard_field="NAME" required name="name" id="name"/>
|
<input type="text" wizard_field="NAME" required name="name" id="name"/>
|
||||||
</div>
|
</div>
|
||||||
@ -34,6 +34,22 @@
|
|||||||
<textarea type="text" wizard_field="DESCRIPTION" id="DESCRIPTION" name="DESCRIPTION"/>
|
<textarea type="text" wizard_field="DESCRIPTION" id="DESCRIPTION" name="DESCRIPTION"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="medium-6 columns">
|
||||||
|
<label for="keepalived_id" >
|
||||||
|
{{tr "Keepalived ID"}}
|
||||||
|
<span class="tip">{{tr "Optional. Sets keepalived configuration parameter 'virtual_router_id'"}}</span>
|
||||||
|
</label>
|
||||||
|
<input type="text" wizard_field="KEEPALIVED_ID" name="keepalived_id" id="keepalived_id"/>
|
||||||
|
</div>
|
||||||
|
<div class="medium-6 columns">
|
||||||
|
<label for="keepalived_password" >
|
||||||
|
{{tr "Keepalived password"}}
|
||||||
|
<span class="tip">{{tr "Optional. Sets keepalived configuration parameter 'authentication/auth_pass'"}}</span>
|
||||||
|
</label>
|
||||||
|
<input type="text" wizard_field="KEEPALIVED_PASSWORD" name="keepalived_password" id="keepalived_password"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="large-12 columns nicsContext">
|
<div class="large-12 columns nicsContext">
|
||||||
|
@ -157,6 +157,12 @@ const char* VirtualMachine::NETWORK6_CONTEXT[][2] = {
|
|||||||
|
|
||||||
const int VirtualMachine::NUM_NETWORK6_CONTEXT = 4;
|
const int VirtualMachine::NUM_NETWORK6_CONTEXT = 4;
|
||||||
|
|
||||||
|
const char* VirtualMachine::VROUTER_ATTRIBUTES[] = {
|
||||||
|
"VROUTER_ID",
|
||||||
|
"VROUTER_KEEPALIVED_ID",
|
||||||
|
"VROUTER_KEEPALIVED_PASSWORD"};
|
||||||
|
const int VirtualMachine::NUM_VROUTER_ATTRIBUTES = 3;
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
@ -845,14 +851,17 @@ int VirtualMachine::parse_vrouter(string& error_str)
|
|||||||
{
|
{
|
||||||
string st;
|
string st;
|
||||||
|
|
||||||
user_obj_template->get("VROUTER_ID", st);
|
for (int i = 0; i < NUM_VROUTER_ATTRIBUTES; i++)
|
||||||
|
|
||||||
if (!st.empty())
|
|
||||||
{
|
{
|
||||||
obj_template->replace("VROUTER_ID", st);
|
user_obj_template->get(VROUTER_ATTRIBUTES[i], st);
|
||||||
}
|
|
||||||
|
|
||||||
user_obj_template->erase("VROUTER_ID");
|
if (!st.empty())
|
||||||
|
{
|
||||||
|
obj_template->replace(VROUTER_ATTRIBUTES[i], st);
|
||||||
|
}
|
||||||
|
|
||||||
|
user_obj_template->erase(VROUTER_ATTRIBUTES[i]);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -907,6 +916,7 @@ int VirtualMachine::parse_context(string& error_str)
|
|||||||
string parsed;
|
string parsed;
|
||||||
string files_ds;
|
string files_ds;
|
||||||
string files_ds_parsed;
|
string files_ds_parsed;
|
||||||
|
string st;
|
||||||
|
|
||||||
ostringstream oss_parsed;
|
ostringstream oss_parsed;
|
||||||
|
|
||||||
@ -1098,6 +1108,20 @@ int VirtualMachine::parse_context(string& error_str)
|
|||||||
add_template_attribute("CREATED_BY", uid);
|
add_template_attribute("CREATED_BY", uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Virtual Router attributes
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
for (int i = 0; i < NUM_VROUTER_ATTRIBUTES; i++)
|
||||||
|
{
|
||||||
|
obj_template->get(VROUTER_ATTRIBUTES[i], st);
|
||||||
|
|
||||||
|
if (!st.empty())
|
||||||
|
{
|
||||||
|
context_parsed->replace(VROUTER_ATTRIBUTES[i], st);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
error_cleanup:
|
error_cleanup:
|
||||||
|
@ -453,6 +453,8 @@ Template * VirtualRouter::get_vm_template() const
|
|||||||
bool floating;
|
bool floating;
|
||||||
vector<Attribute * > nics;
|
vector<Attribute * > nics;
|
||||||
VectorAttribute * nic;
|
VectorAttribute * nic;
|
||||||
|
int keepalived_id;
|
||||||
|
string st;
|
||||||
|
|
||||||
num_nics = obj_template->get("NIC",nics);
|
num_nics = obj_template->get("NIC",nics);
|
||||||
|
|
||||||
@ -487,6 +489,20 @@ Template * VirtualRouter::get_vm_template() const
|
|||||||
|
|
||||||
tmpl->replace("VROUTER_ID", oid);
|
tmpl->replace("VROUTER_ID", oid);
|
||||||
|
|
||||||
|
if (!obj_template->get("KEEPALIVED_ID", keepalived_id))
|
||||||
|
{
|
||||||
|
keepalived_id = (oid & 0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpl->replace("VROUTER_KEEPALIVED_ID", keepalived_id);
|
||||||
|
|
||||||
|
obj_template->get("KEEPALIVED_PASSWORD", st);
|
||||||
|
|
||||||
|
if (!st.empty())
|
||||||
|
{
|
||||||
|
tmpl->replace("VROUTER_KEEPALIVED_PASSWORD", st);
|
||||||
|
}
|
||||||
|
|
||||||
return tmpl;
|
return tmpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user