mirror of
https://github.com/ceph/ceph
synced 2025-01-01 08:32:24 +00:00
rbd: add error message "snapshot is already protected"
Fixes: http://tracker.ceph.com/issues/15807 Signed-off-by: Vikhyat Umrao <vumrao@redhat.com>
This commit is contained in:
parent
b262e46599
commit
a00720d9aa
@ -365,6 +365,17 @@ int execute_protect(const po::variables_map &vm) {
|
||||
return r;
|
||||
}
|
||||
|
||||
bool is_protected = false;
|
||||
r = image.snap_is_protected(snap_name.c_str(), &is_protected);
|
||||
if (r < 0) {
|
||||
std::cerr << "rbd: protecting snap failed: " << cpp_strerror(r)
|
||||
<< std::endl;
|
||||
return r;
|
||||
} else if (is_protected) {
|
||||
std::cerr << "rbd: snap is already protected" << std::endl;
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
r = do_protect_snap(image, snap_name.c_str());
|
||||
if (r < 0) {
|
||||
std::cerr << "rbd: protecting snap failed: " << cpp_strerror(r)
|
||||
@ -399,6 +410,17 @@ int execute_unprotect(const po::variables_map &vm) {
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
|
||||
bool is_protected = false;
|
||||
r = image.snap_is_protected(snap_name.c_str(), &is_protected);
|
||||
if (r < 0) {
|
||||
std::cerr << "rbd: unprotecting snap failed: " << cpp_strerror(r)
|
||||
<< std::endl;
|
||||
return r;
|
||||
} else if (!is_protected) {
|
||||
std::cerr << "rbd: snap is already unprotected" << std::endl;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
r = do_unprotect_snap(image, snap_name.c_str());
|
||||
if (r < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user