Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e9a46414c55af0...
Commit: e9a46414c55af0220848da2eb0789a40ddf18216
Parent: 384e46fb762e843a145616ff1558e6b7b70a0495
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 10 14:19:20 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Aug 21 11:15:53 2015 +0200
pv: issue different message of different type when we're overwriting existing PV
header instead of creating a new one
Scenario:
$ pvcreate /dev/sda
Physical volume "/dev/sda" successfully created
We're adding the PV to a VG.
Before this patch:
$ vgcreate vg /dev/sda
Physical volume "/dev/sda" successfully created
Volume group "vg" successfully created
With this path applied:
$ vgcreate vg /dev/sda
Volume group "vg" successfully created
...and verbose log containing: "Physical volume "/dev/sda" successfully
written"
---
lib/metadata/metadata.c | 8 +++++++-
lib/metadata/vg.h | 1 +
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 55f5840..2c467f5 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -294,6 +294,7 @@ int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
}
pvw->pv = pv;
pvw->pp = new_pv ? pp : NULL;
+ pvw->new_pv = new_pv;
dm_list_add(&vg->pvs_to_write, &pvw->list);
return 1;
@@ -1639,7 +1640,11 @@ static int _pvcreate_write(struct cmd_context *cmd, struct
pv_to_write *pvw)
return 0;
}
- log_print_unless_silent("Physical volume \"%s\" successfully
created", pv_name);
+ if (pvw->new_pv)
+ log_print_unless_silent("Physical volume \"%s\" successfully
created", pv_name);
+ else
+ log_verbose("Physical volume \"%s\" successfully written",
pv_name);
+
return 1;
}
@@ -1758,6 +1763,7 @@ struct physical_volume *pvcreate_vol(struct cmd_context *cmd, const
char *pv_nam
struct pv_to_write pvw;
pvw.pp = pp;
pvw.pv = pv;
+ pvw.new_pv = 1;
if (!_pvcreate_write(cmd, &pvw))
goto bad;
}
diff --git a/lib/metadata/vg.h b/lib/metadata/vg.h
index 46cf169..55c1cfd 100644
--- a/lib/metadata/vg.h
+++ b/lib/metadata/vg.h
@@ -36,6 +36,7 @@ struct pv_to_write {
struct dm_list list;
struct physical_volume *pv;
struct pvcreate_params *pp;
+ int new_pv;
};
#define MAX_EXTENT_COUNT (UINT32_MAX)