23 Commits

Author SHA1 Message Date
Jenkins
bdac96e10d Merge "Call out transient sysmeta in swift-object-info" 2016-12-08 19:42:04 +00:00
Gábor Antal
488f88e30a Use more specific asserts in test/unit/cli tests
I changed asserts with more specific assert methods.
e.g.: from assertTrue(sth == None) to assertIsNone(*) or
assertTrue(isinstance(inst, type)) to assertIsInstace(inst, type)
or assertTrue(not sth) to assertFalse(sth).

The code gets more readable, and a better description will be shown on fail.

Change-Id: I39305808ad2349dc11a42261b41dbb347ac0618a
2016-08-03 12:19:40 +00:00
Samuel Merritt
457cea864c Handle IPv6 addresses in swift-get-nodes.
The curl commands needed a little tweaking.

Change-Id: I6551d65241950c65e7160587cc414deb4a2122f5
Closes-Bug: 1555860
2016-07-28 11:59:51 -07:00
Tim Burke
07a157f98e Call out transient sysmeta in swift-object-info
This is similar to the separate output sections for sysmeta and user
meta.

Change-Id: Icc1fd86b2f7dcc085fee8ee94ec331290b530521
2016-07-14 10:51:02 -05:00
Paul Dardeau
331382e192 Add unit tests to cover print_item_locations
Add unit tests to cover all code paths in print_item_locations
function in cli/info.py.

Update comment to match what's tested for invalid/missing policy.

Update tests to verify output of print_item_locations

Corrected PEP8 compliance violations.

Change-Id: I84958cb70205ee8d7ea246826dd56201fa642da9
2015-11-05 20:58:34 +00:00
janonymous
f449e91472 pep8 fix: assertEquals -> assertEqual
assertEquals is deprecated in py3, fixing in:
dir: test/unit/cli/*

Change-Id: I9a2fc1f717beafd5fa8408942046e310e8de0318
2015-08-05 22:32:02 +05:30
Jenkins
3691c08e98 Merge "Use right most occurrence object dir in diskfile.extract_policy" 2015-07-27 21:26:16 +00:00
Clay Gerrard
83025ff38d Use right most occurrence object dir in diskfile.extract_policy
I like using the rightmost one more; it's basically
  /operator-defined/mountpoint/objects/part/suffix/hash/ts.data, so I
  don't see any opportunity for other things named "objects" to creep in on the
  right of the real objects-N dir; but I could see some admin using
  /srv/object-storage/ or something

    -- Torgomatic The Wise

Change-Id: I0a63a3e02df091a5ee2e110a345183012e357a2f
2015-07-24 20:31:45 -07:00
Jenkins
2d39102b66 Merge "Fix swift-object-info to show policy index at deep working directory" 2015-07-24 18:12:05 +00:00
Daisuke Morita
3d9b2d077a Fix swift-object-info to show policy index at deep working directory
If swift-object-info command is executed at deeper working directory
than 'objects-*' directory, it cannot parse policy index from file path
so it does not show appropriate policy index. This patch fixes this
problem by simply extracting the full path of a target object file.

Change-Id: Idb734106a44b6121119c9b1dc8cdaaf4c6c28c31
Closes-Bug: 1469951
2015-07-24 22:21:25 +09:00
Victor Stinner
6e70f3fa32 Get StringIO and cStringIO from six.moves
* replace "from cStringIO import StringIO"
  with "from six.moves import cStringIO as StringIO"
* replace "from StringIO import StringIO"
  with "from six import StringIO"
* replace "import cStringIO" and "cStringIO.StringIO()"
  with "from six import moves" and "moves.cStringIO()"
* replace "import StringIO" and "StringIO.StringIO()"
  with "import six" and "six.StringIO()"

This patch was generated by the stringio operation of the sixer tool:
https://pypi.python.org/pypi/sixer

Change-Id: Iacba77fec3045f96773d1090c0bd48613729a561
2015-07-15 16:56:33 +02:00
Mark Seger
af734b3fb6 Change usage help and Attention messages to warnings
Change-Id: I1396aaffe36e739606f15f7fef37b11bd83f1fc1
2015-06-03 15:32:25 -04:00
Jenkins
ad66801915 Merge "More user-friendly output for object metadata" 2015-04-16 22:15:05 +00:00
Ricardo Ferreira
57011d5699 More user-friendly output for object metadata
Split out system, user and other metadata in swift-object-info. Print
every position line by line instead of raw dict representation, so it
would be easier to parse with tools such as grep.

Co-Authored-By: Ricardo Ferreira <ricardo.sff@gmail.com>
Co-Authored-By: Kamil Rykowski <kamil.rykowski@intel.com>

Change-Id: Ia78da518c18f7e26016700aee87efb534fbd2040
Closes-Bug: #1428866
2015-04-16 09:20:14 +02:00
Alistair Coles
15b83f67d2 Test swift-object-info opens meta and ts files
Adds a unit test to verify the change made in [1], i.e. that
swift-object-info will read from .meta and .ts files as well
as .data files.

[1] change I43966d371218ad39414e9282cde579e48370a2a7

Change-Id: I82dde36e3a96db1a21cfe9a4cca0d941e543dfd0
Related-Bug: 1425679
2015-03-18 12:43:03 +00:00
Christian Berendt
f6ff06b678 Use except x as y instead of except x, y
According to https://docs.python.org/3/howto/pyporting.html the
syntax changed in Python 3.x. The new syntax is usable with
Python >= 2.6 and should be preferred to be compatible with Python3.

Enabled hacking check H231.

Change-Id: I2c41dc3ec83e79181e8fd50e76771a74c393269c
2014-07-07 15:42:13 -07:00
Clay Gerrard
c1dc2fa624 Add two vector timestamps
The normalized form of the X-Timestamp header looks like a float with a fixed
width to ensure stable string sorting - normalized timestamps look like
"1402464677.04188"

To support overwrites of existing data without modifying the original
timestamp but still maintain consistency a second internal offset
vector is append to the normalized timestamp form which compares and
sorts greater than the fixed width float format but less than a newer
timestamp.  The internalized format of timestamps looks like
"1402464677.04188_0000000000000000" - the portion after the underscore
is the offset and is a formatted hexadecimal integer.

The internalized form is not exposed to clients in responses from Swift.
Normal client operations will not create a timestamp with an offset.

The Timestamp class in common.utils supports internalized and normalized
formatting of timestamps and also comparison of timestamp values.  When the
offset value of a Timestamp is 0 - it's considered insignificant and need not
be represented in the string format; to support backwards compatibility during
a Swift upgrade the internalized and normalized form of a Timestamp with an
insignificant offset are identical.  When a timestamp includes an offset it
will always be represented in the internalized form, but is still excluded
from the normalized form.  Timestamps with an equivalent timestamp portion
(the float part) will compare and order by their offset.  Timestamps with a
greater timestamp portion will always compare and order greater than a
Timestamp with a lesser timestamp regardless of it's offset.  String
comparison and ordering is guaranteed for the internalized string format, and
is backwards compatible for normalized timestamps which do not include an
offset.

The reconciler currently uses a offset bump to ensure that objects can move to
the wrong storage policy and be moved back.  This use-case is valid because
the content represented by the user-facing timestamp is not modified in way.
Future consumers of the offset vector of timestamps should be mindful of HTTP
semantics of If-Modified and take care to avoid deviation in the response from
the object server without an accompanying change to the user facing timestamp.

DocImpact
Implements: blueprint storage-policies
Change-Id: Id85c960b126ec919a481dc62469bf172b7fb8549
2014-06-19 10:18:06 -07:00
Yuan Zhou
6cc10d17de Update bin scripts to be storage policy aware
swift-container-info:
    Print policy container info

swift-object-info:
    Allow to specify storage policy name when looking for object info
    Notify if there is missmatch between ring location and the actual
    object path in filesystem

swift-get-nodes:
    Allow to specify storage policy name when looking for account/
    container/object ring location
    Notify if there is missmatch between ring and the policy

Lookup policy name in swift.conf; 'Legacy' container will use
policy-0's name; 'Unknown' is shown if policy not found in swift.conf

DocImpact
Implements: blueprint storage-policies
Change-Id: I450d40dc6e2d8f759187dff36d658e52737ae2a5
2014-06-18 20:57:09 -07:00
Clay Gerrard
7624b198cf Update FakeRing and FakeLogger
FakeLogger gets better log level handling

Parameterize logger on some daemons which were previously
unparameterized and try and use the interface in tests.

FakeRing use more real code

The existing FakeRing mock's implementation bit me on some pretty subtle
character encoding issue by-passing the hash_path code that is normally
part of get_part_nodes.  This change tries to exercise more of the real
ring code paths when it makes sense and provide a better Fake for use in
testing.

Add write_fake_ring helper to test.unit for when you need a real ring.

DocImpact
Implements: blueprint storage-policies
Change-Id: Id2e3740b1dd569050f4e083617e7dd6a4249027e
2014-06-18 17:31:37 -07:00
Paul Luse
856c15539a Fix testcase test_print_db_info_metadata()
Test compares cluster info to hardcoded expected data and wasn't
sorting the two sets of things being compared leading to some
sporadic unit test failures.

Change-Id: I3ef98260a62c15d06ba8cc196196d4e90abca3f0
2014-04-14 16:14:30 -07:00
Madhuri Kumari
67fff5b297 Print 'Container Count' in data base info
Currently, 'Container Count' was missing in data base info.
So this patch will help printing 'Container Count' also.

Change-Id: I1ca80ee79e71b086b30fd2d1ab024ea1cfb324f5
2014-04-12 09:20:06 +05:30
Peter Portante
de020f0189 Handle getting info on wrong database type
Change-Id: I32f66f6a7683180a18a2807143d0910c75bf16f0
2014-04-03 15:56:25 -04:00
Yuan Zhou
39f5eab890 Clean up swift-{account, container}-info
Reuse common code; add unit tests; ensured coverage was at 100%.

Change-Id: Id6fcc7cb07fd178e00d43968e3e2cc03226fdc05
2014-04-03 09:54:58 -04:00