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

Pass 'single_device' parameter down to suppress 'Can't find uuid' messages

when reading VG text metadate and called from pvscan --lvmetad.

(Longer-term, that check needs moving outside of that code.)
This commit is contained in:
Alasdair Kergon 2012-02-29 02:35:35 +00:00
parent 996fe0a836
commit 5b613cff97
9 changed files with 28 additions and 17 deletions

7
lib/cache/lvmetad.c vendored
View File

@ -588,15 +588,18 @@ struct _pvscan_lvmetad_baton {
static int _pvscan_lvmetad_single(struct metadata_area *mda, void *baton)
{
struct _pvscan_lvmetad_baton *b = baton;
struct volume_group *this = mda->ops->vg_read(b->fid, "", mda);
struct volume_group *this = mda->ops->vg_read(b->fid, "", mda, 1);
if (!b->vg || this->seqno > b->vg->seqno)
b->vg = this;
else if (b->vg)
release_vg(this);
return 1;
}
static dev_t _parse_devt(const char *str) { /* Oh. */
static dev_t _parse_devt(const char *str)
{ /* Oh. */
char *where = (char *) str;
int major = strtol(str, &where, 10);
int minor;

View File

@ -179,7 +179,8 @@ out:
static struct volume_group *_format1_vg_read(struct format_instance *fid,
const char *vg_name,
struct metadata_area *mda __attribute__((unused)))
struct metadata_area *mda __attribute__((unused)),
int single_device __attribute__((unused)))
{
struct volume_group *vg;
struct disk_list *dl;

View File

@ -100,7 +100,8 @@ static int _check_usp(const char *vgname, struct user_subpool *usp, int sp_count
static struct volume_group *_pool_vg_read(struct format_instance *fid,
const char *vg_name,
struct metadata_area *mda __attribute__((unused)))
struct metadata_area *mda __attribute__((unused)),
int single_device __attribute__((unused)))
{
struct volume_group *vg;
struct user_subpool *usp;

View File

@ -288,7 +288,7 @@ struct volume_group *backup_read_vg(struct cmd_context *cmd,
}
dm_list_iterate_items(mda, &tf->metadata_areas_in_use) {
if (!(vg = mda->ops->vg_read(tf, vg_name, mda)))
if (!(vg = mda->ops->vg_read(tf, vg_name, mda, 0)))
stack;
break;
}

View File

@ -483,7 +483,8 @@ static int _raw_holds_vgname(struct format_instance *fid,
static struct volume_group *_vg_read_raw_area(struct format_instance *fid,
const char *vgname,
struct device_area *area,
int precommitted)
int precommitted,
int single_device)
{
struct volume_group *vg = NULL;
struct raw_locn *rlocn;
@ -510,7 +511,7 @@ static struct volume_group *_vg_read_raw_area(struct format_instance *fid,
}
/* FIXME 64-bit */
if (!(vg = text_vg_import_fd(fid, NULL, area->dev,
if (!(vg = text_vg_import_fd(fid, NULL, single_device, area->dev,
(off_t) (area->start + rlocn->offset),
(uint32_t) (rlocn->size - wrap),
(off_t) (area->start + MDA_HEADER_SIZE),
@ -531,7 +532,8 @@ static struct volume_group *_vg_read_raw_area(struct format_instance *fid,
static struct volume_group *_vg_read_raw(struct format_instance *fid,
const char *vgname,
struct metadata_area *mda)
struct metadata_area *mda,
int single_device)
{
struct mda_context *mdac = (struct mda_context *) mda->metadata_locn;
struct volume_group *vg;
@ -539,7 +541,7 @@ static struct volume_group *_vg_read_raw(struct format_instance *fid,
if (!dev_open_readonly(mdac->area.dev))
return_NULL;
vg = _vg_read_raw_area(fid, vgname, &mdac->area, 0);
vg = _vg_read_raw_area(fid, vgname, &mdac->area, 0, single_device);
if (!dev_close(mdac->area.dev))
stack;
@ -557,7 +559,7 @@ static struct volume_group *_vg_read_precommit_raw(struct format_instance *fid,
if (!dev_open_readonly(mdac->area.dev))
return_NULL;
vg = _vg_read_raw_area(fid, vgname, &mdac->area, 1);
vg = _vg_read_raw_area(fid, vgname, &mdac->area, 1, 0);
if (!dev_close(mdac->area.dev))
stack;
@ -869,7 +871,8 @@ static struct volume_group *_vg_read_file_name(struct format_instance *fid,
static struct volume_group *_vg_read_file(struct format_instance *fid,
const char *vgname,
struct metadata_area *mda)
struct metadata_area *mda,
int single_device __attribute__((unused)))
{
struct text_context *tc = (struct text_context *) mda->metadata_locn;
@ -1235,7 +1238,7 @@ static int _scan_raw(const struct format_type *fmt, const char *vgname __attribu
if ((scanned_vgname = vgname_from_mda(fmt, mdah,
&rl->dev_area, &vgid, &vgstatus,
NULL, NULL))) {
vg = _vg_read_raw_area(&fid, scanned_vgname, &rl->dev_area, 0);
vg = _vg_read_raw_area(&fid, scanned_vgname, &rl->dev_area, 0, 0);
if (vg)
lvmcache_update_vg(vg, 0);

View File

@ -71,6 +71,7 @@ struct volume_group *text_vg_import_file(struct format_instance *fid,
time_t *when, char **desc);
struct volume_group *text_vg_import_fd(struct format_instance *fid,
const char *file,
int single_device,
struct device *dev,
off_t offset, uint32_t size,
off_t offset2, uint32_t size2,

View File

@ -78,6 +78,7 @@ const char *text_vgname_import(const struct format_type *fmt,
struct volume_group *text_vg_import_fd(struct format_instance *fid,
const char *file,
int single_device,
struct device *dev,
off_t offset, uint32_t size,
off_t offset2, uint32_t size2,
@ -111,7 +112,7 @@ struct volume_group *text_vg_import_fd(struct format_instance *fid,
if (!(*vsn)->check_version(cft))
continue;
if (!(vg = (*vsn)->read_vg(fid, cft, 0)))
if (!(vg = (*vsn)->read_vg(fid, cft, single_device)))
goto_out;
(*vsn)->read_desc(vg->vgmem, cft, when, desc);
@ -127,7 +128,7 @@ struct volume_group *text_vg_import_file(struct format_instance *fid,
const char *file,
time_t *when, char **desc)
{
return text_vg_import_fd(fid, file, NULL, (off_t)0, 0, (off_t)0, 0, NULL, 0,
return text_vg_import_fd(fid, file, 0, NULL, (off_t)0, 0, (off_t)0, 0, NULL, 0,
when, desc);
}

View File

@ -3017,7 +3017,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
if ((use_precommitted &&
!(vg = mda->ops->vg_read_precommit(fid, vgname, mda))) ||
(!use_precommitted &&
!(vg = mda->ops->vg_read(fid, vgname, mda)))) {
!(vg = mda->ops->vg_read(fid, vgname, mda, 0)))) {
inconsistent = 1;
release_vg(vg);
continue;
@ -3197,7 +3197,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
!(vg = mda->ops->vg_read_precommit(fid, vgname,
mda))) ||
(!use_precommitted &&
!(vg = mda->ops->vg_read(fid, vgname, mda)))) {
!(vg = mda->ops->vg_read(fid, vgname, mda, 0)))) {
inconsistent = 1;
continue;
}

View File

@ -77,7 +77,8 @@ struct metadata_area_ops {
struct dm_list list;
struct volume_group *(*vg_read) (struct format_instance * fi,
const char *vg_name,
struct metadata_area * mda);
struct metadata_area * mda,
int single_device);
struct volume_group *(*vg_read_precommit) (struct format_instance * fi,
const char *vg_name,
struct metadata_area * mda);