Commit Graph

164 Commits

Author SHA1 Message Date
Warren Usui
36b07b8aee Use SFTPClienti get for long reads/writes
Modified remote.py to use the paramiko SFTPClient get
method to extract long files (mostly tar files) from
the remote host.  The code formerly saved the data
in a long local string which was very inefficient.

Fixes: 8261
Signed-off-by: Warren Usui <warren.usui@inktank.com>
2014-05-06 14:59:52 -05:00
Zack Cerza
091d1fe48d Revert "Revert "Clean up remote.py and misc.py changes.""
This reverts commit 02504c3fd2.
2014-05-06 14:59:52 -05:00
Zack Cerza
0268487057 Revert "Revert "Handle raw data I/O.""
This reverts commit 0c8a3e2334.
2014-05-06 14:59:51 -05:00
Zack Cerza
0c8a3e2334 Revert "Handle raw data I/O."
This reverts commit 257e1459fa.
2014-05-05 10:03:29 -05:00
Zack Cerza
02504c3fd2 Revert "Clean up remote.py and misc.py changes."
This reverts commit 74eff43ee1.
2014-05-05 10:03:18 -05:00
Warren Usui
74eff43ee1 Clean up remote.py and misc.py changes.
Fixed method names to be non-redundant (remote_mktemp in remote is
now just mktemp, for example), and made some parameters be more
self descriptive.  Added some docstrings.  Fixed sudo setting in
get_file method.

Made chmod independent of the actual sftp file getting.
Do not do extra file copy if non-sudo read is needed.
Fixed some parameter names. Made sure temp files are removed.
2014-04-29 16:14:11 -05:00
Warren Usui
257e1459fa Handle raw data I/O.
Paramiko 1.13.0 checks data in the Channel and fails if
invalid UTF-8 characters are sent.  The teuthology/misc.py
functions that piped cat output (get_file) and piped tar
output (pull_directory and pull_directory_tarball) formerly
did not work for Paramiko 1.13.0.

Code was changed to use SFTPClient to copy raw data.  The
remote_mktemp and function was changed to be a method of the
remote object.  Remote object methods to copy files and write
tar files were also added.

In misc.py, get_file() was changed to be a wrapper around the
remote object call.  Pull_directory() and pull_directory_tarball
were changed to use the remote object methods as well.

The remote methods used to send the data makes use of the
SFTPClient interface in Paramiko.

The remote_mktemp function was also modified slightly to insure
that new-lines do not appear in temp file names.

Fixes: 8116
Signed-off-by: Warren Usui <warren.usui@inktank.com>
2014-04-29 16:14:11 -05:00
Zack Cerza
158f9ba1ff Revert "Lines formerly of the form '(remote,) = ctx.cluster.only(role).remotes.keys()'"
This reverts commit d693b3f895.
2014-03-27 11:35:28 -05:00
Warren Usui
d693b3f895 Lines formerly of the form '(remote,) = ctx.cluster.only(role).remotes.keys()'
and '(remote,) = ctx.cluster.only(role).remotes.iterkeys()' would fail with
ValueError and no message if there were less than 0 or more than 1 key.
Now a new function, get_single_remote_value() is called which prints out
more understandable messages.

Fixes: 7510
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Signed-off-by: Warren Usui <warren.usui@inktank.com>
2014-03-26 18:43:48 -07:00
Zack Cerza
73849c1179 Update safe_while's suggested usage pattern
I didn't love the way safe_while was encouraged to be used and it didn't
fit right with the new no-raising behavior. Now it's encouraged to be
used like this:

with safe_while() as proceed:
    while proceed():
        do_things()

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-03-08 15:19:31 -06:00
Zack Cerza
ec38bd3cb3 Use safe_while's action arg
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-03-07 14:04:49 -06:00
Zack Cerza
7604a1b670 Update safe_while users to reflect new defaults
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-03-07 13:36:35 -06:00
Zack Cerza
4b11d072bf Mark this 'while True' loop with 'finite' comment
If we're going to embark on a mission to rid ourselves of
infinitely-looping while loops, it seems smart to start marking the ones
we've fixed in order to make grepping for unfixed loops easier.

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-03-06 23:09:44 -06:00
Zack Cerza
20bfc97844 Give up on wait_until_healthy() after 15min
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-03-06 22:32:29 -06:00
Zack Cerza
e3f336d15b Make reconnect() use Remote.reconnect()
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-02-20 17:46:08 -06:00
Zack Cerza
61e9ac4db5 Move reboot() to teuthology.misc
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-02-20 17:46:08 -06:00
Zack Cerza
74355e54e5 Add optional 'owner' arg to sudo_write_file()
This gets passed directly to chown as 'sudo chown $owner $file'

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-02-20 17:46:06 -06:00
Zack Cerza
dfe60526eb Add copy_file() to scp files between remotes
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-02-20 17:46:05 -06:00
Warren Usui
bee587c33d Added some docstrings.
Fixes: 7002
Signed-off-by: Warren Usui <warren.usui@inktank.com>
2014-02-13 17:40:25 -08:00
Zack Cerza
427bf93c88 Fix PEP-8 linter complaints
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2014-01-28 09:54:54 -06:00
John Spray
9ff4d4a4e7 Fix FSID not being set in ceph.conf
Symptom was that 'ceph --admin-daemon... config get fsid'
returned zeros, while correct fsid was present in cluster maps.
Fix it by populating FSID in ceph.conf, after extracting it from
monmap.
2013-12-12 13:34:52 -08:00
Zack Cerza
3d6feb4b60 Merge pull request #151 from ceph/wip-distro-kernel
Wip distro kernel
2013-12-09 13:16:33 -08:00
Sandon Van Ness
c0297b436a Changes suggested per review.
Signed-off-by: Sandon Van Ness <sandon@inktank.com>
2013-11-25 01:19:13 -08:00
Sandon Van Ness
c38eeec85f Allow ability to use multi machine type deliminated by ,- \t.
I was originally attempting a more complicated locking mechanism
but I think its almost as good to just have it attempt the other
machine type if one.

Signed-off-by: Sandon Van Ness <sandon@inktank.com>
2013-11-21 14:19:44 -08:00
Sandon Van Ness
f0e01ad0e5 Distro kernel bug-fixes.
Fixed some things that were being done incorrectly.

Some distro kernels have no debug so added | true when disabling
kdb. Also changed what was skipping kernels if non-ubuntu to also
schedule kernel install if a distro kernel.

Signed-off-by: Sandon Van Ness <sandon@inktank.com>
2013-11-08 14:35:51 -08:00
Sandon Van Ness
03f31c6caf Consolidate two excepts into one.
Signed-off-by: Sandon Van Ness <sandon@inktank.com>
2013-11-08 11:02:48 -08:00
Sandon Van Ness
90161a371e Fixed errors. Tests pass.
Since the default OS version is different for each distro the
argument default is None instead of explicity set to a value
like with get_distro. Fixed some logic around that and the tests
making the arugment always take precidence.

Signed-off-by: Sandon Van Ness <sandon@inktank.com>
2013-10-28 11:04:28 -07:00
Sandon Van Ness
d4a632df5f Support --os-version as argument.
You can use --os-type as an argument when not running teuthology
tests but instead just using teuthology-lock. This adds the ability
to also use --os-version so you can specify the version of the
distro without having to run an actual test with a yaml like you
normally would have had to do setting os_version in the yaml.

Signed-off-by: Sandon Van Ness <sandon@inktank.com>
2013-10-25 17:48:50 -07:00
Zack Cerza
f5729051ab Fix a circular import
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
2013-10-11 12:48:55 -05:00
Zack Cerza
8a11e4d053 Remove unused variables
(cherry picked from commit 581b6b3e977b99fc58fe25e66c933c65e38dc87c)
2013-09-26 14:01:56 -05:00
Zack Cerza
8497437003 Remove unused imports
(cherry picked from commit 586817481119c4fc4a39f8804e7871a43491e01f)
2013-09-26 14:01:37 -05:00
Zack Cerza
fad71073e2 Be less picky about trailing slashes. 2013-09-16 12:35:30 -05:00
Zack Cerza
31f0f7ad7e Fix get_http_log_path(), update callers, add tests 2013-09-12 17:28:50 -05:00
Zack Cerza
df4925703e Passing job_id to get_http_log_path() is optional 2013-09-11 13:47:49 -05:00
Zack Cerza
c1ba276321 Move get_http_log_path 2013-09-11 10:50:42 -05:00
Sage Weil
5acc57f5ad remove basedir/testdir distinction
We should never run with a conflicting testdir in the basedir, and the
code to do this is confusing and buggy.  Go back to a single testdir and
simple checks.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-09-10 10:53:41 -07:00
Sage Weil
9e03c73775 misc: valgrind: fix cd behavior
The cd needs to happen at the beginning of the command, not at the end, or
else the funky wrapper scripts don't work right.

This also cleans up the command line construction a bit so that it is more
flexible, explicit, and hopefully less fragile.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-09-06 16:09:27 -07:00
Sage Weil
19324c63d2 misc: valgrind: fix valgrind.supp path
Signed-off-by: Sage Weil <sage@inktank.com>
2013-09-06 16:09:27 -07:00
Zack Cerza
82cfa848b4 Get rid of chdir-coredump. 2013-09-06 17:11:44 -05:00
Sage Weil
2214fe1845 misc: valgrind --num-callers=50
Default is 12, which isn't quite enough.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-09-06 14:05:29 -07:00
Zack Cerza
53b8e27da9 Helper scripts live in /usr/local/bin now! 2013-09-06 15:10:11 -05:00
Zack Cerza
90f9a6ada1 Add get_archive_dir() 2013-09-05 16:55:37 -05:00
Zack Cerza
f744c4ce53 Catch CommandFailedError and print debug info 2013-09-03 14:40:31 -05:00
Sage Weil
3d64322cdb Revert "get_scratch_devices(): catch CommandFailedError, log "dev in use""
This reverts commit 416508de9c.

NameError: global name 'CommandFailedError' is not defined
2013-08-30 23:22:24 -07:00
Dan Mick
416508de9c get_scratch_devices(): catch CommandFailedError, log "dev in use"
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2013-08-30 15:42:53 -07:00
Zack Cerza
3981a8f1af Never use 'except:' without specifying an Exception. 2013-08-30 11:10:05 -05:00
Zack Cerza
71a77f2908 Add get_test_user(), because hardcoding is bad 2013-08-20 16:25:25 -05:00
Alfredo Deza
0a8a1c98b0 Merge pull request #41 from ceph/wip-3791
Various usability and documentation fixes
2013-08-19 14:10:18 -07:00
Zack Cerza
5bd7f620b8 Add comment about portability to get_testdir_base() 2013-08-19 09:59:54 -05:00
Warren Usui
694cd67048 Fix ARM releases to be quantal armv7l releases.
Made grub execution conditional and not done when ARM.
Use ctx parameter to change machine type to tala.
Fix kernel assignments when running ARM systems.

Fixes: #5000
Signed-off-by: Warren Usui <warren.usui@inktank.com>
2013-08-16 15:44:54 -07:00