Bug 1171343

Summary: Deleting a Cluster with many policy_events takes forever and times out.
Product: Red Hat CloudForms Management Engine Reporter: Dave Johnson <dajohnso>
Component: ApplianceAssignee: Jason Frey <jfrey>
Status: CLOSED ERRATA QA Contact: Dave Johnson <dajohnso>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 5.2.0CC: drieden, jfrey, jhardy, jocarter, jrafanie, mfeifer, obarenbo, ssainkar, xlecauch
Target Milestone: GAKeywords: ZStream
Target Release: 5.3.2   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: 5.3.2 Doc Type: Bug Fix
Doc Text:
Policy_events are not allowing the cluster to delete and the operation times out. Added purger for policy_events - PurgerMixin has been created as a set of common methods from all of the other purgers. Also added scheduler methods for purging policy_events. These changes have now resolved the issue and there is no longer a timeout.
Story Points: ---
Clone Of: 1167110 Environment:
Last Closed: 2015-01-14 19:44:10 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: 1167110    
Bug Blocks:    

Comment 1 CFME Bot 2014-12-05 22:51:15 UTC
New commit detected on cfme/5.3.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=d2f012392e19f165c673e5a8aaf93a2ad740f67b

commit d2f012392e19f165c673e5a8aaf93a2ad740f67b
Author:     Jason Frey <jfrey>
AuthorDate: Mon Nov 24 16:51:10 2014 -0500
Commit:     Jason Frey <jfrey>
CommitDate: Fri Dec 5 17:48:11 2014 -0500

    Remove :dependent => :nullify for policy_events.
    
    policy_events will be handled by a purger much like ems_events.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1167110
    https://bugzilla.redhat.com/show_bug.cgi?id=1171343

 vmdb/app/models/ems_cluster.rb           | 2 +-
 vmdb/app/models/ext_management_system.rb | 2 +-
 vmdb/app/models/host.rb                  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comment 2 CFME Bot 2014-12-05 22:51:28 UTC
New commit detected on cfme/5.3.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=11c33f0f275b2fcf9de22ee7246712726bb38b1d

commit 11c33f0f275b2fcf9de22ee7246712726bb38b1d
Author:     Jason Frey <jfrey>
AuthorDate: Mon Nov 24 16:56:05 2014 -0500
Commit:     Jason Frey <jfrey>
CommitDate: Fri Dec 5 17:48:23 2014 -0500

    Added scheduler methods for purging policy_events.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1167110
    https://bugzilla.redhat.com/show_bug.cgi?id=1171343

 vmdb/config/vmdb.tmpl.yml                     |  1 +
 vmdb/lib/workers/schedule_worker.rb           |  6 ++++++
 vmdb/lib/workers/schedule_worker/jobs.rb      | 18 ++++++++++++------
 vmdb/spec/lib/workers/schedule_worker_spec.rb | 19 ++++++++++---------
 4 files changed, 29 insertions(+), 15 deletions(-)

Comment 3 CFME Bot 2014-12-05 22:51:39 UTC
New commit detected on cfme/5.3.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=b4484b6674388904fd70fb7b640d832bd42513ff

commit b4484b6674388904fd70fb7b640d832bd42513ff
Author:     Jason Frey <jfrey>
AuthorDate: Mon Nov 24 16:55:48 2014 -0500
Commit:     Jason Frey <jfrey>
CommitDate: Fri Dec 5 17:48:19 2014 -0500

    Add purger for policy_events.
    
    PurgerMixin has been created as a set of common methods from all of the
    other purgers.  The other purgers will be modified to reuse these
    common methods in the future.  Initially this mixin has been created
    with methods for purging by date only, but ultimately it should include
    methods for purging "by remaining" as is found in the miq_report_result
    and drift_state purgers.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1167110
    https://bugzilla.redhat.com/show_bug.cgi?id=1171343

 vmdb/app/models/mixins/purging_mixin.rb       | 68 +++++++++++++++++++++++
 vmdb/app/models/policy_event.rb               |  2 +
 vmdb/app/models/policy_event/purging.rb       | 40 ++++++++++++++
 vmdb/config/vmdb.tmpl.yml                     |  4 ++
 vmdb/spec/factories/policy_event.rb           |  4 ++
 vmdb/spec/models/mixins/purging_mixin_spec.rb | 79 +++++++++++++++++++++++++++
 vmdb/spec/models/policy_event/purging_spec.rb | 34 ++++++++++++
 7 files changed, 231 insertions(+)
 create mode 100644 vmdb/app/models/mixins/purging_mixin.rb
 create mode 100644 vmdb/app/models/policy_event/purging.rb
 create mode 100644 vmdb/spec/factories/policy_event.rb
 create mode 100644 vmdb/spec/models/mixins/purging_mixin_spec.rb
 create mode 100644 vmdb/spec/models/policy_event/purging_spec.rb

Comment 6 errata-xmlrpc 2015-01-14 19:44:10 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://rhn.redhat.com/errata/RHSA-2015-0028.html