Version 2.02.65 -
=================================
+ Disallow cluster attr toggling if there are active mirrors or snapshots.
Use /bin/bash for scripts with bashisms.
Skip internal lvm devices in scan if ignore suspended devices is requested.
Do not merge old device cache after we run full scan. (2.02.56)
int is_temporary_mirror_layer(const struct logical_volume *lv);
struct logical_volume * find_temporary_mirror(const struct logical_volume *lv);
+int lv_is_mirrored(const struct logical_volume *lv);
uint32_t lv_mirror_count(const struct logical_volume *lv);
uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
uint32_t region_size);
int vg_set_clustered(struct volume_group *vg, int clustered)
{
struct lv_list *lvl;
- if (clustered) {
- dm_list_iterate_items(lvl, &vg->lvs) {
+
+ /*
+ * We do not currently support switching the cluster attribute
+ * on active mirrors or snapshots.
+ */
+ dm_list_iterate_items(lvl, &vg->lvs) {
+ if (lv_is_mirrored(lvl->lv) && lv_is_active(lvl->lv)) {
+ log_error("Mirror logical volumes must be inactive "
+ "when changing the cluster attribute.");
+ return 0;
+ }
+
+ if (clustered) {
if (lv_is_origin(lvl->lv) || lv_is_cow(lvl->lv)) {
log_error("Volume group %s contains snapshots "
"that are not yet supported.",
return 0;
}
}
+
+ if ((lv_is_origin(lvl->lv) || lv_is_cow(lvl->lv)) &&
+ lv_is_active(lvl->lv)) {
+ log_error("Snapshot logical volumes must be inactive "
+ "when changing the cluster attribute.");
+ return 0;
+ }
}
if (clustered)
return NULL;
}
+int lv_is_mirrored(const struct logical_volume *lv)
+{
+ if (lv->status & MIRRORED)
+ return 1;
+
+ return 0;
+}
+
/*
* Returns the number of mirrors of the LV
*/