Description of problem: When you terminate vm, the vm status doesn't change to Archived Version-Release number of selected component (if applicable): 5.5.2.4 How reproducible: Always Steps to Reproduce: 1. Open AWS instance 2. Terminate it 3. Wait for changing the power status to terminated Actual results: The vm doesn't become archived Expected results: The vm should have archived status Additional info:
Hi Tara, A couple clarification questions, 1. how did you terminate the VM? through AWS management console or ManageIQ console? 2. And after it's terminated, is it still there in "instances"? Or it's completely gone from the ManageIQ console?
Hi James, Sorry for not full description of the issue. 1. I terminate VM through ManageIQ. Instances -> Choose Instance -> Power -> Terminate. 2. Yes, VM is still there in "instances". I attached screen shot.
Created attachment 1130825 [details] instance termination
@james: have a look here https://github.com/ManageIQ/manageiq/pull/7477#discussion_r57366105 my guess is, that there is a kind of race condition going on. The refresh calls #disconnect_env and removes the instance from the ems. But then automate cannot archive/retire the instance. But I'm not sure if this is the real problem. AFAIR the above PR retired a terminated instance...
The cause is that there's VMDB::Config.new("vmdb").config[:ems_refresh][:ec2]. But the refresh_parser is trying to get VMDB::Config.new("vmdb").config[:ems_refresh][:amazon] which doesn't exist. Without that options (and its ignore_terminated_instances=true to be exact), ManageIQ::Providers::Amazon::CloudManager::RefreshParser.parse_instance won't be able to move a terminated instance into the flow of disconnect_inv.
@Marcel/@GregB, seems like we need this PR https://github.com/ManageIQ/manageiq/pull/5868 to fix this issue.
but this PR is already merged?! And the amazon cloudmanager reports its type as ec2: https://github.com/ManageIQ/manageiq/blob/cdf97e80840dd3f69c0846ddc96cf9ccdca5804e/gems/manageiq-providers-amazon/app/models/manageiq/providers/amazon/cloud_manager.rb#L53 And here is the relevant part where the option are set: https://github.com/ManageIQ/manageiq/blob/cdf97e80840dd3f69c0846ddc96cf9ccdca5804e/app/models/manageiq/providers/base_manager/refresher.rb#L17-L24
@greg I wonder if ignore_terminated_instances=true makes sense at all. AWS removes terminated instances after a threshold and then we'd archive them on our side. While they are terminated on aws IMHO they should be terminated on our side too...
@Marcel, that's right, that PR (https://github.com/ManageIQ/manageiq/pull/5868) was already merged to upstream and is in Darga. Now just realized this bug is targeted at 5.6 which is Darga So this bug can be closed after QE verification with the coming Darga release. PS Also, the ems_type call was triggered from https://github.com/ManageIQ/manageiq/blob/master/gems/manageiq-providers-amazon/app/models/manageiq/providers/amazon/cloud_manager/refresher.rb#L5 which won't get the Amazon CloudManager class's ems_type.
@james ok. good to see this might be a non-issue :) regarding your PS I'm confused: in rails console: ManageIQ::Providers::Amazon::CloudManager::Refresher.ems_type => :ec2 maybe lets take that conversation to gitter
For clarification: Original ems_type() is calling @ems_type ||= parent.short_token.underscore.to_sym parent.short_token returns "Amazon" which fails us. The fix is calling instead, @ems_type ||= parent.ems_type.to_sym parent.ems_type is CloudManager.ems_tyep => "ec2"
Verified in 5.6.0.6-beta2.5
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2016:1348