]> sourceware.org Git - lvm2.git/commitdiff
Suppress 'No PV label' message when removing several PVs without mdas.
authorAlasdair Kergon <agk@redhat.com>
Tue, 23 Nov 2010 01:55:53 +0000 (01:55 +0000)
committerAlasdair Kergon <agk@redhat.com>
Tue, 23 Nov 2010 01:55:53 +0000 (01:55 +0000)
WHATS_NEW
daemons/clvmd/lvm-functions.c
lib/metadata/metadata-exported.h
lib/metadata/metadata.c
tools/pvremove.c
tools/toollib.c

index 7e2cbc13f04eb595db86c7e88b237b7c93aa9bf3..4919fbe4a1d90f9fa0f9605ff887a495d065ce90 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.78 - 
 ====================================
+  Suppress 'No PV label' message when removing several PVs without mdas.
   Fix default /etc/lvm permissions to be 0755. (2.02.66)
 
 Version 2.02.77 - 22nd November 2010
index b8d9de71cbda81038c8caf0e8b6dec00e756ab4c..20b25a6fd1a953df35e28acf60b29b3200c16a27 100644 (file)
@@ -848,7 +848,7 @@ void lvm_do_backup(const char *vgname)
 
        pthread_mutex_lock(&lvm_lock);
 
-       vg = vg_read_internal(cmd, vgname, NULL /*vgid*/, &consistent);
+       vg = vg_read_internal(cmd, vgname, NULL /*vgid*/, 1, &consistent);
 
        if (vg && consistent)
                check_current_backup(vg);
index fe7813f1f38d60ee568e572b79e5ebcb226b87a1..813648c0b64096143b28a887eaeb0777280111c5 100644 (file)
@@ -341,7 +341,7 @@ int vg_write(struct volume_group *vg);
 int vg_commit(struct volume_group *vg);
 int vg_revert(struct volume_group *vg);
 struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vg_name,
-                            const char *vgid, int *consistent);
+                            const char *vgid, int warnings, int *consistent);
 struct physical_volume *pv_read(struct cmd_context *cmd, const char *pv_name,
                                struct dm_list *mdas, uint64_t *label_sector,
                                int warnings, int scan_label_only);
@@ -357,7 +357,7 @@ void lv_set_hidden(struct logical_volume *lv);
 
 struct dm_list *get_vgnames(struct cmd_context *cmd, int include_internal);
 struct dm_list *get_vgids(struct cmd_context *cmd, int include_internal);
-int scan_vgs_for_pvs(struct cmd_context *cmd);
+int scan_vgs_for_pvs(struct cmd_context *cmd, int warnings);
 
 int pv_write(struct cmd_context *cmd, struct physical_volume *pv,
             struct dm_list *mdas, int64_t label_sector);
index 61b4600633fb30ea37ce3b3d25093a96207dbf54..780b806fea880c56844d9f17fac49503ae523aa9 100644 (file)
@@ -344,7 +344,7 @@ int get_pv_from_vg_by_id(const struct format_type *fmt, const char *vg_name,
        struct pv_list *pvl;
        int r = 0, consistent = 0;
 
-       if (!(vg = vg_read_internal(fmt->cmd, vg_name, vgid, &consistent))) {
+       if (!(vg = vg_read_internal(fmt->cmd, vg_name, vgid, 1, &consistent))) {
                log_error("get_pv_from_vg_by_id: vg_read_internal failed to read VG %s",
                          vg_name);
                return 0;
@@ -918,7 +918,7 @@ struct volume_group *vg_create(struct cmd_context *cmd, const char *vg_name)
        /* FIXME: Is this vg_read_internal necessary? Move it inside
           vg_lock_newname? */
        /* is this vg name already in use ? */
-       if ((vg = vg_read_internal(cmd, vg_name, NULL, &consistent))) {
+       if ((vg = vg_read_internal(cmd, vg_name, NULL, 1, &consistent))) {
                log_error("A volume group called '%s' already exists.", vg_name);
                unlock_and_release_vg(cmd, vg, vg_name);
                return _vg_make_handle(cmd, NULL, FAILED_EXIST);
@@ -1343,7 +1343,7 @@ static int pvcreate_check(struct cmd_context *cmd, const char *name,
         * system.
         */
        if (pv && is_orphan(pv) && mdas_empty_or_ignored(&mdas)) {
-               if (!scan_vgs_for_pvs(cmd))
+               if (!scan_vgs_for_pvs(cmd, 0))
                        return_0;
                pv = pv_read(cmd, name, NULL, NULL, 0, 0);
        }
@@ -1812,7 +1812,7 @@ static struct physical_volume *_find_pv_by_name(struct cmd_context *cmd,
 
        if (is_orphan_vg(pv->vg_name) && mdas_empty_or_ignored(&mdas)) {
                /* If a PV has no MDAs - need to search all VGs for it */
-               if (!scan_vgs_for_pvs(cmd))
+               if (!scan_vgs_for_pvs(cmd, 1))
                        return_NULL;
                if (!(pv = _pv_read(cmd, cmd->mem, pv_name, NULL, NULL, 1, 0))) {
                        log_error("Physical volume %s not found", pv_name);
@@ -2513,6 +2513,7 @@ int vg_revert(struct volume_group *vg)
 
 /* Make orphan PVs look like a VG */
 static struct volume_group *_vg_read_orphans(struct cmd_context *cmd,
+                                            int warnings,
                                             const char *orphan_vgname)
 {
        struct lvmcache_vginfo *vginfo;
@@ -2554,7 +2555,7 @@ static struct volume_group *_vg_read_orphans(struct cmd_context *cmd,
        }
 
        dm_list_iterate_items(info, &vginfo->infos) {
-               if (!(pv = _pv_read(cmd, mem, dev_name(info->dev), NULL, NULL, 1, 0))) {
+               if (!(pv = _pv_read(cmd, mem, dev_name(info->dev), NULL, NULL, warnings, 0))) {
                        continue;
                }
                if (!(pvl = dm_pool_zalloc(mem, sizeof(*pvl)))) {
@@ -2641,6 +2642,7 @@ static void check_reappeared_pv(struct volume_group *correct_vg,
 static struct volume_group *_vg_read(struct cmd_context *cmd,
                                     const char *vgname,
                                     const char *vgid,
+                                    int warnings, 
                                     int *consistent, unsigned precommitted)
 {
        struct format_instance *fid;
@@ -2667,7 +2669,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
                        return NULL;
                }
                *consistent = 1;
-               return _vg_read_orphans(cmd, vgname);
+               return _vg_read_orphans(cmd, warnings, vgname);
        }
 
        /*
@@ -3035,12 +3037,12 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
 }
 
 struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vgname,
-                            const char *vgid, int *consistent)
+                            const char *vgid, int warnings, int *consistent)
 {
        struct volume_group *vg;
        struct lv_list *lvl;
 
-       if (!(vg = _vg_read(cmd, vgname, vgid, consistent, 0)))
+       if (!(vg = _vg_read(cmd, vgname, vgid, warnings, consistent, 0)))
                return NULL;
 
        if (!check_pv_segments(vg)) {
@@ -3104,7 +3106,7 @@ static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd,
        /* Is corresponding vgname already cached? */
        if ((vginfo = vginfo_from_vgid(vgid)) &&
            vginfo->vgname && !is_orphan_vg(vginfo->vgname)) {
-               if ((vg = _vg_read(cmd, NULL, vgid,
+               if ((vg = _vg_read(cmd, NULL, vgid, 1,
                                   &consistent, precommitted)) &&
                    !strncmp((char *)vg->id.uuid, vgid, ID_LEN)) {
 
@@ -3137,7 +3139,7 @@ static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd,
                if (!vgname)
                        continue;       // FIXME Unnecessary?
                consistent = 0;
-               if ((vg = _vg_read(cmd, vgname, vgid, &consistent,
+               if ((vg = _vg_read(cmd, vgname, vgid, 1, &consistent,
                                   precommitted)) &&
                    !strncmp((char *)vg->id.uuid, vgid, ID_LEN)) {
 
@@ -3208,7 +3210,7 @@ const char *find_vgname_from_pvid(struct cmd_context *cmd,
                 * every PV on the system.
                 */
                if (mdas_empty_or_ignored(&info->mdas)) {
-                       if (!scan_vgs_for_pvs(cmd)) {
+                       if (!scan_vgs_for_pvs(cmd, 1)) {
                                log_error("Rescan for PVs without "
                                          "metadata areas failed.");
                                return NULL;
@@ -3323,7 +3325,7 @@ struct dm_list *get_vgids(struct cmd_context *cmd, int include_internal)
        return lvmcache_get_vgids(cmd, include_internal);
 }
 
-static int _get_pvs(struct cmd_context *cmd, struct dm_list **pvslist)
+static int _get_pvs(struct cmd_context *cmd, int warnings, struct dm_list **pvslist)
 {
        struct str_list *strl;
        struct dm_list * uninitialized_var(results);
@@ -3364,7 +3366,7 @@ static int _get_pvs(struct cmd_context *cmd, struct dm_list **pvslist)
                        stack;
                        continue;
                }
-               if (!(vg = vg_read_internal(cmd, vgname, vgid, &consistent))) {
+               if (!(vg = vg_read_internal(cmd, vgname, vgid, warnings, &consistent))) {
                        stack;
                        continue;
                }
@@ -3398,15 +3400,15 @@ struct dm_list *get_pvs(struct cmd_context *cmd)
 {
        struct dm_list *results;
 
-       if (!_get_pvs(cmd, &results))
+       if (!_get_pvs(cmd, 1, &results))
                return NULL;
 
        return results;
 }
 
-int scan_vgs_for_pvs(struct cmd_context *cmd)
+int scan_vgs_for_pvs(struct cmd_context *cmd, int warnings)
 {
-       return _get_pvs(cmd, NULL);
+       return _get_pvs(cmd, warnings, NULL);
 }
 
 int pv_write(struct cmd_context *cmd __attribute__((unused)),
@@ -3581,7 +3583,7 @@ static struct volume_group *_recover_vg(struct cmd_context *cmd,
        if (!lock_vol(cmd, vg_name, LCK_VG_WRITE))
                return_NULL;
 
-       if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent)))
+       if (!(vg = vg_read_internal(cmd, vg_name, vgid, 1, &consistent)))
                return_NULL;
 
        if (!consistent) {
@@ -3636,7 +3638,7 @@ static struct volume_group *_vg_lock_and_read(struct cmd_context *cmd, const cha
        consistent_in = consistent;
 
        /* If consistent == 1, we get NULL here if correction fails. */
-       if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent))) {
+       if (!(vg = vg_read_internal(cmd, vg_name, vgid, 1, &consistent))) {
                if (consistent_in && !consistent) {
                        log_error("Volume group \"%s\" inconsistent.", vg_name);
                        failure |= FAILED_INCONSISTENT;
index 51530691eb3a6317be44666b3065fa5ca1fb9582..a8717e05cd2ea145c6cf8f305f985249565c9ce1 100644 (file)
@@ -48,7 +48,7 @@ static int pvremove_check(struct cmd_context *cmd, const char *name)
         * PV on the system.
         */
        if (is_orphan(pv) && !dm_list_size(&mdas)) {
-               if (!scan_vgs_for_pvs(cmd)) {
+               if (!scan_vgs_for_pvs(cmd, 0)) {
                        log_error("Rescan for PVs without metadata areas "
                                  "failed.");
                        return 0;
index 6971ebae0fb4fa897418ff4c65db3f2620b358db..6aa0fbb13a9c5c736e00398a0d65cf7d51f62a64 100644 (file)
@@ -629,7 +629,7 @@ static int _process_all_devs(struct cmd_context *cmd, void *handle,
        int ret_max = ECMD_PROCESSED;
        int ret = 0;
 
-       if (!scan_vgs_for_pvs(cmd)) {
+       if (!scan_vgs_for_pvs(cmd, 1)) {
                stack;
                return ECMD_FAILED;
        }
@@ -744,7 +744,7 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
                                if (!scanned && is_orphan(pv) &&
                                    !dm_list_size(&mdas)) {
                                        if (!scan_label_only &&
-                                           !scan_vgs_for_pvs(cmd)) {
+                                           !scan_vgs_for_pvs(cmd, 1)) {
                                                stack;
                                                ret_max = ECMD_FAILED;
                                                continue;
This page took 0.296403 seconds and 5 git commands to generate.