fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS;
fic.context.vg_ref.vg_name = vg->name;
fic.context.vg_ref.vg_id = NULL;
- if (!(vg->fid = cmd->fmt->ops->create_instance(cmd->fmt, &fic))) {
+ if (!(fid = cmd->fmt->ops->create_instance(cmd->fmt, &fic))) {
log_error("Failed to allocate format instance");
return 0;
}
+ vg_set_fid(vg, fid);
/*
* Setting vg->old_name to a blank value will explicitly
return FAILED_EXIST;
}
+void vg_set_fid(struct volume_group *vg,
+ struct format_instance *fid)
+{
+ struct pv_list *pvl;
+
+ vg->fid = fid;
+ dm_list_iterate_items(pvl, &vg->pvs)
+ pvl->pv->fid = fid;
+}
+
static int _convert_key_to_string(const char *key, size_t key_len,
unsigned sub_key, char *buf, size_t buf_len)
{
unsigned mda_is_ignored(struct metadata_area *mda);
void mda_set_ignored(struct metadata_area *mda, unsigned ignored);
unsigned mda_locns_match(struct metadata_area *mda1, struct metadata_area *mda2);
+void vg_set_fid(struct volume_group *vg, struct format_instance *fid);
int fid_add_mda(struct format_instance *fid, struct metadata_area *mda,
const char *key, size_t key_len, const unsigned sub_key);
int fid_add_mdas(struct format_instance *fid, struct dm_list *mdas,