]> sourceware.org Git - lvm2.git/commitdiff
Avoid using VG metadata on PVs that are not in VGs.
authorAlasdair Kergon <agk@redhat.com>
Wed, 23 Jan 2002 15:50:34 +0000 (15:50 +0000)
committerAlasdair Kergon <agk@redhat.com>
Wed, 23 Jan 2002 15:50:34 +0000 (15:50 +0000)
lib/format1/disk-rep.c
lib/format1/vg_number.c
tools/lvcreate.c
tools/pvscan.c

index 97a09858c71c95207a67ae0a06cc573ac7363aa8..575ccd66d8051c02f600534017581b83151bc0c8 100644 (file)
@@ -280,9 +280,9 @@ static struct disk_list *__read_disk(struct device *dev, struct pool *mem,
        /*
         * is it an orphan ?
         */
-       if (data->pvd.vg_name == '\0') {
+       if (!*data->pvd.vg_name) {
                log_very_verbose("%s is not a member of any VG", name);
-               return data;
+               return (vg_name) ? NULL : data;
        }
 
        if (vg_name && strcmp(vg_name, data->pvd.vg_name)) {
index 335933fbc5d2f8cffd3593f10c4a8f262f98c3cc..331d7c9f35ca22fc8be7cf32466b4e7a48acac74 100644 (file)
@@ -12,7 +12,7 @@
  * FIXME: Quick hack.  We can use caching to
  * prevent a total re-read, even so vg_number
  * causes the tools to check *every* pv.  Yuck.
- * Put in seperate file so it wouldn't contaminate
+ * Put in separate file so it wouldn't contaminate
  * other code.
  */
 int get_free_vg_number(struct dev_filter *filter, const char *candidate_vg,
@@ -40,7 +40,8 @@ int get_free_vg_number(struct dev_filter *filter, const char *candidate_vg,
 
        list_iterate(pvh, &all_pvs) {
                dl = list_item(pvh, struct disk_list);
-               if (!strcmp(dl->pvd.vg_name, candidate_vg))
+               if (!*dl->pvd.vg_name ||
+                   !strcmp(dl->pvd.vg_name, candidate_vg))
                        continue;
 
                numbers[dl->vgd.vg_number] = 1;
index 89106f46ce2218e923474d885ce90cff96321ead..004e0d8dd27e9ac8efb55207b6725550c88be64c 100644 (file)
@@ -216,7 +216,7 @@ int lvcreate(int argc, char **argv)
                struct device *dev;
                char *name;
 
-               if (!(name = dbg_malloc(PATH_MAX))) {
+               if (!(name = pool_alloc(fid->cmd->mem, PATH_MAX))) {
                        log_error("Name allocation failed - device not zeroed");
                        return ECMD_FAILED;
                }
index 86bf9923a94ab131e3ad6d710aed793a4d3918d8..2c37d03b8265be0b20863359a3c8fcf4b487b647 100644 (file)
@@ -173,9 +173,9 @@ void pvscan_display_single(struct physical_volume *pv)
        }
 
        if (!*pv->vg_name) {
-               log_print("PV %-*s is in no VG %-*s [%s]", 
+               log_print("PV %-*s    %-*s [%s]", 
                          pv_max_name_len, pv_tmp_name,
-                         vg_max_name_len - 6, " ",
+                         vg_max_name_len, " ",
                          (s1 = display_size(pv->size / 2, SIZE_SHORT)));
                dbg_free(s1);
                return;
@@ -198,7 +198,7 @@ void pvscan_display_single(struct physical_volume *pv)
 
        sprintf(vg_tmp_name, "%s", pv->vg_name);
        log_print
-           ("PV %-*s of VG %-*s [%s / %s free]", pv_max_name_len,
+           ("PV %-*s VG %-*s [%s / %s free]", pv_max_name_len,
             pv_tmp_name, vg_max_name_len, vg_tmp_name,
             (s1 = display_size(pv->pe_count * pv->pe_size / 2, SIZE_SHORT)),
             (s2 =
This page took 0.075918 seconds and 5 git commands to generate.