Bug 1571254

Summary: [RHV] Orphaned VM has power state ON
Product: Red Hat CloudForms Management Engine Reporter: Jan Zmeskal <jzmeskal>
Component: ProvidersAssignee: Martin Perina <mperina>
Status: CLOSED CURRENTRELEASE QA Contact: Angelina Vasileva <anikifor>
Severity: low Docs Contact:
Priority: low    
Version: 5.9.0CC: cpelland, gblomqui, greartes, istein, jfrey, jhardy, obarenbo
Target Milestone: GAKeywords: AutomationBlocker
Target Release: cfme-futureFlags: istein: automate_bug+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-11 15:26:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: RHEVM Target Upstream Version:
Embargoed:

Description Jan Zmeskal 2018-04-24 12:09:20 UTC
Description of problem:
If a VM had power state ON while its provider was removed, the power state will stay ON for such VM even after the VM becomes Orphaned.

Version-Release number of selected component (if applicable):
CFME 5.9.2.3
RHV 4.2.2.5

How reproducible:
100 %

Steps to Reproduce:
1. Add a RHV provider to CFME.
2. Provision a VM from template (vm_orphaned in my case).
3. Wait for the provisioning to end. Make sure that the VM is ON and that CFME registers its power state as ON.
4. Remove your infrastructure provider from inventory. 
5. Find you VM in CFME UI and make sure it's state is orphaned.
6. Go to its summary page and check its power state. 
7. Also check its power state in vmdb_production DB (SELECT * FROM vms WHERE name = '<your_vm_name>'.

Actual results:
Both in UI and in DB the power state of such orphaned VM is ON.

Expected results:
I believe such a statement makes no sense. The only source of information about VM for CFME is the provider. If the VM is Orphaned (i.e. lost its provider), there is no way how CFME could know that the power state is on. In reality, from the point of view of CFME, the power state for an Orphaned VM should be unknown. 

If we want to display _last known_ power state, it should be in some different field. However I cannot see much use for such information.

Comment 4 Jan Zmeskal 2018-10-01 13:04:45 UTC
This problem also occurs on CFME 5.10.0.17, therefore a clone should be created.