Fixes:
[root@ ~]# rbd snap rm img1@snap1
[root@ ~]# rbd snap ls img1 -a
SNAPID NAME SIZE TIMESTAMP NAMESPACE
4
f2e82bd1-e2ff-4a6b-aaef-
5a12a2b23a30 100 MiB Sat Aug 18 08:48:34 2018 trash (snap1)
[root@ ~]# rbd snap purge img1
Removing all snapshots: 0% complete...failed.
rbd: removing snaps failed: (2) No such file or directory
Signed-off-by: songweibin <song.weibin@zte.com.cn>
(cherry picked from commit
2c79a4939090d445a8172dbbe4d4072a4851ddcf)
return 0;
} else {
list<std::string> protect;
+ snaps.erase(remove_if(snaps.begin(),
+ snaps.end(),
+ boost::bind(utils::is_not_user_snap_namespace, &image, _1)),
+ snaps.end());
for (auto it = snaps.begin(); it != snaps.end();) {
r = image.snap_is_protected(it->name.c_str(), &is_protected);
if (r < 0) {