Bug 1381255 - Cannot cancel clone via policy with cancel vcenter task
Summary: Cannot cancel clone via policy with cancel vcenter task
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Control
Version: 5.6.0
Hardware: x86_64
OS: Unspecified
high
medium
Target Milestone: GA
: 5.8.0
Assignee: Lucy Fu
QA Contact: Dmitry Misharov
URL:
Whiteboard: control
Depends On:
Blocks: 1382406 1383372
TreeView+ depends on / blocked
 
Reported: 2016-10-03 13:48 UTC by Roderick Moore
Modified: 2017-06-12 17:37 UTC (History)
5 users (show)

Fixed In Version: 5.8.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1382406 1383372 (view as bug list)
Environment:
Last Closed: 2017-06-12 17:37:20 UTC
Category: ---
Cloudforms Team: VMware
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
policy used to test the cancel vcenter task action (1.26 KB, text/x-vhdl)
2016-10-03 13:48 UTC, Roderick Moore
no flags Details

Description Roderick Moore 2016-10-03 13:48:59 UTC
Created attachment 1206899 [details]
policy used to test the cancel vcenter task action

Description of problem: I tried to create a policy that prevents the cloning of specially tagged vms in a VMware environment. Here's the basic policy design:
  event: vm clone start
  condition: check to see if tagged as do not clone
  action: cancel vcenter task




Actual results: The clone was not cancelled. It successfully completed


Expected results: The clone task should have been cancelled


Additional info: I verified that the policy was successfully resolved. Here is the relevant log snippet:

[----] I, [2016-09-29T06:15:46.992366 #2834:741990]  INFO -- : MIQ(policy-enforce_policy): Event: [vm_clone_start], To: [rmvm06_0001]
[----] I, [2016-09-29T06:15:47.189004 #2834:741990]  INFO -- : MIQ(policy-enforce_policy): Resolving policy [Prevent VM Cloning Based on Tag]...
[----] I, [2016-09-29T06:15:47.199201 #2834:741990]  INFO -- : MIQ(condition-eval): Name: tagged as do not clone, Expression evaluation result: [true]
[----] I, [2016-09-29T06:15:47.314369 #2834:741990]  INFO -- : MIQ(action-invoke) Invoking action [Cancel vCenter Task] for successful policy [Prevent VM Cloning Based on Tag], event: [VM Clone Start], entity name: [rmvm06_0001], entity type: [Virtual Machine (VMware)], sequence: [1], synchronous? [true]
[----] I, [2016-09-29T06:29:43.141084 #2838:741990]  INFO -- : MIQ(policy-enforce_policy): Event: [vm_clone], To: [rmvm06_0001]

Comment 3 CFME Bot 2016-10-05 17:01:18 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/bb4f5884f84948f6d8f8071f956bd4a6591ab5d9

commit bb4f5884f84948f6d8f8071f956bd4a6591ab5d9
Author:     Lucy Fu <lufu>
AuthorDate: Mon Oct 3 16:07:46 2016 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Tue Oct 4 13:27:53 2016 -0400

    Need to keep and pass along the EmsEvent that triggers vm_clone_start event.
    
    To be able to cancel a vCenter task, we need to get the vCenter task id that is saved in CloneVM_Task event that triggers vm_clone_start event.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1381255

 app/models/miq_action.rb       | 11 ++++++-----
 app/models/miq_event.rb        | 13 +++++++++++++
 spec/models/miq_action_spec.rb |  8 ++++++++
 spec/models/miq_event_spec.rb  | 22 ++++++++++++++++++++++
 4 files changed, 49 insertions(+), 5 deletions(-)

Comment 5 Dmitry Misharov 2017-03-02 14:09:09 UTC
Verified in 5.8.0.3.20170301174324_1e2e0c4. "Cancel vCenter" action works as expected.


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