1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

Add vg_status function and clean up vg->status in tools directory

This commit is contained in:
Dave Wysochanski 2007-06-19 04:23:32 +00:00
parent 1f54709ee6
commit 69483a8aaf
7 changed files with 25 additions and 14 deletions

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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