summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorRamana Raja <rraja@redhat.com>2024-08-11 04:18:07 +0200
committerRamana Raja <rraja@redhat.com>2024-08-13 23:24:42 +0200
commit9ea03123a16d087146ec7efcf4a61f3464869dfd (patch)
tree9ee84cb19d210651b095c83e7c8c3b1aab667a57 /src/tools
parentMerge pull request #58976 from athanatos/sjust/for-review/wip-nvmeofpaxosserv... (diff)
downloadceph-9ea03123a16d087146ec7efcf4a61f3464869dfd.tar.xz
ceph-9ea03123a16d087146ec7efcf4a61f3464869dfd.zip
rbd: fix CLI output of `rbd group snap info` command
... when a group snapshot has no member images. A group snapshot can be created with no member images. For such a group snapshot, omit the 'image snap' and 'images' fields from the unformatted CLI output of `rbd group snap info` command so as to not confuse the user. In the librbd C/C++ data structures representing a group snapshot with no member images, set the 'image_snap_name' data member to an empty string. Fixes: https://tracker.ceph.com/issues/67436 Signed-off-by: Ramana Raja <rraja@redhat.com>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/rbd/action/Group.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/tools/rbd/action/Group.cc b/src/tools/rbd/action/Group.cc
index 080d26e1757..afcc24455f6 100644
--- a/src/tools/rbd/action/Group.cc
+++ b/src/tools/rbd/action/Group.cc
@@ -805,9 +805,13 @@ int execute_group_snap_info(const po::variables_map &vm,
} else {
std::cout << "rbd group snapshot '" << group_snap.name << "':\n"
<< "\tid: " << group_snap.id << std::endl
- << "\tstate: " << state_string << std::endl
- << "\timage snap: " << group_snap.image_snap_name << std::endl
- << "\timages:" << std::endl;
+ << "\tstate: " << state_string << std::endl;
+ if (!group_snap.image_snaps.empty()) {
+ std::cout << "\timage snap: " << group_snap.image_snap_name << std::endl
+ << "\timages:" << std::endl;
+ } else {
+ ceph_assert(group_snap.image_snap_name.empty());
+ }
}
std::sort(group_snap.image_snaps.begin(), group_snap.image_snaps.end(),