mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
lvmetad: Set up lvmcache & PV structs for outdated_pvs.
This commit is contained in:
parent
55f3369692
commit
e8d00e0687
37
lib/cache/lvmetad.c
vendored
37
lib/cache/lvmetad.c
vendored
@ -395,6 +395,22 @@ static int _pv_populate_lvmcache(struct cmd_context *cmd,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int _pv_update_struct_pv(struct physical_volume *pv, struct format_instance *fid)
|
||||||
|
{
|
||||||
|
struct lvmcache_info *info;
|
||||||
|
if ((info = lvmcache_info_from_pvid((const char *)&pv->id, 0))) {
|
||||||
|
pv->label_sector = lvmcache_get_label(info)->sector;
|
||||||
|
pv->dev = lvmcache_device(info);
|
||||||
|
if (!pv->dev)
|
||||||
|
pv->status |= MISSING_PV;
|
||||||
|
if (!lvmcache_fid_add_mdas_pv(info, fid))
|
||||||
|
return_0;
|
||||||
|
pv->fid = fid;
|
||||||
|
} else
|
||||||
|
pv->status |= MISSING_PV; /* probably missing */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgname, const char *vgid)
|
struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgname, const char *vgid)
|
||||||
{
|
{
|
||||||
struct volume_group *vg = NULL;
|
struct volume_group *vg = NULL;
|
||||||
@ -409,7 +425,6 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna
|
|||||||
struct format_type *fmt;
|
struct format_type *fmt;
|
||||||
struct dm_config_node *pvcn;
|
struct dm_config_node *pvcn;
|
||||||
struct pv_list *pvl;
|
struct pv_list *pvl;
|
||||||
struct lvmcache_info *info;
|
|
||||||
|
|
||||||
if (!lvmetad_active())
|
if (!lvmetad_active())
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -460,22 +475,26 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna
|
|||||||
for (pvcn = pvcn->child; pvcn; pvcn = pvcn->sib)
|
for (pvcn = pvcn->child; pvcn; pvcn = pvcn->sib)
|
||||||
_pv_populate_lvmcache(cmd, pvcn, fmt, 0);
|
_pv_populate_lvmcache(cmd, pvcn, fmt, 0);
|
||||||
|
|
||||||
|
if ((pvcn = dm_config_find_node(top, "metadata/outdated_pvs")))
|
||||||
|
for (pvcn = pvcn->child; pvcn; pvcn = pvcn->sib)
|
||||||
|
_pv_populate_lvmcache(cmd, pvcn, fmt, 0);
|
||||||
|
|
||||||
top->key = name;
|
top->key = name;
|
||||||
if (!(vg = import_vg_from_config_tree(reply.cft, fid)))
|
if (!(vg = import_vg_from_config_tree(reply.cft, fid)))
|
||||||
goto_out;
|
goto_out;
|
||||||
|
|
||||||
dm_list_iterate_items(pvl, &vg->pvs) {
|
dm_list_iterate_items(pvl, &vg->pvs) {
|
||||||
if ((info = lvmcache_info_from_pvid((const char *)&pvl->pv->id, 0))) {
|
if (!_pv_update_struct_pv(pvl->pv, fid)) {
|
||||||
pvl->pv->label_sector = lvmcache_get_label(info)->sector;
|
vg = NULL;
|
||||||
pvl->pv->dev = lvmcache_device(info);
|
goto_out; /* FIXME error path */
|
||||||
if (!pvl->pv->dev)
|
}
|
||||||
pvl->pv->status |= MISSING_PV;
|
}
|
||||||
if (!lvmcache_fid_add_mdas_pv(info, fid)) {
|
|
||||||
|
dm_list_iterate_items(pvl, &vg->pvs_outdated) {
|
||||||
|
if (!_pv_update_struct_pv(pvl->pv, fid)) {
|
||||||
vg = NULL;
|
vg = NULL;
|
||||||
goto_out; /* FIXME error path */
|
goto_out; /* FIXME error path */
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
pvl->pv->status |= MISSING_PV; /* probably missing */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lvmcache_update_vg(vg, 0);
|
lvmcache_update_vg(vg, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user