diff --git a/WHATS_NEW b/WHATS_NEW index baf64d336..d0aed7b0f 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,6 +1,8 @@ Version 2.02.27 - ================================ + Add vg_status function and clean up vg->status in tools directory. Add --ignoremonitoring to disable all dmeventd interaction. + Remove get_ prefix from get_pv_* functions. Version 2.02.26 - 15th June 2007 ================================ diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 707846a99..d08752c9e 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -1837,3 +1837,8 @@ uint32_t pv_pe_alloc_count(pv_t *pv) { return pv_field(pv, pe_alloc_count); } + +uint32_t vg_status(vg_t *vg) +{ + return vg->status; +} diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h index 83659b249..f2751230a 100644 --- a/lib/metadata/metadata.h +++ b/lib/metadata/metadata.h @@ -235,6 +235,8 @@ struct volume_group { struct list tags; }; +typedef struct volume_group vg_t; + /* There will be one area for each stripe */ struct lv_segment_area { area_type_t type; @@ -650,4 +652,6 @@ uint64_t pv_pe_start(pv_t *pv); uint32_t pv_pe_count(pv_t *pv); uint32_t pv_pe_alloc_count(pv_t *pv); +uint32_t vg_status(vg_t *vg); + #endif diff --git a/tools/lvcreate.c b/tools/lvcreate.c index c94843e7f..ec3af687e 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -587,7 +587,7 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp) return 0; } /* FIXME Allow exclusive activation. */ - if (vg->status & CLUSTERED) { + if (vg_status(vg) & CLUSTERED) { log_error("Clustered snapshots are not yet supported."); return 0; } diff --git a/tools/vgchange.c b/tools/vgchange.c index 9be5af2a6..cde1fbb94 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 & CLUSTERED)) { + if (activate && lockingfailed() && (vg_status(vg) & CLUSTERED)) { log_error("Locking inactive: ignoring clustered " "volume group %s", vg->name); return ECMD_FAILED; @@ -207,13 +207,13 @@ static int _vgchange_resizeable(struct cmd_context *cmd, { int resizeable = !strcmp(arg_str_value(cmd, resizeable_ARG, "n"), "y"); - if (resizeable && (vg->status & RESIZEABLE_VG)) { + if (resizeable && (vg_status(vg) & RESIZEABLE_VG)) { log_error("Volume group \"%s\" is already resizeable", vg->name); return ECMD_FAILED; } - if (!resizeable && !(vg->status & RESIZEABLE_VG)) { + if (!resizeable && !(vg_status(vg) & RESIZEABLE_VG)) { log_error("Volume group \"%s\" is already not resizeable", 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 & CLUSTERED)) { + if (clustered && (vg_status(vg) & CLUSTERED)) { log_error("Volume group \"%s\" is already clustered", vg->name); return ECMD_FAILED; } - if (!clustered && !(vg->status & CLUSTERED)) { + if (!clustered && !(vg_status(vg) & CLUSTERED)) { log_error("Volume group \"%s\" is already not clustered", vg->name); return ECMD_FAILED; @@ -289,7 +289,7 @@ static int _vgchange_logicalvolume(struct cmd_context *cmd, { uint32_t max_lv = arg_uint_value(cmd, logicalvolume_ARG, 0); - if (!(vg->status & RESIZEABLE_VG)) { + if (!(vg_status(vg) & RESIZEABLE_VG)) { log_error("Volume group \"%s\" must be resizeable " "to change MaxLogicalVolume", vg->name); return ECMD_FAILED; @@ -331,7 +331,7 @@ static int _vgchange_physicalvolumes(struct cmd_context *cmd, { uint32_t max_pv = arg_uint_value(cmd, maxphysicalvolumes_ARG, 0); - if (!(vg->status & RESIZEABLE_VG)) { + if (!(vg_status(vg) & RESIZEABLE_VG)) { log_error("Volume group \"%s\" must be resizeable " "to change MaxPhysicalVolumes", vg->name); return ECMD_FAILED; @@ -377,7 +377,7 @@ static int _vgchange_pesize(struct cmd_context *cmd, struct volume_group *vg) { uint32_t extent_size; - if (!(vg->status & RESIZEABLE_VG)) { + if (!(vg_status(vg) & RESIZEABLE_VG)) { log_error("Volume group \"%s\" must be resizeable " "to change PE size", vg->name); return ECMD_FAILED; @@ -525,12 +525,12 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name, return ECMD_FAILED; } - if (!(vg->status & LVM_WRITE) && !arg_count(cmd, available_ARG)) { + if (!(vg_status(vg) & LVM_WRITE) && !arg_count(cmd, available_ARG)) { log_error("Volume group \"%s\" is read-only", vg->name); return ECMD_FAILED; } - if (vg->status & EXPORTED_VG) { + if (vg_status(vg) & EXPORTED_VG) { log_error("Volume group \"%s\" is exported", vg_name); return ECMD_FAILED; } diff --git a/tools/vgimport.c b/tools/vgimport.c index 64a19b775..da37a6abf 100644 --- a/tools/vgimport.c +++ b/tools/vgimport.c @@ -29,12 +29,12 @@ static int vgimport_single(struct cmd_context *cmd __attribute((unused)), goto error; } - if (!(vg->status & EXPORTED_VG)) { + if (!(vg_status(vg) & EXPORTED_VG)) { log_error("Volume group \"%s\" is not exported", vg_name); goto error; } - if (vg->status & PARTIAL_VG) { + if (vg_status(vg) & PARTIAL_VG) { log_error("Volume group \"%s\" is partially missing", vg_name); goto error; } diff --git a/tools/vgscan.c b/tools/vgscan.c index de2c106b3..80c98bd6b 100644 --- a/tools/vgscan.c +++ b/tools/vgscan.c @@ -34,7 +34,7 @@ static int vgscan_single(struct cmd_context *cmd, const char *vg_name, } log_print("Found %svolume group \"%s\" using metadata type %s", - (vg->status & EXPORTED_VG) ? "exported " : "", vg_name, + (vg_status(vg) & EXPORTED_VG) ? "exported " : "", vg_name, vg->fid->fmt->name); check_current_backup(vg);