1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-20 10:50:08 +03:00

M #-: fix minor bug in providers (#631)

This commit is contained in:
Alejandro Huertas Herrero 2021-01-13 13:48:54 +01:00 committed by GitHub
parent 56b58e2ecc
commit d081011938
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 14 deletions

View File

@ -85,9 +85,7 @@ module OneProvision
return rc if OpenNebula.is_error?(rc)
pool.each do |p|
next unless p.body['provider'] == body['provider']
next if p.body['state'] == Provision::STATE['DONE']
next unless p.body['provider'] == self['NAME']
return OpenNebula::Error.new(
'Provider can not be deleted, it is used by ' \

View File

@ -112,19 +112,22 @@ module OneProvision
# Get cluster information
def cluster
return nil unless infrastructure_objects
return unless infrastructure_objects
infrastructure_objects['clusters'][0]
end
# Returns provision hosts
def hosts
return nil unless infrastructure_objects
return unless infrastructure_objects
infrastructure_objects['hosts']
end
# Returns provision datastores
def datastores
return nil unless infrastructure_objects
return unless infrastructure_objects
infrastructure_objects['datastores']
end
@ -247,7 +250,8 @@ module OneProvision
return OpenNebula::Error.new('No provider found')
end
@provider = provider
@provider = provider
if cfg['inputs'].nil?
cfg['inputs'] = provider.inputs
else
@ -538,7 +542,7 @@ module OneProvision
OneProvisionLogger.debug(msg)
datastores = cfg['cluster'].delete("datastores")
datastores = cfg['cluster'].delete('datastores')
obj = Cluster.new(nil, cfg['cluster'])
@ -546,7 +550,7 @@ module OneProvision
id = obj.create
datastores.each { |i| obj.adddatastore(i) } if datastores
datastores.each {|i| obj.adddatastore(i) } if datastores
infrastructure_objects['clusters'] = []
infrastructure_objects['clusters'] << { 'id' => id,
@ -570,8 +574,7 @@ module OneProvision
cfg[r].each do |x|
Driver.retry_loop('Failed to create some resources',
self) do
x['provision'] = {'id' => @id }
x['provision'] = { 'id' => @id }
obj = Resource.object(r, nil, x)
next if obj.nil?

View File

@ -79,9 +79,9 @@ module OneProvision
end
# Remove non-provision elements added to the cluster
@one.datastore_ids.each { |i| @one.deldatastore(i) }
@one.vnet_ids.each { |i| @one.delvnet(i) }
@one.host_ids.each { |i| @one.delhost(i) }
@one.datastore_ids.each {|i| @one.deldatastore(i) }
@one.vnet_ids.each {|i| @one.delvnet(i) }
@one.host_ids.each {|i| @one.delhost(i) }
Utils.exception(@one.delete)