]> sourceware.org Git - lvm2.git/commitdiff
Add vg_set_fid function to change VG format instance.
authorPeter Rajnoha <prajnoha@redhat.com>
Mon, 21 Feb 2011 12:10:58 +0000 (12:10 +0000)
committerPeter Rajnoha <prajnoha@redhat.com>
Mon, 21 Feb 2011 12:10:58 +0000 (12:10 +0000)
This function also sets a reference to a new VG format instance for all PVs
that are part of the VG so the PV-VG interconnection is consistent after the
change.

lib/format_text/archiver.c
lib/metadata/metadata.c
lib/metadata/metadata.h

index 84119652640f34681f3eb2540487ceec6ab61703..8b7e240d51c31d5e8c288415873e26a4cfcb01b1 100644 (file)
@@ -308,10 +308,11 @@ int backup_restore_vg(struct cmd_context *cmd, struct volume_group *vg)
        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
index 06969974815fabd80156ed3b03acaf09b00b6626..85796009f2917ea76e6c3f9a23d2ffbe9e8a5430 100644 (file)
@@ -3931,6 +3931,16 @@ uint32_t vg_lock_newname(struct cmd_context *cmd, const char *vgname)
        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)
 {
index ab292b5cfe06144dc2b9f49cfffb30232614334f..6981d8e30faea59dad1c9128257cb1c3cd228466 100644 (file)
@@ -190,6 +190,7 @@ struct metadata_area *mda_copy(struct dm_pool *mem,
 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,
This page took 0.046998 seconds and 5 git commands to generate.