]> sourceware.org Git - lvm2.git/commitdiff
Add pvcreate_params to vg_extend.
authorDave Wysochanski <dwysocha@redhat.com>
Mon, 5 Oct 2009 20:02:48 +0000 (20:02 +0000)
committerDave Wysochanski <dwysocha@redhat.com>
Mon, 5 Oct 2009 20:02:48 +0000 (20:02 +0000)
Another refactoring for implicit pvcreate support.  We need to get
the pvcreate parameters somehow to the vg_extend routine.  Options
seemed to be:
1. Attach the parameters to struct volume_group.  I personally
did not like this idea in most cases, though one could make an
agrument why it might be ok at least for some of the parameters
(e.g. metadatacopies).
2. Pass them in to the extend routine.  This second route seemed
to be the best approach given the constraints.

Future patches will parse the command line and fill in the actual
values for the pvcreate_single call.
Should be no functional change.

lib/metadata/metadata-exported.h
lib/metadata/metadata.c
liblvm/lvm_vg.c
tools/vgcreate.c
tools/vgextend.c

index bf830aae1d5fa9eda980accd0ec6f13abfde5fb8..ebaea928e34cda1c0cc2687ef3c6136db2929bfb 100644 (file)
@@ -453,7 +453,8 @@ int vg_remove_check(struct volume_group *vg);
 int vg_remove(struct volume_group *vg);
 int vg_rename(struct cmd_context *cmd, struct volume_group *vg,
              const char *new_name);
-int vg_extend(struct volume_group *vg, int pv_count, char **pv_names);
+int vg_extend(struct volume_group *vg, int pv_count, char **pv_names,
+             struct pvcreate_params *pp);
 int vg_reduce(struct volume_group *vg, char *pv_name);
 int vg_set_extent_size(struct volume_group *vg, uint32_t new_extent_size);
 int vg_set_max_lv(struct volume_group *vg, uint32_t max_lv);
index b6f84d7c87cc863312436d05f4a2c339a5092411..5f65d263cc71d798ffbd1dff4245fb572291bcc2 100644 (file)
@@ -582,7 +582,18 @@ static int vg_extend_single_pv(struct volume_group *vg, char *pv_name,
        return 1;
 }
 
-int vg_extend(struct volume_group *vg, int pv_count, char **pv_names)
+/*
+ * Extend a VG by a single PV / device path
+ *
+ * Parameters:
+ * - vg: handle of volume group to extend by 'pv_name'
+ * - pv_count: count of device paths of PVs
+ * - pv_names: device paths of PVs to add to VG
+ * - pp: parameters to pass to implicit pvcreate; if NULL, do not pvcreate
+ *
+ */
+int vg_extend(struct volume_group *vg, int pv_count, char **pv_names,
+             struct pvcreate_params *pp)
 {
        int i;
 
@@ -591,7 +602,7 @@ int vg_extend(struct volume_group *vg, int pv_count, char **pv_names)
 
        /* attach each pv */
        for (i = 0; i < pv_count; i++) {
-               if (!vg_extend_single_pv(vg, pv_names[i], NULL))
+               if (!vg_extend_single_pv(vg, pv_names[i], pp))
                        goto bad;
        }
 
index a0a7b1fd16c4a3522d1be18b9baf57d561d10a4b..0c097c037d6121e3184cae5e77f40d03cb363c3b 100644 (file)
@@ -60,7 +60,7 @@ int lvm_vg_extend(vg_t vg, const char *device)
                return -1;
        }
 
-       if (!vg_extend(vg, 1, (char **) &device)) {
+       if (!vg_extend(vg, 1, (char **) &device, NULL)) {
                unlock_vg(vg->cmd, VG_ORPHANS);
                return -1;
        }
index 2100877c150405befa71d89d1d1e6c6438231a64..d171026bd3d8919925ce6795802a306dc1ceb202 100644 (file)
@@ -63,7 +63,7 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
        }
 
        /* attach the pv's */
-       if (!vg_extend(vg, argc - 1, argv + 1))
+       if (!vg_extend(vg, argc - 1, argv + 1, NULL))
                goto_bad;
 
        if (vp_new.max_lv != vg->max_lv)
index b659492ebd2afed701171bdf0e61a727036c43ac..9fa7d31773d22a2fe07725be7e2657b05e8fe9f1 100644 (file)
@@ -54,7 +54,7 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
                goto_bad;
 
        /* extend vg */
-       if (!vg_extend(vg, argc, argv))
+       if (!vg_extend(vg, argc, argv, NULL))
                goto_bad;
 
        /* ret > 0 */
This page took 0.041053 seconds and 5 git commands to generate.