summaryrefslogtreecommitdiffstats
path: root/lib/activate
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2011-09-27 22:43:40 +0000
committerAlasdair Kergon <agk@redhat.com>2011-09-27 22:43:40 +0000
commit10d0d9c7c468abf1144586bf50a118eb94d0c7b6 (patch)
treed6e5b73b47a074f69e011a95fc0c32af71ee85d5 /lib/activate
parent74e72bd75d42ee3a24c5c094d10d9041a046fc66 (diff)
downloadlvm2-10d0d9c7c468abf1144586bf50a118eb94d0c7b6.tar.gz
lvm2-10d0d9c7c468abf1144586bf50a118eb94d0c7b6.tar.xz
lvm2-10d0d9c7c468abf1144586bf50a118eb94d0c7b6.zip
Introduce revert_lv for better pvmove cleanup.
(One further fix needed to remove the stray pvmove LVs left behind.)
Diffstat (limited to 'lib/activate')
-rw-r--r--lib/activate/activate.c15
-rw-r--r--lib/activate/activate.h3
-rw-r--r--lib/activate/dev_manager.c2
3 files changed, 12 insertions, 8 deletions
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 4ae41926..51862ac3 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -190,7 +190,7 @@ int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only)
return 1;
}
int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s,
- unsigned origin_only, unsigned exclusive)
+ unsigned origin_only, unsigned exclusive, unsigned revert)
{
return 1;
}
@@ -1356,14 +1356,16 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
laopts->origin_only = 0;
if (test_mode()) {
- _skip("Resuming %s%s.", lv->name, laopts->origin_only ? " without snapshots" : "");
+ _skip("Resuming %s%s%s.", lv->name, laopts->origin_only ? " without snapshots" : "",
+ laopts->revert ? " (reverting)" : "");
r = 1;
goto out;
}
- log_debug("Resuming LV %s/%s%s%s.", lv->vg->name, lv->name,
+ log_debug("Resuming LV %s/%s%s%s%s.", lv->vg->name, lv->name,
error_if_not_active ? "" : " if active",
- laopts->origin_only ? " without snapshots" : "");
+ laopts->origin_only ? " without snapshots" : "",
+ laopts->revert ? " (reverting)" : "");
if (!lv_info(cmd, lv, laopts->origin_only, &info, 0, 0))
goto_out;
@@ -1395,7 +1397,7 @@ out:
/* Returns success if the device is not active */
int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s,
- unsigned origin_only, unsigned exclusive)
+ unsigned origin_only, unsigned exclusive, unsigned revert)
{
struct lv_activate_opts laopts = {
.origin_only = origin_only,
@@ -1404,7 +1406,8 @@ int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s,
* non-clustered target should be used. This only happens
* if exclusive is set.
*/
- .exclusive = exclusive
+ .exclusive = exclusive,
+ .revert = revert
};
return _lv_resume(cmd, lvid_s, &laopts, 0);
diff --git a/lib/activate/activate.h b/lib/activate/activate.h
index 5b90420f..3b3d738a 100644
--- a/lib/activate/activate.h
+++ b/lib/activate/activate.h
@@ -34,6 +34,7 @@ struct lv_activate_opts {
int exclusive;
int origin_only;
int no_merging;
+ unsigned revert;
};
/* target attribute flags */
@@ -63,7 +64,7 @@ void activation_exit(void);
int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only);
int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only);
int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s,
- unsigned origin_only, unsigned exclusive);
+ unsigned origin_only, unsigned exclusive, unsigned revert);
int lv_activate(struct cmd_context *cmd, const char *lvid_s, int exclusive);
int lv_activate_with_filter(struct cmd_context *cmd, const char *lvid_s,
int exclusive);
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 0a3c29c1..b364d919 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1590,7 +1590,7 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
layer ? UINT32_C(0) : (uint32_t) lv->major,
layer ? UINT32_C(0) : (uint32_t) lv->minor,
_read_only_lv(lv),
- (lv->vg->status & PRECOMMITTED) ? 1 : 0,
+ ((lv->vg->status & PRECOMMITTED) | laopts->revert) ? 1 : 0,
lvlayer,
_get_udev_flags(dm, lv, layer))))
return_0;