summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Rockai <prockai@redhat.com>2014-11-27 20:20:48 +0100
committerPetr Rockai <prockai@redhat.com>2014-11-27 20:20:48 +0100
commit2c3db52356eebd7ad7e950a01f465359c040b379 (patch)
treeecc44665e652da10e0d6241b1c9529dbe171c442
parent92908541638b41215d48e51d6fa4aa63b82d8c1a (diff)
downloadlvm2-2c3db52356eebd7ad7e950a01f465359c040b379.tar.gz
metadata: Add cache_policy to lvcreate_params and honour it.
-rw-r--r--lib/metadata/lv_manip.c11
-rw-r--r--lib/metadata/metadata-exported.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 879cd51f2..b00e11ba0 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7143,6 +7143,13 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
}
}
+ if (lv_is_cache_pool(lv) && !origin_lv) {
+ if (lp->cache_policy && !lv_cache_setpolicy(lv, lp->cache_policy))
+ return NULL; /* revert? */
+ if (!lv_update_and_reload(lv))
+ return NULL; /* FIXME: revert */
+ }
+
if (seg_is_cache(lp) || (origin_lv && lv_is_cache_pool(lv))) {
/* Finish cache conversion magic */
if (origin_lv) {
@@ -7161,6 +7168,10 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
}
}
lv = tmp_lv;
+
+ if (lp->cache_policy && !lv_cache_setpolicy(lv, lp->cache_policy))
+ return NULL; /* revert? */
+
if (!lv_update_and_reload(lv)) {
/* FIXME Do a better revert */
log_error("Aborting. Manual intervention required.");
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index d960e1fbf..d70602d80 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -854,6 +854,7 @@ struct lvcreate_params {
uint32_t max_recovery_rate; /* RAID */
uint64_t feature_flags; /* cache */
+ struct dm_config_tree *cache_policy; /* cache */
const struct segment_type *segtype; /* all */
unsigned target_attr; /* all */