1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 20:25:52 +03:00

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"
This commit is contained in:
Peter Rajnoha 2015-03-10 14:19:20 +01:00
parent 52999133a3
commit 73f1d444c8
2 changed files with 8 additions and 1 deletions

View File

@ -297,6 +297,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);
}
@ -1672,7 +1673,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;
}
@ -1791,6 +1796,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;
}

View File

@ -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)