1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Avoid using VG metadata on PVs that are not in VGs.

This commit is contained in:
Alasdair Kergon 2002-01-23 15:50:34 +00:00
parent de9e7edaff
commit d518bc39f3
4 changed files with 9 additions and 8 deletions

View 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)) {

View 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;

View 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;
}

View 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 =