Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1552671 - [RFE][XS-2] Add possibility to unregister a VM in RHV provider
[RFE][XS-2] Add possibility to unregister a VM in RHV provider
Status: CLOSED ERRATA
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers (Show other bugs)
5.8.0
Unspecified Unspecified
medium Severity high
: GA
: 5.9.2
Assigned To: Moti Asayag
Ilanit Stein
: FutureFeature, RFE, ZStream
Depends On: 1536628
Blocks: 1554897
  Show dependency treegraph
 
Reported: 2018-03-07 09:10 EST by Satoe Imaishi
Modified: 2018-05-07 16:43 EDT (History)
14 users (show)

See Also:
Fixed In Version: 5.9.2.0
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: 1536628
Environment:
Last Closed: 2018-05-07 16:43:22 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: RHEVM


Attachments (Terms of Use)
automate_simulation.png (43.18 KB, image/png)
2018-04-16 10:16 EDT, Ilanit Stein
no flags Details
add_method_for_unregister.png (132.43 KB, image/png)
2018-04-16 10:16 EDT, Ilanit Stein
no flags Details
unregister_vm_copy_instance.png (113.26 KB, image/png)
2018-04-16 10:17 EDT, Ilanit Stein
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:1328 None None None 2018-05-07 16:43 EDT

  None (edit)
Comment 2 CFME Bot 2018-03-07 09:12:50 EST
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@gmail.com>
AuthorDate: Mon Mar  5 10:34:23 2018 -0500
Commit:     Piotr Kliczewski <piotr.kliczewski@gmail.com>
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(+)
Comment 3 Ilanit Stein 2018-04-16 10:03:52 EDT
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
Comment 4 Ilanit Stein 2018-04-16 10:16 EDT
Created attachment 1422569 [details]
automate_simulation.png
Comment 5 Ilanit Stein 2018-04-16 10:16 EDT
Created attachment 1422570 [details]
add_method_for_unregister.png
Comment 6 Ilanit Stein 2018-04-16 10:17 EDT
Created attachment 1422572 [details]
unregister_vm_copy_instance.png
Comment 9 errata-xmlrpc 2018-05-07 16:43:22 EDT
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

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