1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Add vg_is_clustered() helper function.

Should be no functional change.
This commit is contained in:
Dave Wysochanski 2008-04-10 17:09:32 +00:00
parent 8965ff4bcf
commit 985ca02b6a
15 changed files with 22 additions and 21 deletions

View File

@ -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.

View File

@ -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;
}

View File

@ -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");

View File

@ -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)

View File

@ -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))

View File

@ -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]: ",

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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] = '-';

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;
}