]> sourceware.org Git - lvm2.git/commitdiff
Add tests for lvm_vg_name_list, lvm_vg_id_list and lvm_scan_vgs.
authorDave Wysochanski <dwysocha@redhat.com>
Fri, 24 Jul 2009 12:51:32 +0000 (12:51 +0000)
committerDave Wysochanski <dwysocha@redhat.com>
Fri, 24 Jul 2009 12:51:32 +0000 (12:51 +0000)
Author: Dave Wysochanski <dwysocha@redhat.com>

test/api/test.c

index cd1d2b34d78bbec7ea25a1233ddbc101bf129813..c9500ffe9b891e023a6ea95583863de92e2816aa 100644 (file)
@@ -50,6 +50,12 @@ static int lvm_split(char *str, int *argc, char **argv, int max)
 
 static void _show_help(void)
 {
+       printf("'scan_vgs': "
+              "Scan the system for LVM metadata\n");
+       printf("'vg_list_names': "
+              "List the names of the VGs that exist in the system\n");
+       printf("'vg_list_ids': "
+              "List the uuids of the VGs that exist in the system\n");
        printf("'vg_list_pvs vgname': "
               "List the PVs that exist in VG vgname\n");
        printf("'vg_list_lvs vgname': "
@@ -230,6 +236,40 @@ static void _pvs_in_vg(char **argv, int argc)
        }
 }
 
+static void _scan_vgs(lvm_t libh)
+{
+       lvm_scan_vgs(libh);
+}
+
+static void _vg_list_names(lvm_t libh)
+{
+       struct dm_list *list;
+       struct lvm_str_list *strl;
+       const char *tmp;
+
+       list = lvm_list_vg_names(libh);
+       printf("VG names:\n");
+       dm_list_iterate_items(strl, list) {
+               tmp = strl->str;
+               printf("%s\n", tmp);
+       }
+}
+
+static void _vg_list_ids(lvm_t libh)
+{
+       struct dm_list *list;
+       struct lvm_str_list *strl;
+       const char *tmp;
+
+       list = lvm_list_vg_ids(libh);
+       printf("VG uuids:\n");
+       dm_list_iterate_items(strl, list) {
+               tmp = strl->str;
+               printf("%s\n", tmp);
+       }
+}
+
+
 static void _lvs_in_vg(char **argv, int argc)
 {
        struct dm_list *lvs;
@@ -301,6 +341,12 @@ static int lvmapi_test_shell(lvm_t libh)
                        _pvs_in_vg(argv, argc);
                } else if (!strcmp(argv[0], "vg_list_lvs")) {
                        _lvs_in_vg(argv, argc);
+               } else if (!strcmp(argv[0], "vg_list_names")) {
+                       _vg_list_names(libh);
+               } else if (!strcmp(argv[0], "vg_list_ids")) {
+                       _vg_list_ids(libh);
+               } else if (!strcmp(argv[0], "scan_vgs")) {
+                       _scan_vgs(libh);
                } else {
                        printf ("Unrecognized command %s\n", argv[0]);
                }
This page took 0.039936 seconds and 5 git commands to generate.