mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-02 09:47:00 +03:00
parent
0ff9fc6075
commit
9af43a6916
@ -477,11 +477,6 @@ private:
|
||||
*/
|
||||
string vlan_id;
|
||||
|
||||
/**
|
||||
* Whether or not to isolate this network with the vnm driver
|
||||
*/
|
||||
int vlan;
|
||||
|
||||
/**
|
||||
* Parent VNET ID if any
|
||||
*/
|
||||
@ -546,7 +541,7 @@ private:
|
||||
int from_xml(const string &xml_str);
|
||||
|
||||
/**
|
||||
* Updates the BRIDGE, PHY_DEV, VLAN_ID and VLAN attributes.
|
||||
* Updates the BRIDGE, PHY_DEV, and VLAN_ID attributes.
|
||||
* @param error string describing the error if any
|
||||
* @return 0 on success
|
||||
*/
|
||||
|
@ -33,7 +33,7 @@
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="BRIDGE" type="xs:string"/>
|
||||
<xs:element name="VLAN" type="xs:integer"/>
|
||||
<xs:element name="VN_MAD" type="xs:integer"/>
|
||||
<xs:element name="PARENT_NETWORK_ID" type="xs:string"/>
|
||||
<xs:element name="PHYDEV" type="xs:string"/>
|
||||
<xs:element name="VLAN_ID" type="xs:string"/>
|
||||
@ -53,7 +53,7 @@
|
||||
<xs:element name="SIZE" type="xs:integer"/>
|
||||
<xs:element name="TYPE" type="xs:string"/>
|
||||
<xs:element name="ULA_PREFIX" type="xs:string" minOccurs="0"/>
|
||||
<xs:element name="VLAN" type="xs:string" minOccurs="0"/>
|
||||
<xs:element name="VN_MAD" type="xs:string" minOccurs="0"/>
|
||||
<xs:element name="MAC_END" type="xs:string" minOccurs="0"/>
|
||||
<xs:element name="IP_END" type="xs:string" minOccurs="0"/>
|
||||
<xs:element name="IP6_ULA" type="xs:string" minOccurs="0"/>
|
||||
|
@ -32,7 +32,7 @@
|
||||
<xs:element name="CLUSTER_ID" type="xs:integer"/>
|
||||
<xs:element name="CLUSTER" type="xs:string"/>
|
||||
<xs:element name="BRIDGE" type="xs:string"/>
|
||||
<xs:element name="VLAN" type="xs:integer"/>
|
||||
<xs:element name="VN_MAD" type="xs:integer"/>
|
||||
<xs:element name="PARENT_NETWORK_ID" type="xs:string"/>
|
||||
<xs:element name="PHYDEV" type="xs:string"/>
|
||||
<xs:element name="VLAN_ID" type="xs:string"/>
|
||||
@ -53,7 +53,7 @@
|
||||
<xs:element name="SIZE" type="xs:integer"/>
|
||||
<xs:element name="TYPE" type="xs:string"/>
|
||||
<xs:element name="ULA_PREFIX" type="xs:string" minOccurs="0"/>
|
||||
<xs:element name="VLAN" type="xs:string" minOccurs="0"/>
|
||||
<xs:element name="VN_MAD" type="xs:string" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
@ -889,13 +889,11 @@ IMAGE_RESTRICTED_ATTR = "SOURCE"
|
||||
VNET_RESTRICTED_ATTR = "VN_MAD"
|
||||
VNET_RESTRICTED_ATTR = "PHYDEV"
|
||||
VNET_RESTRICTED_ATTR = "VLAN_ID"
|
||||
VNET_RESTRICTED_ATTR = "VLAN"
|
||||
VNET_RESTRICTED_ATTR = "BRIDGE"
|
||||
|
||||
VNET_RESTRICTED_ATTR = "AR/VN_MAD"
|
||||
VNET_RESTRICTED_ATTR = "AR/PHYDEV"
|
||||
VNET_RESTRICTED_ATTR = "AR/VLAN_ID"
|
||||
VNET_RESTRICTED_ATTR = "AR/VLAN"
|
||||
VNET_RESTRICTED_ATTR = "AR/BRIDGE"
|
||||
|
||||
#*******************************************************************************
|
||||
|
@ -730,7 +730,6 @@ in the frontend machine.
|
||||
nic_default = {"NETWORK" => "-",
|
||||
"IP" => "-",
|
||||
"MAC"=> "-",
|
||||
"VLAN"=>"no",
|
||||
"BRIDGE"=>"-"}
|
||||
|
||||
shown_ips = []
|
||||
@ -782,8 +781,7 @@ in the frontend machine.
|
||||
"NIC_ID" => "-",
|
||||
"IP" => ip,
|
||||
"NETWORK" => "Additional IP",
|
||||
"BRIDGE" => "-",
|
||||
"VLAN" => "-"
|
||||
"BRIDGE" => "-"
|
||||
}
|
||||
end
|
||||
|
||||
@ -804,14 +802,6 @@ in the frontend machine.
|
||||
end
|
||||
end
|
||||
|
||||
column :VLAN, "", :size=>4 do |d|
|
||||
if d["DOUBLE_ENTRY"]
|
||||
""
|
||||
else
|
||||
d["VLAN"].downcase
|
||||
end
|
||||
end
|
||||
|
||||
column :BRIDGE, "", :left, :size=>12 do |d|
|
||||
if d["DOUBLE_ENTRY"]
|
||||
""
|
||||
|
@ -102,10 +102,10 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
|
||||
:description=> "Netmask in dot notation"
|
||||
]
|
||||
|
||||
VLAN = [
|
||||
:name => "vlan",
|
||||
:large => "--vlan",
|
||||
:description=> "Use network isolation"
|
||||
VN_MAD = [
|
||||
:name => "vn_mad",
|
||||
:large => "--vn_mad",
|
||||
:description=> "Use this driver for the network"
|
||||
]
|
||||
|
||||
VLAN_ID = [
|
||||
@ -116,7 +116,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
|
||||
]
|
||||
|
||||
ADDAR_OPTIONS = [
|
||||
SIZE, MAC, IP, IP6_GLOBAL, IP6_ULA, GATEWAY, NETMASK, VLAN, VLAN_ID ]
|
||||
SIZE, MAC, IP, IP6_GLOBAL, IP6_ULA, GATEWAY, NETMASK, VN_MAD, VLAN_ID ]
|
||||
|
||||
def self.rname
|
||||
"VNET"
|
||||
@ -212,7 +212,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
|
||||
puts str % ["CLUSTERS",
|
||||
OpenNebulaHelper.clusters_str(vn.retrieve_elements("CLUSTERS/ID"))]
|
||||
puts str % ["BRIDGE", vn["BRIDGE"]]
|
||||
puts str % ["VLAN", OpenNebulaHelper.boolean_to_str(vn['VLAN'])]
|
||||
puts str % ["VN_MAD", vn['VN_MAD']] if !vn['VN_MAD'].empty?
|
||||
puts str % ["PHYSICAL DEVICE", vn["PHYDEV"]] if !vn["PHYDEV"].empty?
|
||||
puts str % ["VLAN ID", vn["VLAN_ID"]] if !vn["VLAN_ID"].empty?
|
||||
puts str % ["USED LEASES", vn['USED_LEASES']]
|
||||
|
@ -148,9 +148,9 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
ar << ", ULA_PREFIX = " <<
|
||||
options[:ip6_ula] if options[:ip6_ula]
|
||||
ar << ", GATEWAY = " << options[:gateway] if options[:gateway]
|
||||
ar << ", MASK = " << options[:netmask] if options[:netmask]
|
||||
ar << ", VLAN = YES" if options[:vlan]
|
||||
ar << ", VLAN_ID = " << options[:vlanid] if options[:vlanid]
|
||||
ar << ", MASK = " << options[:netmask] if options[:netmask]
|
||||
ar << ", VN_MAD = " << options[:vn_mad] if options[:vn_mad]
|
||||
ar << ", VLAN_ID = " << options[:vlanid] if options[:vlanid]
|
||||
|
||||
ar << "]"
|
||||
end
|
||||
|
@ -166,15 +166,6 @@ int AddressRange::from_vattr(VectorAttribute *vattr, string& error_msg)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ------------------------- VNET Attributes ---------------------------- */
|
||||
|
||||
bool b_vlan;
|
||||
|
||||
if ((vattr->vector_value("VLAN", b_vlan) == 0) && b_vlan)
|
||||
{
|
||||
vattr->replace("VLAN", "YES");
|
||||
}
|
||||
|
||||
/* ------------------------- Security Groups ---------------------------- */
|
||||
|
||||
value = vattr->vector_value("SECURITY_GROUPS");
|
||||
@ -816,7 +807,6 @@ void AddressRange::set_vnet(VectorAttribute *nic, const vector<string> &inherit)
|
||||
|
||||
string vn_mad = attr->vector_value("VN_MAD");
|
||||
string bridge = attr->vector_value("BRIDGE");
|
||||
string vlan = attr->vector_value("VLAN");
|
||||
string vlanid = attr->vector_value("VLAN_ID");
|
||||
string phydev = attr->vector_value("PHYDEV");
|
||||
|
||||
@ -830,11 +820,6 @@ void AddressRange::set_vnet(VectorAttribute *nic, const vector<string> &inherit)
|
||||
nic->replace("BRIDGE", bridge);
|
||||
}
|
||||
|
||||
if (!vlan.empty())
|
||||
{
|
||||
nic->replace("VLAN", vlan);
|
||||
}
|
||||
|
||||
if (!phydev.empty())
|
||||
{
|
||||
nic->replace("PHYDEV", phydev);
|
||||
|
@ -107,8 +107,6 @@ int VirtualNetwork::insert(SqlDB * db, string& error_str)
|
||||
|
||||
string sg_str;
|
||||
|
||||
bool b_vlan;
|
||||
|
||||
int rc, num_ars;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@ -142,21 +140,6 @@ int VirtualNetwork::insert(SqlDB * db, string& error_str)
|
||||
|
||||
add_template_attribute("VLAN_ID", vlan_id);
|
||||
|
||||
// ------------ VLAN ----------------------
|
||||
|
||||
erase_template_attribute("VLAN", b_vlan);
|
||||
|
||||
if (b_vlan || !phydev.empty())
|
||||
{
|
||||
vlan = 1;
|
||||
add_template_attribute("VLAN", "YES");
|
||||
}
|
||||
else
|
||||
{
|
||||
vlan = 0;
|
||||
add_template_attribute("VLAN", "NO");
|
||||
}
|
||||
|
||||
// ------------ BRIDGE --------------------
|
||||
|
||||
erase_template_attribute("BRIDGE",bridge);
|
||||
@ -263,7 +246,6 @@ error_common:
|
||||
int VirtualNetwork::post_update_template(string& error)
|
||||
{
|
||||
string new_bridge;
|
||||
bool b_vlan;
|
||||
string sg_str;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -271,7 +253,6 @@ int VirtualNetwork::post_update_template(string& error)
|
||||
/* - VN_MAD */
|
||||
/* - PHYDEV */
|
||||
/* - VLAN_ID */
|
||||
/* - VLAN */
|
||||
/* - BRIDGE */
|
||||
/* - SECURITY_GROUPS */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -287,19 +268,6 @@ int VirtualNetwork::post_update_template(string& error)
|
||||
|
||||
add_template_attribute("VLAN_ID", vlan_id);
|
||||
|
||||
erase_template_attribute("VLAN", b_vlan);
|
||||
|
||||
if (b_vlan || !phydev.empty())
|
||||
{
|
||||
vlan = 1;
|
||||
add_template_attribute("VLAN", "YES");
|
||||
}
|
||||
else
|
||||
{
|
||||
vlan = 0;
|
||||
add_template_attribute("VLAN", "NO");
|
||||
}
|
||||
|
||||
erase_template_attribute("BRIDGE",new_bridge);
|
||||
|
||||
if (!new_bridge.empty())
|
||||
@ -437,16 +405,15 @@ string& VirtualNetwork::to_xml_extended(string& xml, bool extended,
|
||||
|
||||
os <<
|
||||
"<VNET>" <<
|
||||
"<ID>" << oid << "</ID>" <<
|
||||
"<UID>" << uid << "</UID>" <<
|
||||
"<GID>" << gid << "</GID>" <<
|
||||
"<UNAME>" << uname << "</UNAME>" <<
|
||||
"<GNAME>" << gname << "</GNAME>" <<
|
||||
"<NAME>" << name << "</NAME>" <<
|
||||
perms_to_xml(perm_str) <<
|
||||
Clusterable::to_xml(clusters_xml) <<
|
||||
"<BRIDGE>" << one_util::escape_xml(bridge)<< "</BRIDGE>" <<
|
||||
"<VLAN>" << one_util::escape_xml(vlan) << "</VLAN>";
|
||||
"<ID>" << oid << "</ID>" <<
|
||||
"<UID>" << uid << "</UID>" <<
|
||||
"<GID>" << gid << "</GID>" <<
|
||||
"<UNAME>" << uname << "</UNAME>" <<
|
||||
"<GNAME>" << gname << "</GNAME>" <<
|
||||
"<NAME>" << name << "</NAME>" <<
|
||||
perms_to_xml(perm_str) <<
|
||||
Clusterable::to_xml(clusters_xml) <<
|
||||
"<BRIDGE>" << one_util::escape_xml(bridge) << "</BRIDGE>";
|
||||
|
||||
if (parent_vid != -1)
|
||||
{
|
||||
@ -483,13 +450,14 @@ string& VirtualNetwork::to_xml_extended(string& xml, bool extended,
|
||||
{
|
||||
os << "<VLAN_ID/>";
|
||||
}
|
||||
os << "<USED_LEASES>"<< ar_pool.get_used_addr() << "</USED_LEASES>";
|
||||
|
||||
os << "<USED_LEASES>"<< ar_pool.get_used_addr() << "</USED_LEASES>";
|
||||
|
||||
os << vrouters.to_xml(vrouters_xml);
|
||||
|
||||
os << obj_template->to_xml(template_xml);
|
||||
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, vms, vnets, vrs);
|
||||
|
||||
os << "</VNET>";
|
||||
|
||||
@ -511,14 +479,13 @@ int VirtualNetwork::from_xml(const string &xml_str)
|
||||
update_from_str(xml_str);
|
||||
|
||||
// Get class base attributes
|
||||
rc += xpath(oid, "/VNET/ID", -1);
|
||||
rc += xpath(uid, "/VNET/UID", -1);
|
||||
rc += xpath(gid, "/VNET/GID", -1);
|
||||
rc += xpath(uname, "/VNET/UNAME", "not_found");
|
||||
rc += xpath(gname, "/VNET/GNAME", "not_found");
|
||||
rc += xpath(name, "/VNET/NAME", "not_found");
|
||||
rc += xpath(bridge, "/VNET/BRIDGE", "not_found");
|
||||
rc += xpath(vlan, "/VNET/VLAN", 0);
|
||||
rc += xpath(oid, "/VNET/ID", -1);
|
||||
rc += xpath(uid, "/VNET/UID", -1);
|
||||
rc += xpath(gid, "/VNET/GID", -1);
|
||||
rc += xpath(uname, "/VNET/UNAME", "not_found");
|
||||
rc += xpath(gname, "/VNET/GNAME", "not_found");
|
||||
rc += xpath(name, "/VNET/NAME", "not_found");
|
||||
rc += xpath(bridge, "/VNET/BRIDGE","not_found");
|
||||
|
||||
// Permissions
|
||||
rc += perms_from_xml();
|
||||
@ -601,15 +568,6 @@ int VirtualNetwork::nic_attribute(
|
||||
nic->replace("NETWORK_ID", oid);
|
||||
nic->replace("BRIDGE", bridge);
|
||||
|
||||
if ( vlan == 1 )
|
||||
{
|
||||
nic->replace("VLAN", "YES");
|
||||
}
|
||||
else
|
||||
{
|
||||
nic->replace("VLAN", "NO");
|
||||
}
|
||||
|
||||
if (!vn_mad.empty())
|
||||
{
|
||||
nic->replace("VN_MAD", vn_mad);
|
||||
|
Loading…
x
Reference in New Issue
Block a user