mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
pvcreate: Avoid spurious 'not found' messages.
Replacement of pv_read by find_pv_by_name in commit
651d5093ed
caused spurious
error messages when running pvcreate or vgextend against an
unformatted device.
Physical volume /dev/loop4 not found
Physical volume "/dev/loop4" successfully created
Physical volume /dev/loop4 not found
Physical volume /dev/loop4 not found
Physical volume "/dev/loop4" successfully created
Volume group "vg1" successfully extended
This commit is contained in:
parent
84394c0219
commit
2e82a070f3
@ -847,7 +847,7 @@ struct logical_volume *find_lv(const struct volume_group *vg,
|
|||||||
const char *lv_name);
|
const char *lv_name);
|
||||||
struct physical_volume *find_pv_by_name(struct cmd_context *cmd,
|
struct physical_volume *find_pv_by_name(struct cmd_context *cmd,
|
||||||
const char *pv_name,
|
const char *pv_name,
|
||||||
int allow_orphan);
|
int allow_orphan, int allow_unformatted);
|
||||||
|
|
||||||
const char *find_vgname_from_pvname(struct cmd_context *cmd,
|
const char *find_vgname_from_pvname(struct cmd_context *cmd,
|
||||||
const char *pvname);
|
const char *pvname);
|
||||||
|
@ -633,7 +633,7 @@ static int vg_extend_single_pv(struct volume_group *vg, char *pv_name,
|
|||||||
{
|
{
|
||||||
struct physical_volume *pv;
|
struct physical_volume *pv;
|
||||||
|
|
||||||
if (!(pv = find_pv_by_name(vg->cmd, pv_name, 1)))
|
if (!(pv = find_pv_by_name(vg->cmd, pv_name, 1, 1)))
|
||||||
stack;
|
stack;
|
||||||
if (!pv && !pp) {
|
if (!pv && !pp) {
|
||||||
log_error("%s not identified as an existing "
|
log_error("%s not identified as an existing "
|
||||||
@ -1278,7 +1278,7 @@ static int pvcreate_check(struct cmd_context *cmd, const char *name,
|
|||||||
/* FIXME Check partition type is LVM unless --force is given */
|
/* FIXME Check partition type is LVM unless --force is given */
|
||||||
|
|
||||||
/* Is there a pv here already? */
|
/* Is there a pv here already? */
|
||||||
if (!(pv = find_pv_by_name(cmd, name, 1)))
|
if (!(pv = find_pv_by_name(cmd, name, 1, 1)))
|
||||||
stack;
|
stack;
|
||||||
|
|
||||||
/* Allow partial & exported VGs to be destroyed. */
|
/* Allow partial & exported VGs to be destroyed. */
|
||||||
@ -1781,7 +1781,7 @@ struct physical_volume *find_pv(struct volume_group *vg, struct device *dev)
|
|||||||
/* FIXME: liblvm todo - make into function that returns handle */
|
/* FIXME: liblvm todo - make into function that returns handle */
|
||||||
struct physical_volume *find_pv_by_name(struct cmd_context *cmd,
|
struct physical_volume *find_pv_by_name(struct cmd_context *cmd,
|
||||||
const char *pv_name,
|
const char *pv_name,
|
||||||
int allow_orphan)
|
int allow_orphan, int allow_unformatted)
|
||||||
{
|
{
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
struct pv_list *pvl;
|
struct pv_list *pvl;
|
||||||
@ -1804,7 +1804,7 @@ struct physical_volume *find_pv_by_name(struct cmd_context *cmd,
|
|||||||
else
|
else
|
||||||
free_pv_fid(pvl->pv);
|
free_pv_fid(pvl->pv);
|
||||||
|
|
||||||
if (!pv)
|
if (!pv && !allow_unformatted)
|
||||||
log_error("Physical volume %s not found", pv_name);
|
log_error("Physical volume %s not found", pv_name);
|
||||||
|
|
||||||
if (pv && !allow_orphan && is_orphan_vg(pv->vg_name)) {
|
if (pv && !allow_orphan && is_orphan_vg(pv->vg_name)) {
|
||||||
|
@ -1577,7 +1577,7 @@ struct logical_volume *find_pvmove_lv_from_pvname(struct cmd_context *cmd,
|
|||||||
struct physical_volume *pv;
|
struct physical_volume *pv;
|
||||||
struct logical_volume *lv;
|
struct logical_volume *lv;
|
||||||
|
|
||||||
if (!(pv = find_pv_by_name(cmd, name, 0)))
|
if (!(pv = find_pv_by_name(cmd, name, 0, 0)))
|
||||||
return_NULL;
|
return_NULL;
|
||||||
|
|
||||||
lv = find_pvmove_lv(vg, pv->dev, lv_type);
|
lv = find_pvmove_lv(vg, pv->dev, lv_type);
|
||||||
|
@ -628,7 +628,7 @@ static int _set_up_pvmove(struct cmd_context *cmd, const char *pv_name,
|
|||||||
argv++;
|
argv++;
|
||||||
|
|
||||||
/* Find PV (in VG) */
|
/* Find PV (in VG) */
|
||||||
if (!(pv = find_pv_by_name(cmd, pv_name, 0))) {
|
if (!(pv = find_pv_by_name(cmd, pv_name, 0, 0))) {
|
||||||
stack;
|
stack;
|
||||||
return EINVALID_CMD_LINE;
|
return EINVALID_CMD_LINE;
|
||||||
}
|
}
|
||||||
@ -809,7 +809,7 @@ static struct volume_group *_get_move_vg(struct cmd_context *cmd,
|
|||||||
struct volume_group *vg;
|
struct volume_group *vg;
|
||||||
|
|
||||||
/* Reread all metadata in case it got changed */
|
/* Reread all metadata in case it got changed */
|
||||||
if (!(pv = find_pv_by_name(cmd, name, 0))) {
|
if (!(pv = find_pv_by_name(cmd, name, 0, 0))) {
|
||||||
log_error("ABORTING: Can't reread PV %s", name);
|
log_error("ABORTING: Can't reread PV %s", name);
|
||||||
/* What more could we do here? */
|
/* What more could we do here? */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user