mirror of
https://github.com/OpenNebula/one.git
synced 2025-04-01 06:50:25 +03:00
B #5371: More consistent network creation behaviour
- Import Wild => create network always with 1 lease and mac - Import Template => create network if not exists, 255 and ether - Import Network => create network if not exists, 255 and ether
This commit is contained in:
parent
661bc3530e
commit
fa9c1b3406
@ -96,12 +96,12 @@ class Network
|
||||
one_tmp[:one_cluster_id] = cluster_id
|
||||
|
||||
one_tmp[:one] = to_one(network_import_name, network_name, network_ref, network_type,
|
||||
ccr_ref, vcenter_uuid, unmanaged, template_ref, dc_ref)
|
||||
ccr_ref, vcenter_uuid, unmanaged, template_ref, dc_ref, template_id)
|
||||
return one_tmp
|
||||
end
|
||||
|
||||
def self.to_one(network_import_name, network_name, network_ref, network_type,
|
||||
ccr_ref, vcenter_uuid, unmanaged, template_ref, dc_ref)
|
||||
ccr_ref, vcenter_uuid, unmanaged, template_ref, dc_ref, template_id)
|
||||
|
||||
template = "NAME=\"#{network_import_name}\"\n"\
|
||||
"BRIDGE=\"#{network_name}\"\n"\
|
||||
@ -110,6 +110,11 @@ class Network
|
||||
"VCENTER_NET_REF=\"#{network_ref}\"\n"\
|
||||
"VCENTER_INSTANCE_ID=\"#{vcenter_uuid}\"\n"
|
||||
|
||||
if unmanaged == "wild"
|
||||
template += "VCENTER_FROM_WILD=\"#{template_id}\"\n"
|
||||
template += "OPENNEBULA_MANAGED=\"NO\"\n"
|
||||
end
|
||||
|
||||
template += "VCENTER_CCR_REF=\"#{ccr_ref}\"\n" if !unmanaged
|
||||
|
||||
template += "VCENTER_TEMPLATE_REF=\"#{template_ref}\"\n" if template_ref
|
||||
|
@ -361,11 +361,15 @@ class Template
|
||||
|
||||
vc_nics.each do |nic|
|
||||
# Check if the network already exists
|
||||
network_found = VCenterDriver::VIHelper.find_by_ref(OpenNebula::VirtualNetworkPool,
|
||||
"TEMPLATE/VCENTER_NET_REF",
|
||||
nic[:net_ref],
|
||||
vc_uuid,
|
||||
npool)
|
||||
if wild
|
||||
network_found = false
|
||||
else
|
||||
network_found = VCenterDriver::VIHelper.find_by_ref(OpenNebula::VirtualNetworkPool,
|
||||
"TEMPLATE/VCENTER_NET_REF",
|
||||
nic[:net_ref],
|
||||
vc_uuid,
|
||||
npool)
|
||||
end
|
||||
|
||||
#Network is already in OpenNebula
|
||||
if network_found
|
||||
|
Loading…
x
Reference in New Issue
Block a user