New commit detected on ManageIQ/manageiq-providers-ovirt/gaprindashvili: https://github.com/ManageIQ/manageiq-providers-ovirt/commit/1c5ef885593efe52a2c4b3239a25fd165f547a32 commit 1c5ef885593efe52a2c4b3239a25fd165f547a32 Author: Piotr Kliczewski <piotr.kliczewski> AuthorDate: Mon Mar 5 10:34:23 2018 -0500 Commit: Piotr Kliczewski <piotr.kliczewski> CommitDate: Mon Mar 5 10:34:23 2018 -0500 Merge pull request #223 from masayag/unregistervm Support Unregister VM (cherry picked from commit f0dfe4f9d59e850177d4fb837e37ea10707aa62b) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1552671 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.9.2.1/RHV-4.2.2-5: 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. Copy instance Redhat-> Infrastructure->VMware->VimApi->"VMware_HotAdd_Disk" to the created namespace path. (See 'unregister_vm_copy_instance.png' attached). 2) Edit the Instance name into "Unregister_vm", and the method name into "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 3) 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) Once the simulation operation is complete, the VM should be removed, and it's disks should remain (not removed). In case of there is a problem, check CFME automation/evm.log
Created attachment 1422569 [details] automate_simulation.png
Created attachment 1422570 [details] add_method_for_unregister.png
Created attachment 1422572 [details] unregister_vm_copy_instance.png
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/RHSA-2018:1328