Skip to content

Commit

Permalink
disconnect_storage should be called once
Browse files Browse the repository at this point in the history
During vm remove we used to call disconnect_storage. The first time
it was called as a first step of removal flow and during refresh.
This caused timing issue which caused lack of update to vm.ems_id.
As a result vm state was "unknown".

We need to make sure that disconnect_storage is called only once.
  • Loading branch information
pkliczewski committed Jul 17, 2017
1 parent 985ded1 commit fe7181d
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions app/models/manageiq/providers/redhat/infra_manager/vm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,18 @@ def parent_cluster
alias ems_cluster parent_cluster

def disconnect_storage(_s = nil)
unless active?
return
end
return unless active?

vm_storages = ([storage] + storages).compact.uniq
return if vm_storages.empty?

vm_disks = collect_disks

if vm_disks.blank?
storage = nil
else
vm_storages = ([storage] + storages).compact.uniq
storage = vm_storages.select { |store| !vm_disks.include?(store.ems_ref) }
end
storage = if vm_disks.blank?
nil
else
vm_storages.select { |store| !vm_disks.include?(store.ems_ref) }
end

super(storage)
end
Expand Down

0 comments on commit fe7181d

Please sign in to comment.