Bug 863962 - Fail to snapshot restore using "rhc snapshot restore <appname>" on Fedora17, RHEL6.2, Ubuntu12.04, and Mac OS, also for Win7.
Summary: Fail to snapshot restore using "rhc snapshot restore <appname>" on Fedora1...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: oc
Version: 2.x
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: ---
Assignee: Fabiano Franz
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-08 07:57 UTC by Mengjiao Gao
Modified: 2015-05-15 02:06 UTC (History)
6 users (show)

Fixed In Version: rhc-0.99.5-1+
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-11-06 18:48:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
rhc snapshot from prod (34.42 KB, application/x-gzip)
2012-10-08 19:55 UTC, Fabiano Franz
no flags Details
rhc snapshot from devenv (34.86 KB, application/x-gzip)
2012-10-08 19:55 UTC, Fabiano Franz
no flags Details

Description Mengjiao Gao 2012-10-08 07:57:12 UTC
Description of problem:
After I created an application named ruby19, whose type is ruby-1.9, I execute "rhc snapshot save ruby19" to save a snapshot. Then when I used "rhc snapshot restore ruby19" to restore the app, I got error messages as below:

"Archive at ruby19.tar.gz does not contain the target application:
./*/ruby19
          If you created this archive rather than exported with rhc
snapshot save, be sure
          the directory structure inside the archive starts with
./<app_uuid>/
          i.e.: tar -czvf <app_name>.tar.gz ./<app_uuid>/"

I have checked my snapshot file -- ruby19.tar.gz, and found that there's a folder named ruby-1.9 but no ruby19 exists. If I changed the folder name to ruby19, the "rhc snapshot restore ruby19" can be executed successfully.
This issue exists on Fedora17, RHEL6.2, Ubuntu12.04, and Mac OS,but not exists on Windows7.


Version-Release number of selected component (if applicable):
server:devenv_2295
client: built from fork_ami_US2597_US2599_US2813_US2817_US2872_US2816_US2814_209


How reproducible:
always

Steps to Reproduce:
1.Created a app.
2.execute
 $ rhc snapshot save  <appname>
3.execute 
 $ rhc snapshot restore  <appname>

  
Actual results:
Got error when restore the application.
Expected results:
It should be restored successfully.
Additional info:

Comment 1 jizhao 2012-10-08 15:09:31 UTC
This bug also occurs when using rhc from master

Version:
rhc-0.99.5
devenv_2297

Steps to reproduce:
1.Create an app
$ rhc app create -a <appname> -t php-5.3 -d
2.Take snapshot of the app
$ rhc app snapshot save -a <appname> -d
3.Delete the app and create a new one(with the same name)
$ rhc app destroy -a <appname>
$ rhc app create -a <appname> -t php-5.3 -d
4.Restore the new app
$ rhc app snapshot restore -a <appname> -f <tarball> -d

Actual results:
<-----------------output------------------->
Archive at app1.tar.gz does not contain the target application: ./2e47e1b28fa44f56ad7cc3a65060149d/
If you created this archive rather than exported with rhc-snapshot, be sure
the directory structure inside the archive starts with ./<app_uuid>/
i.e.: tar -czvf <app_name>.tar.gz ./<app_uuid>/
<------------------------------------------->

Expected results:
The app should be restored successfully.

Additional info:
Restoring an existing app succeeds using rhc from master.

Comment 2 Fabiano Franz 2012-10-08 19:54:14 UTC
I was able to reproduce this problem by running the command against a fresh devenv, but using the same version of rhc cli against production the snapshot is saved and restored correctly. Inspecting both files I found that in the one created from devenv the "ruby19" (app name) file inside the tar.gz file is missing. Both files are attached.

Comment 3 Fabiano Franz 2012-10-08 19:55:00 UTC
Created attachment 623695 [details]
rhc snapshot from prod

Comment 4 Fabiano Franz 2012-10-08 19:55:25 UTC
Created attachment 623696 [details]
rhc snapshot from devenv

Comment 5 Fabiano Franz 2012-10-08 20:02:17 UTC
Yes, I came to the same conclusion (see my comment above). The bug does not occur while running it against production, no matter if using the current stable version of cli or the one from the fork_ami. So this is probably related to the creation of the snapshot in the server side, reassigning.

(In reply to comment #1)
> This bug also occurs when using rhc from master
> 
> Version:
> rhc-0.99.5
> devenv_2297
> 
> Steps to reproduce:
> 1.Create an app
> $ rhc app create -a <appname> -t php-5.3 -d
> 2.Take snapshot of the app
> $ rhc app snapshot save -a <appname> -d
> 3.Delete the app and create a new one(with the same name)
> $ rhc app destroy -a <appname>
> $ rhc app create -a <appname> -t php-5.3 -d
> 4.Restore the new app
> $ rhc app snapshot restore -a <appname> -f <tarball> -d
> 
> Actual results:
> <-----------------output------------------->
> Archive at app1.tar.gz does not contain the target application:
> ./2e47e1b28fa44f56ad7cc3a65060149d/
> If you created this archive rather than exported with rhc-snapshot, be sure
> the directory structure inside the archive starts with ./<app_uuid>/
> i.e.: tar -czvf <app_name>.tar.gz ./<app_uuid>/
> <------------------------------------------->
> 
> Expected results:
> The app should be restored successfully.
> 
> Additional info:
> Restoring an existing app succeeds using rhc from master.

Comment 6 Rony Gong 🔥 2012-10-10 07:21:28 UTC
Although could work in win7, but after restore mysql or mongodb, the data doesn't restore back, and for restore postgresql works fine.

Restore mysql--------------------:
Restoring from snapshot ./qspython.tar.gz...
Waiting for stop to finish

    *********************************************************************

    You are accessing a service that is for use only by authorized users.  
    If you do not have authorization, discontinue use at once. 
    Any use of the services is subject to the applicable terms of the 
    agreement which can be found at: 
    https://openshift.redhat.com/app/legal

    *********************************************************************

    Welcome to OpenShift shell

    This shell will assist you in managing OpenShift applications.

    !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!
    Shell access is quite powerful and it is possible for you to
    accidentally damage your application.  Proceed with care!
    If worse comes to worst, destroy your application with 'rhc app destroy'
    and recreate it
    !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!

    Type "help" for more info.

WARNING: This ssh terminal was started without a tty.
          It is highly recommended to login with: ssh -t
Done
Removing old data dir: ~/app-root/data/*
Restoring ~/app-root/data

gzip: stdin: not in gzip format
/bin/tar: Child died with signal 13
/bin/tar: Error is not recoverable: exiting now
Running extra restore for mysql-5.1
MySQL restore attempted but no dump found!
/var/lib/openshift/c9ade59ce0294fedba67721120f3df26/app-root/data//mysql_dump_snapshot.gz does not exist

    *********************************************************************

    You are accessing a service that is for use only by authorized users.  
    If you do not have authorization, discontinue use at once. 
    Any use of the services is subject to the applicable terms of the 
    agreement which can be found at: 
    https://openshift.redhat.com/app/legal

    *********************************************************************

    Welcome to OpenShift shell

    This shell will assist you in managing OpenShift applications.

    !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!
    Shell access is quite powerful and it is possible for you to
    accidentally damage your application.  Proceed with care!
    If worse comes to worst, destroy your application with 'rhc app destroy'
    and recreate it
    !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!

    Type "help" for more info.

WARNING: This ssh terminal was started without a tty.
          It is highly recommended to login with: ssh -t
Done
Terminating...

RESULT:
Success

Restore mongodb------------------:
Restoring from snapshot ./qsphp.tar.gz...
Waiting for stop to finish

    *********************************************************************

    You are accessing a service that is for use only by authorized users.  
    If you do not have authorization, discontinue use at once. 
    Any use of the services is subject to the applicable terms of the 
    agreement which can be found at: 
    https://openshift.redhat.com/app/legal

    *********************************************************************

    Welcome to OpenShift shell

    This shell will assist you in managing OpenShift applications.

    !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!
    Shell access is quite powerful and it is possible for you to
    accidentally damage your application.  Proceed with care!
    If worse comes to worst, destroy your application with 'rhc app destroy'
    and recreate it
    !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!

    Type "help" for more info.

WARNING: This ssh terminal was started without a tty.
          It is highly recommended to login with: ssh -t
Done
Removing old data dir: ~/app-root/data/*
Restoring ~/app-root/data

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error is not recoverable: exiting now
Running extra restore for mongodb-2.2
MongoDB restore attempted but no dump was found!

!ERROR! /var/lib/openshift/7446c59260b24f41a21e10452f8dc4ae/app-root/data//mongodb_dump_snapshot.tar.gz does not exist


    *********************************************************************

    You are accessing a service that is for use only by authorized users.  
    If you do not have authorization, discontinue use at once. 
    Any use of the services is subject to the applicable terms of the 
    agreement which can be found at: 
    https://openshift.redhat.com/app/legal

    *********************************************************************

    Welcome to OpenShift shell

    This shell will assist you in managing OpenShift applications.

    !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!
    Shell access is quite powerful and it is possible for you to
    accidentally damage your application.  Proceed with care!
    If worse comes to worst, destroy your application with 'rhc app destroy'
    and recreate it
    !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!

    Type "help" for more info.

WARNING: This ssh terminal was started without a tty.
          It is highly recommended to login with: ssh -t
Done
Terminating...

RESULT:
Success

Comment 7 Jhon Honce 2012-10-10 17:23:24 UTC
ffranz will merge after review. 

Fixed in https://github.com/openshift/rhc/pull/174

Comment 8 Mengjiao Gao 2012-10-15 07:47:19 UTC
Tested this issue on devenv_2327, used the client built from devenv_2327, the issue have been fixed on devenv_2327.
 
I tested this issue with steps as follows:
1.rhc app create -a app2 -t jbosseap-6.0
2.rhc app cartridge add -a app2 -c mongodb-2.2 
3.rhc app snapshot save -a app2
4.rhc app snapshot restore -a app2 -p redhat
At step 4, the app restore successfully with output as follows:
##################################################
restart_on_add=false
Sending SIGTERM to jboss:2831 ...
kill -TERM 3018
kill -TERM 2831
Done
Removing old git repo: ~/git/app2.git/
Removing old data dir: ~/app-root/data/*
Restoring ~/git/jbosseap-6.0.git and ~/app-root/data
.........................
[INFO] WEB-INF/web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.312s
[INFO] Finished at: Mon Oct 15 03:44:10 EDT 2012
[INFO] Final Memory: 15M/55M
[INFO] ------------------------------------------------------------------------
Running .openshift/action_hooks/build
MongoDB already running
Running .openshift/action_hooks/deploy
hot_deploy_added=false
MongoDB already running
Found 127.0.255.129:8080 listening port
Done
Running .openshift/action_hooks/post_deploy

##################################################


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