mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-23 17:33:56 +03:00
Bug #3143: Take into account that not all PUBLIC_CLOUD sections are SoftLayer's
This commit is contained in:
parent
5a5f3319b5
commit
4bb772edce
@ -332,14 +332,16 @@ private
|
|||||||
sl = nil
|
sl = nil
|
||||||
all_sl_elements = xml.root.get_elements("//USER_TEMPLATE/PUBLIC_CLOUD")
|
all_sl_elements = xml.root.get_elements("//USER_TEMPLATE/PUBLIC_CLOUD")
|
||||||
|
|
||||||
|
all_sl_elements = all_sl_elements.select { |element|
|
||||||
|
element.elements["TYPE"].text.downcase.eql? "softlayer"
|
||||||
|
}
|
||||||
|
|
||||||
# First, let's see if we have an SoftLayer site that matches
|
# First, let's see if we have an SoftLayer site that matches
|
||||||
# our desired host name
|
# our desired host name
|
||||||
all_sl_elements.each { |element|
|
all_sl_elements.each { |element|
|
||||||
cloud_host = element.elements["DATACENTER"]
|
cloud_host = element.elements["DATACENTER"]
|
||||||
type = element.elements["TYPE"].text
|
type = element.elements["TYPE"].text
|
||||||
|
|
||||||
next if !type.downcase.eql? "softlayer"
|
|
||||||
|
|
||||||
if cloud_host and cloud_host.text.upcase.eql? host.upcase
|
if cloud_host and cloud_host.text.upcase.eql? host.upcase
|
||||||
sl = element
|
sl = element
|
||||||
end
|
end
|
||||||
@ -348,14 +350,14 @@ private
|
|||||||
if !sl
|
if !sl
|
||||||
# If we don't find the SoftLayer site, and ONE just
|
# If we don't find the SoftLayer site, and ONE just
|
||||||
# knows about one SoftLayer site, let's use that
|
# knows about one SoftLayer site, let's use that
|
||||||
if all_sl_elements.size == 1 and
|
if all_sl_elements.size == 1
|
||||||
all_sl_elements[0].elements["TYPE"].text.upcase.eql? "SOFTLAYER"
|
|
||||||
sl = all_sl_elements[0]
|
sl = all_sl_elements[0]
|
||||||
else
|
else
|
||||||
STDERR.puts(
|
STDERR.puts(
|
||||||
"Cannot find SoftLayer element in VM template "<<
|
"Cannot find SoftLayer element in VM template "<<
|
||||||
"or couldn't find any SoftLayer site matching "<<
|
"or ambigous definition of SofLayer templates "<<
|
||||||
"one of the templates.")
|
"(for instance, two SoftLayer sections without " <<
|
||||||
|
"a DATACENTER defined)")
|
||||||
exit(-1)
|
exit(-1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user