struct volume_group * vg, struct config_node * pvn,
struct config_node * vgn,
struct dm_hash_table * pv_hash,
- int *scan_done_once);
+ unsigned *scan_done_once,
+ unsigned report_missing_devices);
#define _read_int32(root, path, result) \
get_config_uint32(root, path, (uint32_t *) result)
static int _read_pv(struct format_instance *fid, struct dm_pool *mem,
struct volume_group *vg, struct config_node *pvn,
struct config_node *vgn __attribute((unused)),
- struct dm_hash_table *pv_hash, int *scan_done_once)
+ struct dm_hash_table *pv_hash, unsigned *scan_done_once,
+ unsigned report_missing_devices)
{
struct physical_volume *pv;
struct pv_list *pvl;
char buffer[64] __attribute((aligned(8)));
if (!id_write_format(&pv->id, buffer, sizeof(buffer)))
- log_error("Couldn't find device.");
+ buffer[0] = '\0';
+ if (report_missing_devices)
+ log_error("Couldn't find device with uuid %s.", buffer);
else
- log_error("Couldn't find device with uuid '%s'.",
- buffer);
+ log_very_verbose("Couldn't find device with uuid %s.", buffer);
}
if (!(pv->vg_name = dm_pool_strdup(mem, vg->name)))
struct volume_group *vg, struct config_node *lvn,
struct config_node *vgn __attribute((unused)),
struct dm_hash_table *pv_hash __attribute((unused)),
- int *scan_done_once __attribute((unused)))
+ unsigned *scan_done_once __attribute((unused)),
+ unsigned report_missing_devices __attribute((unused)))
{
struct logical_volume *lv;
struct config_node *cn;
struct volume_group *vg, struct config_node *lvn,
struct config_node *vgn __attribute((unused)),
struct dm_hash_table *pv_hash,
- int *scan_done_once __attribute((unused)))
+ unsigned *scan_done_once __attribute((unused)),
+ unsigned report_missing_devices __attribute((unused)))
{
struct logical_volume *lv;
struct lv_list *lvl;
const char *section, section_fn fn,
struct dm_pool *mem,
struct volume_group *vg, struct config_node *vgn,
- struct dm_hash_table *pv_hash, int optional)
+ struct dm_hash_table *pv_hash, int optional,
+ unsigned *scan_done_once)
{
struct config_node *n;
- int scan_done_once = 0;
+ /* Only report missing devices when doing a scan */
+ unsigned report_missing_devices = scan_done_once ? !*scan_done_once : 1;
if (!(n = find_config_node(vgn, section))) {
if (!optional) {
}
for (n = n->child; n; n = n->sib) {
- if (!fn(fid, mem, vg, n, vgn, pv_hash, &scan_done_once))
+ if (!fn(fid, mem, vg, n, vgn, pv_hash, scan_done_once, report_missing_devices))
return_0;
}
}
static struct volume_group *_read_vg(struct format_instance *fid,
- struct config_tree *cft)
+ struct config_tree *cft,
+ unsigned use_cached_pvs)
{
struct config_node *vgn, *cn;
struct volume_group *vg;
struct dm_hash_table *pv_hash = NULL;
struct dm_pool *mem = dm_pool_create("lvm2 vg_read", VG_MEMPOOL_CHUNK);
+ unsigned scan_done_once = use_cached_pvs;
if (!mem)
return_NULL;
dm_list_init(&vg->pvs);
if (!_read_sections(fid, "physical_volumes", _read_pv, mem, vg,
- vgn, pv_hash, 0)) {
+ vgn, pv_hash, 0, &scan_done_once)) {
log_error("Couldn't find all physical volumes for volume "
"group %s.", vg->name);
goto bad;
}
if (!_read_sections(fid, "logical_volumes", _read_lvnames, mem, vg,
- vgn, pv_hash, 1)) {
+ vgn, pv_hash, 1, NULL)) {
log_error("Couldn't read all logical volume names for volume "
"group %s.", vg->name);
goto bad;
}
if (!_read_sections(fid, "logical_volumes", _read_lvsegs, mem, vg,
- vgn, pv_hash, 1)) {
+ vgn, pv_hash, 1, NULL)) {
log_error("Couldn't read all logical volumes for "
"volume group %s.", vg->name);
goto bad;