dm_task_destroy (dmt);
return r;
}
+
+#if 0
+int
+dm_rename (char * old, char * new)
+{
+ int r = 1;
+ struct dm_task *dmt;
+
+ if (!(dmt = dm_task_create(DM_DEVICE_RENAME)))
+ return 0;
+
+ if (!dm_task_set_name(dmt, old))
+ goto out;
+
+ if (!dm_task_set_newname(dmt, new))
+ goto out;
+
+ dm_task_no_open_count(dmt);
+
+ if (!dm_task_run(dmt))
+ goto out;
+
+ r = 0;
+out:
+ dm_task_destroy(dmt);
+ return r;
+}
+#endif
cmpp = find_mp(curmp, mpp->alias);
if (!cmpp) {
+ cmpp = find_mp_by_wwid(curmp, mpp->wwid);
+
+ if (cmpp && !conf->dry_run) {
+ condlog(2, "remove: %s (dup of %s)",
+ cmpp->alias, mpp->alias);
+ dm_flush_map(cmpp->alias, DEFAULT_TARGET);
+ }
mpp->action = ACT_CREATE;
return;
}
/*
* last chance to quit before touching the devmaps
*/
- if (conf->dry_run || mpp->action == ACT_NOTHING)
+ if (conf->dry_run)
return 0;
- if (mpp->action == ACT_SWITCHPG) {
+ switch (mpp->action) {
+ case ACT_NOTHING:
+ return 0;
+
+ case ACT_SWITCHPG:
dm_switchgroup(mpp->alias, mpp->nextpg);
/*
* we may have avoided reinstating paths because there where in
*/
reinstate_paths(mpp);
return 0;
- }
- if (mpp->action == ACT_CREATE)
+
+ case ACT_CREATE:
op = DM_DEVICE_CREATE;
+ break;
- if (mpp->action == ACT_RELOAD)
+ case ACT_RELOAD:
op = DM_DEVICE_RELOAD;
+ break;
+
+ default:
+ break;
+ }
/*
wwid = get_mpe_wwid(mpp->alias);
if (wwid) {
- strncpy(mpp->wwid, wwid, WWID_SIZE);
+ /* out of specified scope */
+ if (refwwid && strncmp(wwid, refwwid, WWID_SIZE))
+ continue;
wwid = NULL;
- } else
- strncpy(mpp->wwid, mpp->alias, WWID_SIZE);
-
- if (refwwid && strncmp(mpp->wwid, refwwid, WWID_SIZE))
- continue;
+ }
condlog(3, "params = %s", mpp->params);
condlog(3, "status = %s", mpp->status);
+
+ /* will set mpp->wwid */
disassemble_map(pathvec, mpp->params, mpp);
/*