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:
parent
1f54709ee6
commit
69483a8aaf
@ -1,6 +1,8 @@
|
|||||||
Version 2.02.27 -
|
Version 2.02.27 -
|
||||||
================================
|
================================
|
||||||
|
Add vg_status function and clean up vg->status in tools directory.
|
||||||
Add --ignoremonitoring to disable all dmeventd interaction.
|
Add --ignoremonitoring to disable all dmeventd interaction.
|
||||||
|
Remove get_ prefix from get_pv_* functions.
|
||||||
|
|
||||||
Version 2.02.26 - 15th June 2007
|
Version 2.02.26 - 15th June 2007
|
||||||
================================
|
================================
|
||||||
|
@ -1837,3 +1837,8 @@ uint32_t pv_pe_alloc_count(pv_t *pv)
|
|||||||
{
|
{
|
||||||
return pv_field(pv, pe_alloc_count);
|
return pv_field(pv, pe_alloc_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t vg_status(vg_t *vg)
|
||||||
|
{
|
||||||
|
return vg->status;
|
||||||
|
}
|
||||||
|
@ -235,6 +235,8 @@ struct volume_group {
|
|||||||
struct list tags;
|
struct list tags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct volume_group vg_t;
|
||||||
|
|
||||||
/* There will be one area for each stripe */
|
/* There will be one area for each stripe */
|
||||||
struct lv_segment_area {
|
struct lv_segment_area {
|
||||||
area_type_t type;
|
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_count(pv_t *pv);
|
||||||
uint32_t pv_pe_alloc_count(pv_t *pv);
|
uint32_t pv_pe_alloc_count(pv_t *pv);
|
||||||
|
|
||||||
|
uint32_t vg_status(vg_t *vg);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -587,7 +587,7 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* FIXME Allow exclusive activation. */
|
/* FIXME Allow exclusive activation. */
|
||||||
if (vg->status & CLUSTERED) {
|
if (vg_status(vg) & CLUSTERED) {
|
||||||
log_error("Clustered snapshots are not yet supported.");
|
log_error("Clustered snapshots are not yet supported.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ static int _vgchange_available(struct cmd_context *cmd, struct volume_group *vg)
|
|||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activate && lockingfailed() && (vg->status & CLUSTERED)) {
|
if (activate && lockingfailed() && (vg_status(vg) & CLUSTERED)) {
|
||||||
log_error("Locking inactive: ignoring clustered "
|
log_error("Locking inactive: ignoring clustered "
|
||||||
"volume group %s", vg->name);
|
"volume group %s", vg->name);
|
||||||
return ECMD_FAILED;
|
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");
|
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",
|
log_error("Volume group \"%s\" is already resizeable",
|
||||||
vg->name);
|
vg->name);
|
||||||
return ECMD_FAILED;
|
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",
|
log_error("Volume group \"%s\" is already not resizeable",
|
||||||
vg->name);
|
vg->name);
|
||||||
return ECMD_FAILED;
|
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");
|
int clustered = !strcmp(arg_str_value(cmd, clustered_ARG, "n"), "y");
|
||||||
struct lv_list *lvl;
|
struct lv_list *lvl;
|
||||||
|
|
||||||
if (clustered && (vg->status & CLUSTERED)) {
|
if (clustered && (vg_status(vg) & CLUSTERED)) {
|
||||||
log_error("Volume group \"%s\" is already clustered",
|
log_error("Volume group \"%s\" is already clustered",
|
||||||
vg->name);
|
vg->name);
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!clustered && !(vg->status & CLUSTERED)) {
|
if (!clustered && !(vg_status(vg) & CLUSTERED)) {
|
||||||
log_error("Volume group \"%s\" is already not clustered",
|
log_error("Volume group \"%s\" is already not clustered",
|
||||||
vg->name);
|
vg->name);
|
||||||
return ECMD_FAILED;
|
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);
|
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 "
|
log_error("Volume group \"%s\" must be resizeable "
|
||||||
"to change MaxLogicalVolume", vg->name);
|
"to change MaxLogicalVolume", vg->name);
|
||||||
return ECMD_FAILED;
|
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);
|
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 "
|
log_error("Volume group \"%s\" must be resizeable "
|
||||||
"to change MaxPhysicalVolumes", vg->name);
|
"to change MaxPhysicalVolumes", vg->name);
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
@ -377,7 +377,7 @@ static int _vgchange_pesize(struct cmd_context *cmd, struct volume_group *vg)
|
|||||||
{
|
{
|
||||||
uint32_t extent_size;
|
uint32_t extent_size;
|
||||||
|
|
||||||
if (!(vg->status & RESIZEABLE_VG)) {
|
if (!(vg_status(vg) & RESIZEABLE_VG)) {
|
||||||
log_error("Volume group \"%s\" must be resizeable "
|
log_error("Volume group \"%s\" must be resizeable "
|
||||||
"to change PE size", vg->name);
|
"to change PE size", vg->name);
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
@ -525,12 +525,12 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
|
|||||||
return ECMD_FAILED;
|
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);
|
log_error("Volume group \"%s\" is read-only", vg->name);
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vg->status & EXPORTED_VG) {
|
if (vg_status(vg) & EXPORTED_VG) {
|
||||||
log_error("Volume group \"%s\" is exported", vg_name);
|
log_error("Volume group \"%s\" is exported", vg_name);
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,12 @@ static int vgimport_single(struct cmd_context *cmd __attribute((unused)),
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(vg->status & EXPORTED_VG)) {
|
if (!(vg_status(vg) & EXPORTED_VG)) {
|
||||||
log_error("Volume group \"%s\" is not exported", vg_name);
|
log_error("Volume group \"%s\" is not exported", vg_name);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vg->status & PARTIAL_VG) {
|
if (vg_status(vg) & PARTIAL_VG) {
|
||||||
log_error("Volume group \"%s\" is partially missing", vg_name);
|
log_error("Volume group \"%s\" is partially missing", vg_name);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -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",
|
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);
|
vg->fid->fmt->name);
|
||||||
|
|
||||||
check_current_backup(vg);
|
check_current_backup(vg);
|
||||||
|
Loading…
Reference in New Issue
Block a user