summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WHATS_NEW1
-rw-r--r--lib/activate/dev_manager.c2
-rw-r--r--lib/display/display.c2
-rw-r--r--lib/format1/import-export.c2
-rw-r--r--lib/locking/locking.h2
-rw-r--r--lib/metadata/lv_manip.c2
-rw-r--r--lib/metadata/metadata-exported.h1
-rw-r--r--lib/metadata/metadata.c5
-rw-r--r--lib/mirror/mirrored.c4
-rw-r--r--lib/report/report.c2
-rw-r--r--tools/lvchange.c8
-rw-r--r--tools/lvcreate.c2
-rw-r--r--tools/pvmove.c2
-rw-r--r--tools/vgchange.c6
-rw-r--r--tools/vgsplit.c2
15 files changed, 22 insertions, 21 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 2d98cdb6..062404a8 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.34 -
===================================
+ Add vg_is_clustered() helper function.
Fix vgsplit to only move hidden 'snapshotN' LVs when necessary.
Update vgsplit tests for lvnames on the cmdline.
Update vgsplit man page to reflect lvnames on the cmdline.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index e53452bd..1b6242ce 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -836,7 +836,7 @@ static int _add_segment_to_dtree(struct dev_manager *dm,
/* If this is a snapshot origin, add real LV */
if (lv_is_origin(seg->lv) && !layer) {
- if (seg->lv->vg->status & CLUSTERED) {
+ if (vg_is_clustered(seg->lv->vg)) {
log_error("Clustered snapshots are not yet supported");
return 0;
}
diff --git a/lib/display/display.c b/lib/display/display.c
index 87e34fa4..d43b864b 100644
--- a/lib/display/display.c
+++ b/lib/display/display.c
@@ -602,7 +602,7 @@ void vgdisplay_full(const struct volume_group *vg)
/* vg number not part of LVM2 design
log_print ("VG # %u\n", vg->vg_number);
*/
- if (vg->status & CLUSTERED) {
+ if (vg_is_clustered(vg)) {
log_print("Clustered yes");
log_print("Shared %s",
vg->status & SHARED ? "yes" : "no");
diff --git a/lib/format1/import-export.c b/lib/format1/import-export.c
index a0de3628..04bcc028 100644
--- a/lib/format1/import-export.c
+++ b/lib/format1/import-export.c
@@ -271,7 +271,7 @@ int export_vg(struct vg_disk *vgd, struct volume_group *vg)
if (vg->status & LVM_WRITE)
vgd->vg_access |= VG_WRITE;
- if (vg->status & CLUSTERED)
+ if (vg_is_clustered(vg))
vgd->vg_access |= VG_CLUSTERED;
if (vg->status & SHARED)
diff --git a/lib/locking/locking.h b/lib/locking/locking.h
index 6c292f7d..a5872bcb 100644
--- a/lib/locking/locking.h
+++ b/lib/locking/locking.h
@@ -99,7 +99,7 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname);
#define LCK_LV_DEACTIVATE (LCK_LV | LCK_NULL | LCK_NONBLOCK)
#define LCK_LV_CLUSTERED(lv) \
- (((lv)->vg->status & CLUSTERED) ? LCK_CLUSTER_VG : 0)
+ (vg_is_clustered((lv)->vg) ? LCK_CLUSTER_VG : 0)
#define lock_lv_vol(cmd, lv, flags) \
lock_vol(cmd, (lv)->lvid.s, flags | LCK_LV_CLUSTERED(lv))
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 0dc9ed4c..d947b6ee 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1983,7 +1983,7 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
* 1) Clustered VG, and some remote nodes have the LV active
* 2) Non-clustered VG, but LV active locally
*/
- if ((vg_status(vg) & CLUSTERED) && !activate_lv_excl(cmd, lv) &&
+ if (vg_is_clustered(vg) && !activate_lv_excl(cmd, lv) &&
(force == PROMPT)) {
if (yes_no_prompt("Logical volume \"%s\" is active on other "
"cluster nodes. Really remove? [y/n]: ",
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index e0d55927..dd04e5f6 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -544,6 +544,7 @@ uint32_t pv_pe_count(const pv_t *pv);
uint32_t pv_pe_alloc_count(const pv_t *pv);
uint32_t vg_status(const vg_t *vg);
+#define vg_is_clustered(vg) (vg_status((vg)) & CLUSTERED)
struct vgcreate_params {
char *vg_name;
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index cecbcbd2..98c4156c 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -1124,7 +1124,7 @@ int vgs_are_compatible(struct cmd_context *cmd __attribute((unused)),
}
/* Clustering attribute must be the same */
- if ((vg_to->status & CLUSTERED) != (vg_from->status & CLUSTERED)) {
+ if (vg_is_clustered(vg_to) != vg_is_clustered(vg_from)) {
log_error("Clustered attribute differs for \"%s\" and \"%s\"",
vg_to->name, vg_from->name);
return 0;
@@ -2102,7 +2102,7 @@ int pv_analyze(struct cmd_context *cmd, const char *pv_name,
int vg_check_status(const struct volume_group *vg, uint32_t status)
{
if ((status & CLUSTERED) &&
- (vg->status & CLUSTERED) && !locking_is_clustered() &&
+ (vg_is_clustered(vg)) && !locking_is_clustered() &&
!lockingfailed()) {
log_error("Skipping clustered volume group %s", vg->name);
return 0;
@@ -2240,7 +2240,6 @@ uint32_t vg_status(const vg_t *vg)
return vg->status;
}
-
/**
* pv_by_path - Given a device path return a PV handle if it is a PV
* @cmd - handle to the LVM command instance
diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c
index 64bcd304..f837f0b1 100644
--- a/lib/mirror/mirrored.c
+++ b/lib/mirror/mirrored.c
@@ -237,7 +237,7 @@ static int _add_log(struct dev_manager *dm, struct lv_segment *seg,
* in clustered VG.
*/
if ((!(seg->lv->status & ACTIVATE_EXCL) &&
- (seg->lv->vg->status & CLUSTERED)))
+ (vg_is_clustered(seg->lv->vg))))
clustered = 1;
if (seg->log_lv) {
@@ -519,7 +519,7 @@ static int _mirrored_modules_needed(struct dm_pool *mem,
!list_segment_modules(mem, first_seg(seg->log_lv), modules))
return_0;
- if ((seg->lv->vg->status & CLUSTERED) &&
+ if (vg_is_clustered(seg->lv->vg) &&
!str_list_add(mem, modules, "clog")) {
log_error("cluster log string list allocation failed");
return 0;
diff --git a/lib/report/report.c b/lib/report/report.c
index 3279ad9f..c4aedff9 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -439,7 +439,7 @@ static int _vgstatus_disp(struct dm_report *rh __attribute((unused)), struct dm_
repstr[4] = _alloc_policy_char(vg->alloc);
- if (vg->status & CLUSTERED)
+ if (vg_is_clustered(vg))
repstr[5] = 'c';
else
repstr[5] = '-';
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 1948e3f1..766facf3 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -35,7 +35,7 @@ static int lvchange_permission(struct cmd_context *cmd,
return 0;
}
- if ((lv->status & MIRRORED) && (lv->vg->status & CLUSTERED) &&
+ if ((lv->status & MIRRORED) && (vg_is_clustered(lv->vg)) &&
lv_info(cmd, lv, &info, 0, 0) && info.exists) {
log_error("Cannot change permissions of mirror \"%s\" "
"while active.", lv->name);
@@ -119,7 +119,7 @@ static int lvchange_availability(struct cmd_context *cmd,
if (!deactivate_lv(cmd, lv))
return_0;
} else {
- if (lockingfailed() && (lv->vg->status & CLUSTERED)) {
+ if (lockingfailed() && (vg_is_clustered(lv->vg))) {
log_verbose("Locking failed: ignoring clustered "
"logical volume %s", lv->name);
return 0;
@@ -221,7 +221,7 @@ static int lvchange_resync(struct cmd_context *cmd,
}
}
- if ((lv->vg->status & CLUSTERED) && !activate_lv_excl(cmd, lv)) {
+ if (vg_is_clustered(lv->vg) && !activate_lv_excl(cmd, lv)) {
log_error("Can't get exclusive access to clustered volume %s",
lv->name);
return ECMD_FAILED;
@@ -236,7 +236,7 @@ static int lvchange_resync(struct cmd_context *cmd,
log_very_verbose("Starting resync of %s%s%s mirror \"%s\"",
(active) ? "active " : "",
- (lv->vg->status & CLUSTERED) ? "clustered " : "",
+ vg_is_clustered(lv->vg) ? "clustered " : "",
(log_lv) ? "disk-logged" : "core-logged",
lv->name);
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 6011b16b..b9295021 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -638,7 +638,7 @@ static int _lvcreate(struct cmd_context *cmd, struct volume_group *vg,
return 0;
}
/* FIXME Allow exclusive activation. */
- if (vg_status(vg) & CLUSTERED) {
+ if (vg_is_clustered(vg)) {
log_error("Clustered snapshots are not yet supported.");
return 0;
}
diff --git a/tools/pvmove.c b/tools/pvmove.c
index fbf0e272..0a1ead91 100644
--- a/tools/pvmove.c
+++ b/tools/pvmove.c
@@ -49,7 +49,7 @@ static int _pvmove_target_present(struct cmd_context *cmd, int clustered)
static unsigned _pvmove_is_exclusive(struct cmd_context *cmd,
struct volume_group *vg)
{
- if (vg_status(vg) & CLUSTERED)
+ if (vg_is_clustered(vg))
if (!_pvmove_target_present(cmd, 1))
return 1;
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 634f6201..c4867a61 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -134,7 +134,7 @@ static int _vgchange_available(struct cmd_context *cmd, struct volume_group *vg)
return ECMD_FAILED;
}
- if (activate && lockingfailed() && (vg_status(vg) & CLUSTERED)) {
+ if (activate && lockingfailed() && (vg_is_clustered(vg))) {
log_error("Locking inactive: ignoring clustered "
"volume group %s", vg->name);
return ECMD_FAILED;
@@ -243,13 +243,13 @@ static int _vgchange_clustered(struct cmd_context *cmd,
int clustered = !strcmp(arg_str_value(cmd, clustered_ARG, "n"), "y");
struct lv_list *lvl;
- if (clustered && (vg_status(vg) & CLUSTERED)) {
+ if (clustered && (vg_is_clustered(vg))) {
log_error("Volume group \"%s\" is already clustered",
vg->name);
return ECMD_FAILED;
}
- if (!clustered && !(vg_status(vg) & CLUSTERED)) {
+ if (!clustered && !(vg_is_clustered(vg))) {
log_error("Volume group \"%s\" is already not clustered",
vg->name);
return ECMD_FAILED;
diff --git a/tools/vgsplit.c b/tools/vgsplit.c
index cc22f54d..9ff9af39 100644
--- a/tools/vgsplit.c
+++ b/tools/vgsplit.c
@@ -379,7 +379,7 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
vp_new.alloc, 0, NULL)))
goto bad;
- if (vg_from->status & CLUSTERED)
+ if (vg_is_clustered(vg_from))
vg_to->status |= CLUSTERED;
}