Skip to contentSkip to conversation

Hide merging snapshots from "lvs" command.

PATCH New Mike Snitzer 2 participants 3 messages Oct 1, 2009 – Feb 17, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Hide merging snapshots from "lvs" command.

Hide merging snapshots from "lvs" command. The prefix "snapshot" is reserved and names with this prefix cannot be created by the user, so this change is safe.

---
 tools/toollib.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/toollib.c +2 -1
Index: lvm2/tools/toollib.c
===================================================================
@@ -119,7 +119,8 @@ int process_each_lv_in_vg(struct cmd_con
 	}
 
 	dm_list_iterate_items(lvl, &vg->lvs) {
-		if (lvl->lv->status & SNAPSHOT)
+		/* Names starting with "snapshot" are reserved */
+		if (!strncmp(lvl->lv->name, "snapshot", strlen("snapshot")))
 			continue;
 
 		if (lv_is_virtual_origin(lvl->lv) && !arg_count(cmd, all_ARG))
#1 lore raw

PATCH 1/1 Hide merging snapshots from "lvs" command.

Hi,

Quoted 16 lines · Mike Snitzer

Hide merging snapshots from "lvs" command. The prefix "snapshot" is reserved and names with this prefix cannot be created by the user, so this change is safe.

---
 tools/toollib.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: lvm2/tools/toollib.c
===================================================================

tools/toollib.c int process_each_lv_in_vg(struct cmd_con · line 126

Quoted 9 lines
tools/toollib.c +2 -1
@@ -119,7 +119,8 @@ int process_each_lv_in_vg(struct cmd_con
 	}
 
 	dm_list_iterate_items(lvl, &vg->lvs) {
-		if (lvl->lv->status & SNAPSHOT)
+		/* Names starting with "snapshot" are reserved */
+		if (!strncmp(lvl->lv->name, "snapshot", strlen("snapshot")))
 			continue;
 
 		if (lv_is_virtual_origin(lvl->lv) && !arg_count(cmd, all_ARG))

This seems to have fallen through the cracks. Please check in if still relevant (the patch is not present in current CVS as far as I can tell).

Yours,
Petr.

#2 lore raw
Quoted 27 lines · Petr Rockai

Hi,

Quoted 24 lines · Mike Snitzer

Hide merging snapshots from "lvs" command. The prefix "snapshot" is reserved and names with this prefix cannot be created by the user, so this change is safe.

---
 tools/toollib.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: lvm2/tools/toollib.c
===================================================================

tools/toollib.c +2 -1
@@ -119,7 +119,8 @@ int process_each_lv_in_vg(struct cmd_con
 	}
 
 	dm_list_iterate_items(lvl, &vg->lvs) {
-		if (lvl->lv->status & SNAPSHOT)
+		/* Names starting with "snapshot" are reserved */
+		if (!strncmp(lvl->lv->name, "snapshot", strlen("snapshot")))
 			continue;
 
Quoted 4 lines

tools/toollib.c int process_each_lv_in_vg(struct cmd_con · line 126

Quoted 1 line
tools/toollib.c +0 -0
 		if (lv_is_virtual_origin(lvl->lv) && !arg_count(cmd, all_ARG))

This seems to have fallen through the cracks. Please check in if still relevant (the patch is not present in current CVS as far as I can tell).

It isn't needed, I eliminated the rename of the merging snapshot LV name to 'snapshotX' as it proved unnecessary/undesirable.

The merging snapshot is hidden (!lv_is_visible()); lvs -a will display it though:

# lvconvert -b --merge test/testlv1_snap
  Merging of volume testlv1_snap started.
# lvs
  LV      VG   Attr   LSize Origin Snap%  Move Log Copy%  Convert
  testlv1 test Owi-a- 4.00g         13.37                        
# lvs -a
  LV             VG   Attr   LSize Origin  Snap%  Move Log Copy%
  Convert
  testlv1        test Owi-a- 4.00g          10.59                        
  [testlv1_snap] test Swi--- 1.00g testlv1                               

Thanks for following up though!

Mike