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
mon/MDSMonitor.cc:refuse fs new on pools with obj #12825
Conversation
@@ -1581,6 +1582,12 @@ int MDSMonitor::management_command( | |||
return -ENOENT; | |||
} | |||
|
|||
int64_t metadata_num_objects = mon->pgmon()->pg_map.pg_pool_sum[metadata].stats.sum.num_objects; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has just occurred to me that we will sometimes want to permit this, in order to enable people to do an "fs new", "fs reset" type procedure -- that is permitted for people who make the mistake of doing an "fs rm" but still have all their objects. Could you add a --force flag here?
from tasks.cephfs.cephfs_test_case import CephFSTestCase | ||
from teuthology.orchestra.run import CommandFailedError | ||
|
||
class TestFSNew(CephFSTestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move this file to test_misc.py please? That way it will get picked up and run and we avoid the need to create a separate yaml as @tchaikov mentions (it makes our tests take a bit less time if we bundle things like that, it's all a bit arbitrary though!)
|
||
dummyfile = '/etc/fstab' | ||
|
||
self.fs.put_metadata_object_raw("key", dummyfile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could just use an inline string like "foobar" instead of dummyfile here -- put_metadata_object_raw isn't reading a file or anything like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand. Isn't this calling:
bin/rados -p cephfs_metadata put key "/etc/fstab"
which I thought requires a file as last argument?
@@ -0,0 +1,64 @@ | |||
import errno | |||
import time | |||
from unittest import SkipTest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SkipTest import is unused
|
||
class TestFSNew(CephFSTestCase): | ||
def test_fs_new(self): | ||
data_pool_name = "{0}_data".format(self.fs.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use self.fs.get_data_pool_name()
timeout = 10 | ||
elapsed = 0 | ||
|
||
while True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a wait_until_true function for situations like this. Something like:
self.wait_until_equal(lambda: self.fs.get_pool_df(self.fs.metadata_pool_name)['objects'] > 0, timeout=timeout)
@jcsp |
Oops, you are correct about the put_metadata_object_raw usage, I had misread it |
@stiopaa1 thanks for updating, this is ready to merge, please squash |
59cc219
to
7942dc7
Compare
@jcsp |
Ah, now we can see that this also needs an update to the test script in qa/workunits/cephtool/test.sh:
You can debug this on a local vstart cluster by invoking it from a built directory something like this: |
7942dc7
to
21030ff
Compare
@jcsp |
int64_t metadata_num_objects = mon->pgmon()->pg_map.pg_pool_sum[metadata].stats.sum.num_objects; | ||
if (force != "--force" && metadata_num_objects > 0) { | ||
ss << "pool '" << metadata_name | ||
<< "' already contains some objects. Use another pool which is empty."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a native english speaker please correct me, but this phrase feels funny. I'd personally go with "Use an empty pool instead", or something of the sorts. The which is empty
portion makes me all tingly (I should probably see a doctor about that...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only slightly awkward. "Use an empty pool instead" would be a bit simpler (and maybe also easier to parse for users with limited english?). Up to @stiopaa1 if you want to come back and edit this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes: http://tracker.ceph.com/issues/11124 Signed-off-by: Michal Jarzabek <stiopa@gmail.com>
21030ff
to
052c3d3
Compare
updated to "Use an empty pool instead" |
Fixes: http://tracker.ceph.com/issues/11124
Signed-off-by: Michal Jarzabek stiopa@gmail.com