Bug 895970

Summary: Remove app failed by using oo-admin-ctl-app when app gear dir doesn't exist
Product: OpenShift Container Platform Reporter: Ziqian SUN (Zamir) <zsun>
Component: ContainersAssignee: Brenton Leanhardt <bleanhar>
Status: CLOSED DEFERRED QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 1.1.0CC: dmace, gpei, jialiu, libra-onpremise-devel, lmeyer, szhou, xjia, xtian
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 884418 Environment:
Last Closed: 2013-03-07 21:04:58 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: 884418    
Bug Blocks:    

Description Ziqian SUN (Zamir) 2013-01-16 12:03:33 UTC
+++ This bug was initially created as a clone of Bug #884418 +++

Description of problem:
The app gear directory was deleted from the file system in /var/lib/openshift,   we are trying to clean up the gear from the db by using oo-admin-ctl-app, but the command always failed.

Version-Release number of selected component (if applicable):

OpenShift Enterprise puddle: 1.1.x/2013-01-14.3

How reproducible:
Always

Steps to Reproduce:
1.Create an app and remove the gear dir from node in /var/lib/openshift/<uuid>
2.Log into the broker, run the command:
  # oo-admin-ctl-app -b -a <app_name> -l <login> -c destroy
  
Actual results:
[root@ip-10-196-118-123 openshift]# oo-admin-ctl-app -b -a app2 -l gpei -c destroy
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.2.3/app/models/application.rb:373:in `destroy': Could not destroy all gears of application. (OpenShift::NodeException)
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.2.3/app/models/application.rb:332:in `cleanup_and_delete'
	from /usr/sbin/oo-admin-ctl-app:154:in `<main>'

Expected results:
The app could be destroyed successfully.

Additional info:

Comment 2 Johnny Liu 2013-01-16 14:49:08 UTC
This would be very useful for operation administrator, so raise the Severity to "medium"

Comment 3 Luke Meyer 2013-01-16 17:53:51 UTC
Could you try "force-destroy" instead of destroy? This is what ops appears to do. It merits documentation if that's the path they should take.

Comment 4 Ziqian SUN (Zamir) 2013-01-17 02:31:01 UTC
$ rhc app create app1 -t php -p redhat
Then I got uuid: 5ebc05f7271e4b42ac41f9a402aaf36b
Then on the node that my gear is on, I did like this.
# cd /var/lib/openshift/
# rm -rf 5ebc05f7271e4b42ac41f9a402aaf36b 

#ssh broker
root@broker's password: 
[root@broker ~]# oo-admin-ctl-app -a app1 -l zsun -c force-destroy
  !!!! WARNING !!!! WARNING !!!! WARNING !!!!
  You are about to destroy the app1 application.

  This is NOT reversible, all remote data for this application will be forcefully removed.
Do you want to forcefully destroy this application (y/n): y
WARNING: Check gear 5ebc05f7271e4b42ac41f9a402aaf36b on node 'node1.rhn.com', because destroy did not succeed cleanly. The gear may exist on node, but not in database.
WARNING: Please check and fix the user's consumed_gear count vs the actual gears consumed, as they may be out of sync.
Success

It is okay if I use "force-destroy", However,the bug has been fixed before in origin (see https://bugzilla.redhat.com/show_bug.cgi?id=853559) and it regresses now.

Comment 5 Luke Meyer 2013-01-17 14:30:52 UTC
The fix is supposed to be on the backend, as dmac said "This case needs to be handled by app-destroy on the node." I can't see the pull request anymore but I agree we should fix it.

For now the workaround is "force-destroy".

Comment 8 Brenton Leanhardt 2013-03-07 21:04:58 UTC
We're going to pick this up with the next rebase.