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
hammer: rbd: snap rollback: restore the link to parent #8535
Conversation
const SnapInfo& si(it->second); | ||
// current parent does not match the one of the snapshot being reverting to | ||
bool should_update_parent = ictx->parent_md.spec != si.parent.spec || | ||
ictx->parent_md.overlap != si.parent.overlap; |
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.
If the overlap changes (but parent record still exists), the cls set_parent
method will return -EEXISTS
when trying to update the parent record. Therefore, you will need to remove_parent
first. Also need to support the case where HEAD is associated with a parent but the rollback snapshot doesn't have a parent.
5384d69
to
85f611d
Compare
Done.
Done.
Done.
I've added parent info checks, however think it's important to verify if the actual data matches the expected one.
I've implemented no parent -> parent, parent -> no parent tests, however I don't quite understand which operations can change the overlap size. Any hints, please? |
@asheplyakov The only way to change the overlap size is to shrink the image. So if you resize the image down past the original parent size, the overlap is now smaller. |
85f611d
to
60cc14e
Compare
I've added a test which verifies that rollback handles such a modification. Does the patch look OK now? |
CephContext *cct = ictx->cct; | ||
int r = 0; | ||
std::map<librados::snap_t, SnapInfo>::const_iterator it = ictx->snap_info.find(snap_id); | ||
assert(it != ictx->snap_info.end()); |
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.
Probably sufficient to just return -ENOENT
in this case.
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.
Done
So snapshot, flatten, rollback of a cloned image does not loose any data Fixes: ceph#14512 Signed-off-by: Alexey Sheplyakov <asheplyakov@mirantis.com>
60cc14e
to
aab3a40
Compare
lgtm |
👍 -- good to merge once 0.94.7 is released. |
http://tracker.ceph.com/issues/14512