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 24, 2017
1 parent 236d6f6 commit 6a47965
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 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,13 @@ def parent_cluster
alias ems_cluster parent_cluster

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

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
vm_storages = ([storage] + storages).compact.uniq
return if vm_storages.empty?

vm_disks = collect_disks
storage = vm_disks.blank? ? nil : vm_storages.select { |store| !vm_disks.include?(store.ems_ref) }

super(storage)
end
Expand Down

0 comments on commit 6a47965

Please sign in to comment.