mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-23 17:33:56 +03:00
feature #789: Solves minor bugs in host update for VDC. Deals with empty host lists
This commit is contained in:
parent
da42de1d6f
commit
d6defb6bb8
@ -173,8 +173,11 @@ module OZones
|
||||
# Delete existing host ACLs
|
||||
delete_host_acls
|
||||
|
||||
@vdc.acls =~ /((\d+,){#{HOST_ACL_FIRST_ID}}).*/
|
||||
newacls = $1.chop
|
||||
if @vdc.acls =~ /((\d+,){#{HOST_ACL_FIRST_ID}}).*/
|
||||
newacls = $1.chop
|
||||
else
|
||||
newacls = @vdc.acls.clone
|
||||
end
|
||||
|
||||
# Create new ACLs. TODO Rollback ACL creation
|
||||
if !host_list.empty?
|
||||
@ -251,9 +254,13 @@ module OZones
|
||||
#######################################################################
|
||||
# Deletes ACLs for the hosts
|
||||
def delete_host_acls
|
||||
@vdc.acls.split(',')[HOST_ACL_FIRST_ID..-1].each{|acl|
|
||||
OpenNebula::Acl.new_with_id(acl.to_i, @client).delete
|
||||
}
|
||||
host_acls = @vdc.acls.split(',')[HOST_ACL_FIRST_ID..-1]
|
||||
|
||||
if host_acls
|
||||
host_acls.each{|acl|
|
||||
OpenNebula::Acl.new_with_id(acl.to_i, @client).delete
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# Delete ACLs
|
||||
|
@ -256,6 +256,8 @@ class OzonesServer
|
||||
|
||||
# Check if hosts are already include in any Vdc of the zone
|
||||
def host_uniqueness?(zone, host_list, vdc_id = -1)
|
||||
return true if host_list.empty?
|
||||
|
||||
all_hosts = ""
|
||||
zone.vdcs.all.each{|vdc|
|
||||
if vdc.hosts != nil and !vdc.hosts.empty? and vdc.id != vdc_id
|
||||
|
Loading…
Reference in New Issue
Block a user