13 Commits

Author SHA1 Message Date
Peter Portante
a708295d82 Remove trailing slash for consistency
Change-Id: Idd4fd116b6be226e46e33f421883b6fb34947a84
Signed-off-by: Peter Portante <peter.portante@redhat.com>
2014-01-06 18:12:42 -05:00
Florian Hines
62254e42c4 Fix checkmount error parsing in swift-recon
- swift-recon now handles parsing instances where 'mounted' key (in unmounted
  and disk_usage) is an error message instead of a bool.
- Add's checkmount exception handling to the recon umounted endpoint.
- Updates existing unittest to have ismount throw an error.
- Updates unittests to cover the corner cases

Change-Id: Id51d14a8b98de69faaac84b2b34b7404b7df69e9
2013-12-28 20:58:27 -08:00
Kun Huang
fd4843f8e7 catch OSError to prevent breaking request /recon/diskusage
swift.common.utils.ismount maybe raise some OSError in some special
cases; and the request against /recon/diskusage doesn't handle it
before. This patch let output of mounted keyword is the error's message.

Change-Id: I5d9018f580181e618a3fa072b7a760d41795d8eb
Closes-Bug: #1249181
2013-11-13 22:46:20 +08:00
ZhiQiang Fan
f72704fc82 Change OpenStack LLC to Foundation
Change-Id: I7c3df47c31759dbeb3105f8883e2688ada848d58
Closes-bug: #1214176
2013-09-20 01:02:31 +08:00
Peter Portante
0ebddd87d1 Pep8 unit tests in middleware > 20 violations (7 of 12)
Change-Id: I9dfae1a473a8212ef25dcc01e338d8bdade7ef4e
Signed-off-by: Peter Portante <peter.portante@redhat.com>
2013-09-01 16:12:50 -04:00
Peter Portante
e0535f9bf3 Remove extra lstat() calls from check_mount
The os.path.exists call performs an lstat, but os.path.ismount already
performs the same check. However, it performs a separate lstat() call
to check for a symlink, which we remove as well, cutting the number
performed in half.

Sample program to be straced for comparison:

from swift.common.constraints import check_mount
import os
os.write(1, "Starting\n")
if check_mount("/", "tmp"):
    os.write(1, "Mounted\n")

Here is the output of a check on a mounted file system (common case)
using the new method:

---- strace new ----
write(1, "Starting\n", 9) = 9
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=8460, ...}) = 0
lstat("/tmp/..", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0
write(1, "Mounted\n", 8) = 8

---- strace old ----
write(1, "Starting\n", 9) = 9
stat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=8460, ...}) = 0
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=8460, ...}) = 0
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=8460, ...}) = 0
lstat("/tmp/..", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0
write(1, "Mounted\n", 8) = 8

Change-Id: I027c862a2b7d9ff99d7f61bd43ccc0825dba525c
Signed-off-by: Peter Portante <peter.portante@redhat.com>
2013-07-22 10:05:37 -04:00
Marcelo Martins
7fbb97b39e Retrieve the swift version with recon
Adding a '/recon/version' in order to get the swift version

Change-Id: I7b7ddbe70abb87c6a3b1010ddefa09d0acc09710
2013-05-23 15:06:12 -05:00
Greg Lange
44f00a23c1 fixed some minor things in tests that pyflakes complained about
Change-Id: Ifeab56a964630bcf941e932fcbe39e6572e62975
2013-03-26 20:42:26 +00:00
gholt
a88b412e17 swift-recon: Added oldest and most recent repl
I've been doing this with cluster-wide log searches for far too long.
This adds support for reporting the oldest replication pass
completion as well as the most recent. This is quite useful for
finding those odd replicators that have hung up for some reason and
need intervention.

Change-Id: I7fd7260eca162d6b085f3e82aaa3cf90670f2d53
2013-01-12 05:49:14 +00:00
Michael Barton
5e3e9a882d local WSGI Request and Response classes
This change replaces WebOb with a mostly compatible local library,
swift.common.swob.  Subtle changes to WebOb's API over the years have been a
huge headache.  Swift doesn't even run on the current version.

There are a few incompatibilities to simplify the implementation/interface:
 * It only implements the header properties we use.  More can be easily added.
 * Casts header values to str on assignment.
 * Response classes ("HTTPNotFound") are no longer subclasses, but partials
   on Response, so things like isinstance no longer work on them.
 * Unlike newer webob versions, will never return unicode objects.

Change-Id: I76617a0903ee2286b25a821b3c935c86ff95233f
2012-09-28 14:48:48 -07:00
Florian Hines
243b439507 Ensure empty results are returned
Make sure that empty but still valid results (like no unmounted drives)
aren't treated as 500 errors.

Change-Id: I9588e2711d7916406f15613d5a26b9f0cf38235a
2012-05-31 18:25:05 -05:00
Florian Hines
ccb6334c17 Expand recon middleware support
Expand recon middleware to include support for account and container
servers in addition to the existing object servers. Also add support
for retrieving recent information from auditors, replicators, and
updaters. In the case of certain checks (such as container auditors)
the stats returned are only for the most recent path processed.

The middleware has also been refactored and should now also handle
errors better in cases where stats are unavailable.

While new check's have been added the output from pre-existing
check's has not changed. This should allow existing 3rd party
utilities such as the Swift ZenPack to continue to function.

Change-Id: Ib9893a77b9b8a2f03179f2a73639bc4a6e264df7
2012-05-24 14:50:00 -05:00
Florian Hines
0a461a5b8a tests for recon middleware.
My first stab at unittests for the recon middleware.
Also, made some minor changes to the middleware to make testing
easier now and down the road.

Change-Id: I23ce853398ff035ffbfc2082e90e22038832b966
2012-03-19 13:44:43 -05:00