Description of problem: The Automate Retirement State Machine gives the user the option to select "unregister" instead of "remove_from_disk" as a retirement option. This option was originally added for a VMWare customer and is seldom used. There is a consultant attempting to use the "unregister" option for RHEV retirement which is not currently implemented. WMWare unregister: https://github.com/ManageIQ/manageiq-providers-vmware/blob/master/app/models/manageiq/providers/vmware/infra_manager.rb#L199 Can we implement vm_unregister for any/all of the other infrastructure providers where it makes sense?
Please assess the impact of this issue and update the severity accordingly. Please refer to https://bugzilla.redhat.com/page.cgi?id=fields.html#bug_severity for a reminder on each severity's definition. If it's something like a tracker bug where it doesn't matter, please set the severity to Low.
Hi Greg, It came to my attention last week that someone was attempting to use the unregister retirement workflow for RHEV. I opened the ticket to find out if it's possible to support unregister for other infra providers. We'll have to modify the retirement state machine to block/prevent the unregister workflow for unsupported providers. Thanks, Tina
Turns out it is possible to unregister a VM in RHEV, assigning to the RHEV team to implement the vm.unregister method.
I highly doubt we will have a capacity to deliver this RFE in 5.9.1
(In reply to Martin Perina from comment #8) > I highly doubt we will have a capacity to deliver this RFE in 5.9.1 We have reconsidered and will try to deliver in 5.9.1
https://github.com/ManageIQ/manageiq-providers-ovirt/pull/223
Moti, Can you please provide validation steps for this RFE? Thanks.
(In reply to Ilanit Stein from comment #11) > Moti, > > Can you please provide validation steps for this RFE? > > Thanks. The details of selecting the 'unregister' method of retiring a vm can be found here: https://pemcg.gitbooks.io/introduction-to-cloudforms-automation/content/chapter18/retirement.html
New commit detected on ManageIQ/manageiq-providers-ovirt/master: https://github.com/ManageIQ/manageiq-providers-ovirt/commit/a8de7023ccd8388b17cf8edb87dae295565dbe2d commit a8de7023ccd8388b17cf8edb87dae295565dbe2d Author: Moti Asayag <masayag> AuthorDate: Sun Mar 4 17:20:26 2018 +0200 Commit: Moti Asayag <masayag> CommitDate: Mon Mar 5 15:19:19 2018 +0200 Support Unregister VM Unregister VM allows the user to remove the VM without deleting its disks. For that purpose, the request to remove VM to ovirt-engine includes the 'detach_only=true' parameter. This action will succeed if the VM isn't originated from a template, or if the VM has no snapshots. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1536628 .../infra_manager/ovirt_services/strategies/v4.rb | 4 ++++ .../providers/redhat/infra_manager/vm/operations.rb | 4 ++++ .../providers/redhat/infra_manager/vm_spec.rb | 20 ++++++++++++++++++++ 3 files changed, 28 insertions(+)
(In reply to Moti Asayag from comment #12) > (In reply to Ilanit Stein from comment #11) > > Moti, > > > > Can you please provide validation steps for this RFE? > > > > Thanks. > > The details of selecting the 'unregister' method of retiring a vm can be > found here: > > https://pemcg.gitbooks.io/introduction-to-cloudforms-automation/content/ > chapter18/retirement.html In addition to the link above, a simple automation method with code as bellow will be sufficient to invoke the vm.unregister method: ------------- 8< ------------------------ # # Description: This method is used to unregister a vm # # Inputs: vm_name # # Get vm object vm_name = $evm.root['vm_name'] $evm.log("info", "-------->>>> Trying to add disk to VM: <#{vm_name}>") $evm.root['vm'] = $evm.vmdb('vm').find_by_name(vm_name) vm = $evm.root['vm'] raise "Missing $evm.root['vm'] object" unless vm vm.unregister ------------- >8 ------------------------
New commit detected on ManageIQ/manageiq/fine: https://github.com/ManageIQ/manageiq/commit/5193ee99d81be65b07b096202dcc74af373bf49d commit 5193ee99d81be65b07b096202dcc74af373bf49d Author: Moti Asayag <masayag> AuthorDate: Wed Jun 6 07:09:52 2018 -0400 Commit: Moti Asayag <masayag> CommitDate: Wed Jun 6 07:09:52 2018 -0400 Support Unregister VM Unregister VM allows the user to remove the VM without deleting its disks. For that purpose, the request to remove VM to ovirt-engine includes the 'detach_only=true' parameter. This action will succeed if the VM isn't originated from a template, or if the VM has no snapshots. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1536628 app/models/manageiq/providers/redhat/infra_manager/ovirt_services/strategies/v4.rb | 4 + app/models/manageiq/providers/redhat/infra_manager/vm/operations.rb | 4 + spec/models/manageiq/providers/redhat/infra_manager/vm_spec.rb | 20 + 3 files changed, 28 insertions(+)
Verified on CFME-5.10.0.4/RHV-4.2.5: Steps done under Automation: =========================== 1) In Automate->Explorer added a new domain and a namespace. (As a reference, this link can be used to create the domain/namespace: https://pemcg.gitbooks.io/introduction-to-cloudforms-automation/content/chapter1/methods.html , See the "hello world" method creation flow). 2) Copy instance Redhat-> Integration->VMware->VimApi->"VMware_HotAdd_Disk" to the created namespace path. (See 'unregister_vm_copy_instance.png' attached). 3) Edit the Instance name from "VMware_HotAdd_Disk" into "Unregister_vm". 4) Add method named "unregister_vm" (See 'add_method_for_unregister.png' attached) Set the method type as inline, and add this content: # # Description: This method is used to unregister a vm # # Inputs: vm_name # # Get vm object vm_name = $evm.root['vm_name'] $evm.log("info", "-------->>>> Trying to unregister VM: <#{vm_name}>") $evm.root['vm'] = $evm.vmdb('vm').find_by_name(vm_name) vm = $evm.root['vm'] raise "Missing $evm.root['vm'] object" unless vm vm.unregister 5) In the "Unregister_vm" instance update it should call the method "unregister_vm". 6) Then run Automate->Simulation, with vm_name of VM that we want to unregister. This VM should have a disk that is not of an existing template, and should be in state down for the unregister succeed. (See automate_simulation.png) Results: ======= Once the simulation operation was complete, the VM was removed, and it's disk was not removed.
Created attachment 1458978 [details] unregister_vm_copy_instance.png
Created attachment 1458979 [details] add_method_for_unregister.png
Created attachment 1458980 [details] automate_simulation.png