Bug 1334949 - When you delete the VM from RHEV provider side, half the time it picks archived and the other half the time it picks orphaned even though the VM's disks were deleted.
Summary: When you delete the VM from RHEV provider side, half the time it picks archiv...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers
Version: 5.5.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.8.0
Assignee: Piotr Kliczewski
QA Contact: Ilanit Stein
URL:
Whiteboard: rhev
Depends On:
Blocks: 1342487 1401003
TreeView+ depends on / blocked
 
Reported: 2016-05-10 22:11 UTC by Nikhil Gupta
Modified: 2020-02-14 17:46 UTC (History)
10 users (show)

Fixed In Version: 5.8.0.0
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1342487 1401003 (view as bug list)
Environment:
Last Closed: 2017-06-12 17:42:42 UTC
Category: Bug
Cloudforms Team: RHEVM
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github https://github.com/ManageIQ manageiq pull 10398 0 None None None 2016-08-17 11:35:51 UTC

Description Nikhil Gupta 2016-05-10 22:11:30 UTC
Description of problem:

There appears to be NO correlation between the Orphaned vs Archived VM's state in Cloudforms. When VM's are deleted from disk sometimes they are marked as "archived" or times there marked as "orphaned".

The vmdb/app/models/vm_or_template.rb has the following code snippet:

~~~
  def archived?
    self.ext_management_system.nil? && self.storage.nil?
  end
  alias archived archived?

  def orphaned?
    self.ext_management_system.nil? && !self.storage.nil?
  end
  alias orphaned orphaned?
~~~

The VM state should be archived if the VM and associated VM disks were deleted and orphaned if the VM was deleted but the disks remain.  

However, with RHEV, it's a 50/50 gamble to see what state your VM will end up in when you delete the VM since half the time it picks archived and the other half the time it picks orphaned even though the VM's disks were deleted.

If the machine is deleted from disk in ANY manner it should be marked as Archived in CF, which doesn't currently happen.

Version-Release number of selected component (if applicable):
CFME-5.5.0.13.20151201120956_653c0d4


How reproducible:
Always

Steps to Reproduce:
1. Delete the VM along with disk from RHEV provider
2. Check its status on CFME UI.

Actual results:
When VM's are deleted from disk sometimes they are marked as "archived" or times there marked as "orphaned"

Expected results:
When VM's are deleted from disk it should be marked as "archived".

Comment 2 Boriso 2016-05-24 14:44:01 UTC
Hi, so I tried to reproduce it on my environment and failed.
The attached screen shot shows that all the 8 machines I tried with turned out to be Archives, which is the expected result.
I can see the code was changed, the lines that are in the bug description changed as well.

Ilanit maybe you can reproduce it in your env?

Comment 3 Ilanit Stein 2016-05-29 14:44:05 UTC
I checked several scenarios, 
on cfme 5.6.0.7-beta2.6.20160516171555_b1be31f,
and rhevm-3.6.7-0.1:

1. Remove a VM, including it's disk, from rhev side => Turned into Archived.
2. Remove a VM from cfme side => Turned into Archived
3. Remove a VM from rhev side, without removing the disk => Turned into Archived 

scenario 3. is expected to turn into Orphaned, but from some reason it turned into Archived.

(I did have in some previous cfme upstream version some Orphaned, and some archived, though I did not recall removing VMs, without removing their disk as well, but I do not know how to reproduce it)

Comment 4 Ilanit Stein 2016-06-02 13:15:53 UTC
On CFME 5.6.0.8-rc1.20160524155303_f2a5a50, adding same rhev provider, now show VM in scenario 3 as Orphaned.

Comment 6 Ilanit Stein 2016-06-21 08:57:41 UTC
For RHEV setup of 100 UP VMs (in 1 vmpool),
moving 50 VMs to Down state.
Then remove the vmpool.

On CFME side, some of the VMs are seen as Archived, and some as Orphaned.

Versions:
- rhevm-3.6.6.2-0.1.el6
- cfme: 5.6.0.11-rc2.2.20160614152915_f315c68

Comment 7 Satoe Imaishi 2016-12-02 14:35:35 UTC
PR: https://github.com/ManageIQ/manageiq/pull/12788

Comment 9 Ilanit Stein 2017-05-04 08:17:39 UTC
Verified on CFME-5.8.0.13/RHV-4.1.1.8

Tried multiple times to remove VMs (with/without removing the VM's disks), 

and the VM turned into the expected state on CFME side (Archived/Orphaned)

Comment 10 Ilanit Stein 2018-05-07 11:09:28 UTC
Moving 	qe_test_coverage to +, since there are automation tests, running for CFME/RHV, for VM archived/orphaned status.


Note You need to log in before you can comment on or make changes to this bug.