Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

objectstore tool lookup by name & --op list filter #3020

Merged
15 commits merged into from Dec 5, 2014
Merged

objectstore tool lookup by name & --op list filter #3020

15 commits merged into from Dec 5, 2014

Conversation

ghost
Copy link

@ghost ghost commented Nov 26, 2014

No description provided.

@ghost ghost added core feature labels Nov 26, 2014
@ghost ghost assigned dzafman Nov 26, 2014
@ghost
Copy link
Author

ghost commented Nov 26, 2014

@dzafman this will make it significantly easier to use ceph_objectstore_tool for tests (test_repair.py etc.)

@loic-bot
Copy link

@ghost ghost changed the title objectstore tool lookup by name objectstore tool lookup by name & --op list filter Nov 26, 2014
@ghost
Copy link
Author

ghost commented Nov 26, 2014

repushed a version implementing what we discussed with one exception: I kept the object mapping because it turns out to be easy to keep. I changed it to return on error when there are multiple objects. I must confess that part of the reason for me to keep this is irrational (it is sometime difficult to let go of a piece of code ;-) and if you still think it would be better to remove it, I'll follow your advice.

@loic-bot
Copy link

@ghost
Copy link
Author

ghost commented Dec 2, 2014

@dzafman sorry, this is actually this one, not #3033 ;-) The reason why it shows up in more than one place is because I used them to write tests because it's convenient. Sorry for the confusion.

@loic-bot
Copy link

loic-bot commented Dec 4, 2014

@ghost
Copy link
Author

ghost commented Dec 4, 2014

@dzafman added your changes and run in gitbuilder. Reviewed-by: from my point of view :-)

ldachary and others added 10 commits December 5, 2014 13:01
Signed-off-by: Loic Dachary <ldachary@redhat.com>
Abstract out the PG exploration loops and encapsulate the list-lost and
fix-lost semantic in a callable object.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
If the object is not a parsable JSON string, assume an object name and
look it up in all the PGs. If multiple objects have the same name, only
apply the command to one of them. It is primarily useful in a test
environment where the names of the tests objects are known and only a
small number of objects exists. It replaces the following:

    path='--data-path dev/osd0 --journal-path dev/osd0.journal'
    for pgid in $(./ceph_objectstore_tool $path --op list-pgs) ; do
      object=$(./ceph_objectstore_tool $path --pgid $pgid --op list |
               grep '"oid":"NAME"')
      test -n "$object" && break
    done
    ./ceph_objectstore_tool $path --pgid $pgid "$object" remove

with:

    ./ceph_objectstore_tool $path NAME remove

http://tracker.ceph.com/issues/10192 Fixes: #10192

Signed-off-by: Loic Dachary <ldachary@redhat.com>
The positional object name is used to filter the output of --op list and
only show the objects with a matching name. If both the object name and
the pgid are omitted, all objects from all PGs are displayed.

The output format is changed from

    {"oid":"GROUP","key":"","snapid":-2,
     "hash":2659194943,"max":0,"pool":0,"namespace":""}

to

    [["0.7_head",{"oid":"GROUP","key":"","snapid":-2,
                  "hash":2659194943,"max":0,"pool":0,
                  "namespace":""}]]

where the first member is the pgid where the object is found.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
The object format changed from

    {json object}

to

    [pgid,{json object}]

The parser is updated accordingly. If the --pgid is present, check that
it equals the pgid from the object description.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
Signed-off-by: Loic Dachary <ldachary@redhat.com>
Signed-off-by: David Zafman <dzafman@redhat.com>
Instead of a parsable array make it easier to cut and paste listed objects

Signed-off-by: David Zafman <dzafman@redhat.com>
Signed-off-by: David Zafman <dzafman@redhat.com>
…y output

Signed-off-by: David Zafman <dzafman@redhat.com>
@ghost
Copy link
Author

ghost commented Dec 5, 2014

Reminder (I got confused today because I did not remember the chain of pull requests): this pull request is blocking #3033 which is blocking #3034

@dzafman
Copy link
Contributor

dzafman commented Dec 5, 2014

Reviewed-by: David Zafman dzafman@redhat.com

--pretty-format defaults true
Add --format so xml output can be requested
--op list defaults to single line of json per object
To override this more human readable output use --pretty-format=false
Add testing of --op list special handling

Signed-off-by: David Zafman <dzafman@redhat.com>
Signed-off-by: David Zafman <dzafman@redhat.com>
Signed-off-by: David Zafman <dzafman@redhat.com>
Signed-off-by: David Zafman <dzafman@redhat.com>
It isn't anticipated that anyone would use this but keeps backward compatible

Signed-off-by: David Zafman <dzafman@redhat.com>
@loic-bot
Copy link

loic-bot commented Dec 5, 2014

ghost pushed a commit that referenced this pull request Dec 5, 2014
objectstore tool lookup by name & --op list filter

Reviewed-by: David Zafman <dzafman@redhat.com>
Reviewed-by: Loic Dachary <ldachary@redhat.com>
@ghost ghost merged commit e6558b4 into ceph:master Dec 5, 2014
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants