Bug 1308663

Summary: MICROSOFT scvmm power off operation not working
Product: Red Hat CloudForms Management Engine Reporter: Chris Pelland <cpelland>
Component: ProvidersAssignee: Bronagh Sorota <bsorota>
Status: CLOSED ERRATA QA Contact: Jeff Teehan <jteehan>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 5.5.0CC: bsorota, cpelland, jfrey, jhardy, jprause, jteehan, mfeifer, obarenbo, tfitzger, wfitzger
Target Milestone: GAKeywords: ZStream
Target Release: 5.5.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: power:provider:scvmm
Fixed In Version: 5.5.3.2 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1299069 Environment:
Last Closed: 2016-04-13 18:43:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1299069    
Bug Blocks:    

Comment 1 CFME Bot 2016-02-15 19:31:28 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=2bc6f1bc25b2002e8813295389b63c75669ca22f

commit 2bc6f1bc25b2002e8813295389b63c75669ca22f
Author:     Bronagh Sorota <bsorota>
AuthorDate: Mon Feb 15 13:08:07 2016 -0500
Commit:     Bronagh Sorota <bsorota>
CommitDate: Mon Feb 15 13:08:07 2016 -0500

    Implementation on 5.5.z of the vm_delete method for SCVMM
    
    Upstream PR is: https://github.com/ManageIQ/manageiq/pull/6306
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1308663

 app/models/manageiq/providers/microsoft/infra_manager.rb | 7 +++++++
 1 file changed, 7 insertions(+)

Comment 2 CFME Bot 2016-02-15 19:31:32 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=81cec429b074b05e3312d030c4bddb465109622b

commit 81cec429b074b05e3312d030c4bddb465109622b
Merge: e00dc53 2bc6f1b
Author:     Greg McCullough <gmccullo>
AuthorDate: Mon Feb 15 14:30:32 2016 -0500
Commit:     Greg McCullough <gmccullo>
CommitDate: Mon Feb 15 14:30:32 2016 -0500

    Merge branch 'scvmm_delete_vm_5.5.z' into '5.5.z'
    
    Implementation on 5.5.z of the vm_delete method for SCVMM
    
    Upstream PR is: https://github.com/ManageIQ/manageiq/pull/6306
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1308663
    
    See merge request !791

 app/models/manageiq/providers/microsoft/infra_manager.rb | 7 +++++++
 1 file changed, 7 insertions(+)

Comment 4 Jeff Teehan 2016-03-22 18:21:53 UTC
It's half fixed.  It won't retire the VM if it's running (ERROR Snippet 1 below).  But after you shut it off, you can never retire it because it's being retired (ERROR Snippet 2 below).  The first error needs to clear the "being retired" flag so that the next request can go through after the remedy.

I've tried everything I could think of over a 90 minute period to reset it via the GUI but that VM is never going to be retired from CFME as near as I can tell.


ERROR Snippet 1
[----] E, [2016-03-22T12:43:10.678959 #12264:fef998] ERROR -- : <SCVMM> MIQ(Class#log_dos_error_results) Remove-SCVirtualMachine : VMM cannot remove the virtual machine because it is running

ERROR Snippet 2
[----] E, [2016-03-22T12:55:11.667320 #12267:3177638] ERROR -- : <AutomationEngine> <AEMethod start_retirement> VM is in the process of being retired. Aborting current State Machine.
[----] E, [2016-03-22T12:55:11.692265 #12267:1251998] ERROR -- : <AutomationEngine> State=<StartRetirement> running  raised exception: <Method exited with rc=MIQ_ABORT>
[----] E, [2016-03-22T12:55:12.431148 #12267:1251998] ERROR -- : MIQ(MiqAeEngine.deliver) Error delivering {:event_type=>"request_vm_retire", "VmOrTemplate::vm"=>321000000000127, :vm_id=>321000000000127, "Host::host"=>321000000000002, :host_id=>321000000000002, :retirement_initiator=>"user", :userid=>"admin", :type=>"ManageIQ::Providers::Microsoft::InfraManager::Vm", "MiqEvent::miq_event"=>321000000008113, :miq_event_id=>321000000008113, "EventStream::event_stream"=>321000000008113, :event_stream_id=>321000000008113} for object [ManageIQ::Providers::Microsoft::InfraManager::Vm.321000000000127] with state [] to Automate:

Comment 5 Bronagh Sorota 2016-03-22 20:26:51 UTC
Hi Jeff,
I tested this on the rails console with a 5.5.z server running and the VM was deleted as expected in SCVMM.
The steps I took on the rails console were:

v = Vm.where(name: "name_of_vm").first
e = ManageIQ::Providers::Microsoft::InfraManager.first
e.vm_destroy(v)
EmsRefresh.refresh(e)

As a next step I would ask the Automate team to take a look

Comment 6 Tina Fitzgerald 2016-03-23 21:15:33 UTC
Hi Jeff,

Can I have the credentials for your appliance?

Thanks,
Tina

Comment 7 Jeff Teehan 2016-03-23 21:28:23 UTC
root/smartvm
admin/smartvm

Always default

Comment 8 Tina Fitzgerald 2016-03-24 16:32:41 UTC
Hi Jeff,

Based on our tests and conversation from yesterday, it appears as though retirement works properly for the scvmm provider if the vmdb and scvmm agree on the VM power state when entering retirement.  

As a result, I believe automate is working properly here.

Let me know if you have any questions.

Regards,
Tina

Comment 9 CFME Bot 2016-04-01 18:57:17 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=7b0d5fed9fdae10699adf68ee945fc0c7eff82c4

commit 7b0d5fed9fdae10699adf68ee945fc0c7eff82c4
Merge: 26e48f5 f7aed43
Author:     Oleg Barenboim <obarenbo>
AuthorDate: Fri Apr 1 14:18:02 2016 -0400
Commit:     Oleg Barenboim <obarenbo>
CommitDate: Fri Apr 1 14:18:02 2016 -0400

    Merge branch 'scvmm_retirement_powerstatus_bug_5.5.z' into '5.5.z'
    
    SCVMM retirements power status bug fix
    
    Power off the VM before deleting it, regardless of what the power status is.
    
    This was a clean cherry pick.
    The upstream PR is: https://github.com/ManageIQ/manageiq/pull/7633
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1308663
    
    See merge request !881

 app/models/manageiq/providers/microsoft/infra_manager.rb | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comment 10 CFME Bot 2016-04-01 18:57:22 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=f7aed43260c9f5a8bb8a438e2f92e410ba598dd6

commit f7aed43260c9f5a8bb8a438e2f92e410ba598dd6
Author:     Bronagh Sorota <bsorota>
AuthorDate: Thu Mar 31 14:26:55 2016 -0400
Commit:     Bronagh Sorota <bsorota>
CommitDate: Fri Apr 1 10:17:36 2016 -0400

    SCVMM retirements power status bug fix:
    Power off the VM before deleting it, regardless of what the power status is.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1308663

 app/models/manageiq/providers/microsoft/infra_manager.rb | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comment 13 Jeff Teehan 2016-04-06 23:52:32 UTC
This is so much better.  I tried every trick I could think of to trip it up.  It is possible to power it on between the time when we power it off and delete it, but we'll never be able to do anything about that.

I know it was a lot of extra work but I really think this provides a better user experience, if not for the customer, than at least me.  :)  Nice work!

Moving to verified.  Tested on 5.5.3.3 using https://10.16.6.125/vm_cloud/explorer

Comment 15 errata-xmlrpc 2016-04-13 18:43:54 UTC
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:0616