Bug 997659 - rhc snapshot restore fails if I use "tar -zcvf $UUID/" to create a tarball
rhc snapshot restore fails if I use "tar -zcvf $UUID/" to create a tarball
Status: CLOSED NOTABUG
Product: OpenShift Online
Classification: Red Hat
Component: Containers (Show other bugs)
2.x
Unspecified Unspecified
unspecified Severity low
: ---
: ---
Assigned To: Paul Morie
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-15 18:42 EDT by Nam Duong
Modified: 2015-05-14 19:26 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-20 12:03:37 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Nam Duong 2013-08-15 18:42:25 EDT
Description of problem:

See https://www.openshift.com/forums/openshift/how-to-create-a-custom-targz-package-reduced-from-my-backup-snapshot#comment-33320  

Use case:  User wants to clean up his snapshot.tar.gz before he runs snapshot-restore to save time on the upload.  Other reason is because on slow internet connections, it's easier to trigger the 1hr timeout on builds which causes the snapshot-restore to fail - the 1hr timeout includes the upload time (another questionable bug for another report).

The procedure should be easy:  
1) tar -zxvf snapshot.tar.gz
2) delete all logs and images that user doesn't care about
3) tar -zcvf snapshotUpdated.tar.gz $UUID/  
4) rhc snapshot-restore $appName --filepath snapshotUpdated.tar.gz  

Expected:  The snapshot-restore should work.
Actual: The snapshot-restore fails with error (bottom of post)

Workaround is to us "tar -zcvf snapshotUpdated.tar.gz ./$UUID/".  



Error starts here:
rhc snapshot restore wordpress --filepath worpdress2.tar.gz 
Restoring from snapshot worpdress2.tar.gz...
Removing old data dir: ~/app-root/data/*
Restoring ~/app-root/data
/bin/tar: ./*/app-root/data: Not found in archive
/bin/tar: Exiting with failure status due to previous errors
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.12.10/lib/openshift-origin-node/utils/shell_exec.rb:132:in `block (2 levels) in oo_spawn': Shell command '/bin/tar --strip=2 --overwrite -xmz ./*/app-root/data --transform="s|${OPENSHIFT_GEAR_NAME}/data|app-root/data|" --transform="s|git/.*\.git|git/${OPENSHIFT_GEAR_NAME}.git|" --exclude="./*/app-root/runtime/data" --exclude="./*/php/data" --exclude="./*/mysql/data" 1>&2' returned an error. rc=2 (OpenShift::Runtime::Utils::ShellExecutionException)
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.12.10/lib/openshift-origin-node/utils/shell_exec.rb:95:in `pipe'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.12.10/lib/openshift-origin-node/utils/shell_exec.rb:95:in `block in oo_spawn'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.12.10/lib/openshift-origin-node/utils/shell_exec.rb:94:in `pipe'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.12.10/lib/openshift-origin-node/utils/shell_exec.rb:94:in `oo_spawn'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-container-selinux-0.1.5/lib/openshift/runtime/containerization/selinux_container.rb:301:in `run_in_container_context'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.12.10/lib/openshift-origin-node/model/application_container.rb:596:in `run_in_container_context'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.12.10/lib/openshift-origin-node/model/application_container_ext/snapshots.rb:198:in `extract_restore_archive'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.12.10/lib/openshift-origin-node/model/application_container_ext/snapshots.rb:138:in `restore'
	from /usr/bin/gear:306: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)>'
Error in trying to restore snapshot. You can try to restore manually by running:
cat worpdress2.tar.gz | ssh 520d4f18500446f28c000128@wordpress-macdomain.rhcloud.com 'restore'
Comment 1 Clayton Coleman 2013-08-20 11:40:37 EDT
Code is in the node.
Comment 2 Jhon Honce 2013-08-20 12:03:37 EDT
Because of the transforms done the tar must be anchored at ./UUID

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