Bug 1154649 - Snapshot restore is not working (two scenarios)
Summary: Snapshot restore is not working (two scenarios)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Containers
Version: 2.2.0
Hardware: x86_64
OS: Mac OS
medium
medium
Target Milestone: ---
: ---
Assignee: Brenton Leanhardt
QA Contact: libra bugs
URL:
Whiteboard:
Depends On: 1147946
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-20 12:26 UTC by Brenton Leanhardt
Modified: 2014-12-10 13:24 UTC (History)
10 users (show)

Fixed In Version: openshift-origin-cartridge-jbosseap-2.22.1.1-1, openshift-origin-cartridge-jbossews-1.30.1.2-1.el6op
Doc Type: Bug Fix
Doc Text:
While restoring a snapshot for a JBoss EWS or JBoss EAP application, it was possible for the restoration to time out due to unnecessary content being stored in the snapshot. This bug fix updates the JBoss EWS and JBoss EAP cartridges to ensure that temporary artifacts are no longer snapshotted to save space and time. As a result, the time outs no longer occur. After applying this update, a cartridge upgrade is required.
Clone Of: 1147946
Environment:
Last Closed: 2014-12-10 13:24:31 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1979 0 normal SHIPPED_LIVE Red Hat OpenShift Enterprise 2.2.2 bug fix and enhancement update 2014-12-10 18:23:46 UTC

Description Brenton Leanhardt 2014-10-20 12:26:29 UTC
+++ This bug was initially created as a clone of Bug #1147946 +++

Description of problem:

I have recently migrated my account to a new account with a different domain. In order to mantain my actual apps I have loged in with rhc tools to my old account and executed two successful snapshot save <appname>. After that I have loged out of my old app and loged in again to my new app, created same two apps with same gears and cartridges and executed snapshot restore <appname> <filename> without expected results.

Specific results per app:

* Scalable php 5.3 + mysql 5.1 
    snapshot save: OK
    snapshot restore:
      - Database restore OK
      - User data folder OK
      - Code restore NOOK. After restore, default openshift landing page is showing when access app url.

* Scalable jboas7 + postgresql 9.2
    snapshot save: OK
    snapshot restore: 
      - Database restore NOOK.
      - User data folder NOOK.
      - Code restore NOOK. After long time executing rhc restore command doing restoring app-root data operation, ruby error pops out. 


Expected results:

Have my app running as it was on my old openshift account automatically.

Further actions:

I have migrated my code manualy merging new app git repo with my existing external git repo (both cases) and restoring db with pgadmin doing a port-forward rhc command.

--- Additional comment from Jessica Forrester on 2014-09-30 11:20:16 EDT ---

What were the exact commands you ran?
What was the ruby error you saw?
What OS and ruby version are you running rhc on?

--- Additional comment from German on 2014-09-30 17:49:07 EDT ---

1) What were the exact commands you ran?

rhc setup -l <user> (old account)
rhc snapshot save <appname>
rhc logout
rhc setup -l <user> (new account)
created app jboss7 scalable with postgresql 9.2 via web console.
rhc snapshot restore <appname> -f <local folder tar>


2) What was the ruby error you saw?

Removing old data dir: ~/app-root/data/*
Restoring ~/app-root/data
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.30.5/lib/openshift-origin-node/utils/shell_exec.rb:140:in `rescue in block (2 levels) in oo_spawn': Shell command '/bin/tar --strip=2 --overwrite -xmz ./*/app-root/data ./*/app-deployments --transform="s|${OPENSHIFT_GEAR_NAME}/data|app-root/data|" --transform="s|git/.*\.git|git/${OPENSHIFT_GEAR_NAME}.git|" --exclude="./*/app-root/runtime/data" --exclude="./*/jbossas/data" --exclude="./*/haproxy/data" 1>&2' exceeded timeout of 3596 (OpenShift::Runtime::Utils::ShellExecutionException)
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.30.5/lib/openshift-origin-node/utils/shell_exec.rb:123:in `block (2 levels) in oo_spawn'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.30.5/lib/openshift-origin-node/utils/shell_exec.rb:96:in `pipe'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.30.5/lib/openshift-origin-node/utils/shell_exec.rb:96:in `block in oo_spawn'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.30.5/lib/openshift-origin-node/utils/shell_exec.rb:95:in `pipe'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.30.5/lib/openshift-origin-node/utils/shell_exec.rb:95:in `oo_spawn'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-container-selinux-0.10.1/lib/openshift/runtime/containerization/selinux_container.rb:368:in `run_in_container_context'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.30.5/lib/openshift-origin-node/model/application_container.rb:795:in `run_in_container_context'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.30.5/lib/openshift-origin-node/model/application_container_ext/snapshots.rb:259:in `extract_restore_archive'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.30.5/lib/openshift-origin-node/model/application_container_ext/snapshots.rb:162:in `restore'
	from /usr/bin/gear:585:in `block (2 levels) in <main>'
	from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
	from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
	from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/command.rb:155:in `run'
	from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/runner.rb:385:in `run_active_command'
	from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/runner.rb:62:in `run!'
	from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/delegates.rb:11:in `run!'
	from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/import.rb:10:in `block in <top (required)>'


3) What OS and ruby version are you running rhc on?

MACOS maveriks - ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]

--- Additional comment from Lili Nader on 2014-10-01 15:33:06 EDT ---

I could not reproduce this problem.  The problem could be the restore times out because of size of snapshot.  Can you take a look inside your tar file and see if there are any large files inside app-root/data?

--- Additional comment from German on 2014-10-01 16:31:48 EDT ---

That folder has an sql backup of 15 MB nothing else. But tar snapshot size has 328 MB. Where jbossas and app deployments are the biggest folders. I can see that snapshot includes jbossas/standalone/tmp folder of 121 MB. 

As an idea maybe you could exclude some unnecessary folders like this tmp and others inside app-deployments when generating the snapshot via snapshot save?

--- Additional comment from Lili Nader on 2014-10-02 00:18:27 EDT ---

You can try setting a the timeout for the restore command to larger value (5 minutes or greater) and see if it works. 

rhc snapshot restore <appname> -f <local folder tar> --timeout 600

--- Additional comment from German on 2014-10-02 18:15:16 EDT ---

I have tested right now with timeout 600 but after a long time, same error as before. I suppose I could increase that timeout parameter but I don't know if this is an acceptable solution.

Any other suggestions?

--- Additional comment from openshift-github-bot on 2014-10-19 21:35:40 EDT ---

Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/b906cc06f105f4895f97859024012e6d400d63c5
Bug 1147946 - Do not snapshot jboss*/standalone/tmp

* Save time and diskspace by not snapshot'ing standalone/tmp.  Content
  will be recreated when cartridge started during restore.

Comment 3 Anping Li 2014-11-25 06:56:50 UTC
Verified and pass on puddle-2-2-2014-11-24
1. rhc app create jbosseap jbosseap mysql-5.1 -s
2. create one big files under repo and standardalone/tmp
3. rhc snapshot save jbosseap.
rhc snapshot save jbosseap
4. unzip snapshot files, all files under jbosseap/standalone/tmp directory wasn't back up.

[anli@broker ~]$ ls -lah /home/anli/jbosseap/tmp/54740acae5fed547e70000f2/jbosseap/standalone/
total 24K
drwxr-xr-x.  5 anli anli 4.0K Nov 24 21:52 .
drwxr-xr-x. 11 anli anli 4.0K Nov 24 21:51 ..
drwxr-xr-x.  3 anli anli 4.0K Nov 24 22:31 configuration
drwxr-xr-x.  8 anli anli 4.0K Nov 24 21:53 data
lrwxrwxrwx.  1 anli anli   94 Nov 24 22:36 deployments -> /var/lib/openshift/54740acae5fed547e70000f2/app-root/runtime/dependencies/jbosseap/deployments
drwxr-xr-x.  2 anli anli 4.0K Nov 24 21:52 l

5. snapshot restore to other account with different domain, same app names.
6. access app after restored, access db after restore

run same steps aganist jbossews-1.0 and jbossews-2.0. those apps  can be access after restored.

Comment 4 Brenton Leanhardt 2014-11-26 15:32:29 UTC
Hi Anping, I just noticed you filed Bug #1167599 upstream.  Rather than wait another 3 weeks for us to pull that in to OSE I think we should include it with this fix.  The fewer cartridge migrations OSE admins have to perform the better.

Comment 6 Anping Li 2014-11-27 12:09:26 UTC
Verified and pass on puddle-2-2-2014-11-26

1) standalone/tmp was replaced with /tmp. 
2) rhc snapshot jbossews. the jbossews/tmp was exclued.
3) rhc snapshot restore, the application can be restored.

Comment 8 errata-xmlrpc 2014-12-10 13:24:31 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/RHBA-2014-1979.html


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