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

F #3208 Display only user available virtual routers in virtual networks body (#3210)

This commit is contained in:
Christian González 2019-04-15 17:23:55 +02:00 committed by Ruben S. Montero
parent fa15207ae7
commit c73af39818
3 changed files with 27 additions and 8 deletions

View File

@ -739,10 +739,10 @@ private:
* Function to print the VirtualNetwork object into a string in
* XML format
* @param xml the resulting XML string
* @param extended If true, leases are included
* @param extended_and_check If true, leases are included and permissions are checked
* @return a reference to the generated string
*/
string& to_xml_extended(string& xml, bool extended,
string& to_xml_extended(string& xml, bool extended_and_check,
const vector<int>& vm_ids, const vector<int>& vnet_oids,
const vector<int>& vr_ids) const;

View File

@ -206,7 +206,7 @@ void VirtualNetworkTemplateInfo::request_execute(xmlrpc_c::paramList const& para
}
vn_tmpl->to_xml(str);
vn_tmpl->unlock();
success_response(str, att);

View File

@ -556,7 +556,7 @@ string& VirtualNetwork::to_xml(string& xml) const
{
const vector<int> empty;
return to_xml_extended(xml,false, empty, empty, empty);
return to_xml_extended(xml, false, empty, empty, empty);
}
/* -------------------------------------------------------------------------- */
@ -565,18 +565,20 @@ string& VirtualNetwork::to_xml(string& xml) const
string& VirtualNetwork::to_xml_extended(string& xml, const vector<int>& vms,
const vector<int>& vnets, const vector<int>& vrs) const
{
return to_xml_extended(xml,true, vms, vnets, vrs);
return to_xml_extended(xml, true, vms, vnets, vrs);
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
string& VirtualNetwork::to_xml_extended(string& xml, bool extended,
string& VirtualNetwork::to_xml_extended(string& xml, bool extended_and_check,
const vector<int>& vms, const vector<int>& vnets,
const vector<int>& vrs) const
{
ostringstream os;
vector<int>::const_iterator it;
string clusters_xml;
string vrouters_xml;
string template_xml;
@ -654,11 +656,28 @@ string& VirtualNetwork::to_xml_extended(string& xml, bool extended,
os << "<USED_LEASES>"<< ar_pool.get_used_addr() << "</USED_LEASES>";
os << vrouters.to_xml(vrouters_xml);
if (((vrs.size() == 1) && vrs[0] == -1) || !extended_and_check)
{
os << vrouters.to_xml(vrouters_xml);
}
else
{
os << "<VROUTERS>";
for (it = vrs.begin(); it != vrs.end(); it++)
{
if (vrouters.contains(*it))
{
os << "<ID>" << *it << "</ID>";
}
}
os << "</VROUTERS>";
}
os << obj_template->to_xml(template_xml);
os << ar_pool.to_xml(leases_xml, extended, vms, vnets, vrs);
os << ar_pool.to_xml(leases_xml, extended_and_check, vms, vnets, vrs);
os << "</VNET>";