mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-20 20:02:38 +09:00
F #4913: VLAN info (VLAN_TAGGED_ID) is no longer retrieved when vcenter networks are imported
This commit is contained in:
1 parent
080460e3a1
commit
c8ce9fe7bd
2 files changed
+3
-52
No files matched your search
@@ -327,12 +327,6 @@ class DatacenterFolder
|
||||
network_name = network['name']
|
||||
network_ref = network['_ref']
|
||||
|
||||
# TODO slow VLAN_ID retrieve for portgroups! set to nil
|
||||
vlan_id = ""
|
||||
if network.class == VCenterDriver::DistributedPortGroup
|
||||
vlan_id = network.vlan_id
|
||||
end
|
||||
|
||||
network.clusters.each do |ccr_ref, ccr_name|
|
||||
one_vnet = VCenterDriver::Network.to_one_template(network_name,
|
||||
network_ref,
|
||||
|
||||
@@ -57,21 +57,20 @@ class Network
|
||||
end
|
||||
|
||||
|
||||
def self.to_one_template(network_name, network_ref, network_type, vlan_id,
|
||||
def self.to_one_template(network_name, network_ref, network_type,
|
||||
ccr_ref, ccr_name, vcenter_uuid)
|
||||
one_tmp = {}
|
||||
one_tmp[:name] = "#{network_name} - #{ccr_name}"
|
||||
one_tmp[:bridge] = network_name
|
||||
one_tmp[:type] = network_type
|
||||
one_tmp[:cluster] = ccr_name
|
||||
one_tmp[:vlan_id] = vlan_id
|
||||
one_tmp[:vcenter_ccr_ref] = ccr_ref
|
||||
one_tmp[:one] = to_one(network_name, network_ref, network_type, vlan_id,
|
||||
one_tmp[:one] = to_one(network_name, network_ref, network_type,
|
||||
ccr_ref, ccr_name, vcenter_uuid)
|
||||
return one_tmp
|
||||
end
|
||||
|
||||
def self.to_one(network_name, network_ref, network_type, vlan_id,
|
||||
def self.to_one(network_name, network_ref, network_type,
|
||||
ccr_ref, ccr_name, vcenter_uuid)
|
||||
template = "NAME=\"#{network_name} - #{ccr_name}\"\n"\
|
||||
"BRIDGE=\"#{network_name}\"\n"\
|
||||
@@ -81,8 +80,6 @@ class Network
|
||||
"VCENTER_CCR_REF=\"#{ccr_ref}\"\n"\
|
||||
"VCENTER_INSTANCE_ID=\"#{vcenter_uuid}\"\n"
|
||||
|
||||
template << "VLAN_TAGGED_ID=#{vlan_id}\n" if !vlan_id.empty?
|
||||
|
||||
return template
|
||||
end
|
||||
|
||||
@@ -135,24 +132,6 @@ class PortGroup < Network
|
||||
net_clusters
|
||||
end
|
||||
|
||||
def vlan_id
|
||||
id = ""
|
||||
host_members = self['host']
|
||||
host = host_members.first
|
||||
# This is pretty slow as the host id subsystem has to be queried
|
||||
cm = host.configManager
|
||||
nws = cm.networkSystem
|
||||
nc = nws.networkConfig
|
||||
pgs = nc.portgroup
|
||||
pgs.each do |pg|
|
||||
if pg.spec.name == self["name"]
|
||||
id << pg.spec.vlanId.to_s if pg.spec.vlanId != 0
|
||||
break
|
||||
end
|
||||
end
|
||||
id
|
||||
end
|
||||
|
||||
def network_type
|
||||
"Port Group"
|
||||
end
|
||||
@@ -181,28 +160,6 @@ class DistributedPortGroup < Network
|
||||
net_clusters
|
||||
end
|
||||
|
||||
def vlan_id
|
||||
id = ""
|
||||
pc = self['config.defaultPortConfig']
|
||||
if pc.respond_to?(:vlan) && pc.vlan.respond_to?(:vlanId)
|
||||
|
||||
vlan = pc.vlan.vlanId
|
||||
|
||||
if vlan.is_a? Array
|
||||
vlan.each do |v|
|
||||
id << v.start.to_s
|
||||
id << ".."
|
||||
id << v.end.to_s
|
||||
id << ","
|
||||
end
|
||||
id.chop!
|
||||
else
|
||||
id = vlan.to_s if vlan != 0
|
||||
end
|
||||
end
|
||||
return id
|
||||
end
|
||||
|
||||
def network_type
|
||||
"Distributed Port Group"
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user