summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Wysochanski <dwysocha@redhat.com>2007-06-19 04:23:32 +0000
committerDave Wysochanski <dwysocha@redhat.com>2007-06-19 04:23:32 +0000
commit69483a8aaf43976845b20bfa4d2f0ed3bb362586 (patch)
treef231babc8ad4a145a5efa95b5576154f48b63b07
parent1f54709ee6802e7a0408416cf23fa08781dac412 (diff)
downloadlvm2-69483a8aaf43976845b20bfa4d2f0ed3bb362586.tar.gz
lvm2-69483a8aaf43976845b20bfa4d2f0ed3bb362586.tar.xz
lvm2-69483a8aaf43976845b20bfa4d2f0ed3bb362586.zip
Add vg_status function and clean up vg->status in tools directory
-rw-r--r--WHATS_NEW2
-rw-r--r--lib/metadata/metadata.c5
-rw-r--r--lib/metadata/metadata.h4
-rw-r--r--tools/lvcreate.c2
-rw-r--r--tools/vgchange.c20
-rw-r--r--tools/vgimport.c4
-rw-r--r--tools/vgscan.c2
7 files changed, 25 insertions, 14 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index baf64d33..d0aed7b0 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 707846a9..d08752c9 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 83659b24..f2751230 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 c94843e7..ec3af687 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 9be5af2a..cde1fbb9 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 64a19b77..da37a6ab 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 de2c106b..80c98bd6 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);