1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-23 21:35:29 +03:00

Add most relevant vg_attr fields as lvm2app 'get' functions.

Of the vgs field vg_attr, a few of the most likely to be used attributes
are clustered, exported, and partial.  This patch adds the following 3
functions:
uint64_t lvm_vg_is_clustered(const vg_t vg)
uint64_t lvm_vg_is_exported(const vg_t vg)
uint64_t lvm_vg_is_partial(const vg_t vg)
This commit is contained in:
Dave Wysochanski 2009-09-14 19:43:11 +00:00
parent 11e8d26606
commit dd8ef51fa1
3 changed files with 53 additions and 0 deletions

View File

@ -721,6 +721,7 @@ uint64_t vg_max_pv(const struct volume_group *vg);
uint64_t vg_max_lv(const struct volume_group *vg);
int vg_check_write_mode(struct volume_group *vg);
#define vg_is_clustered(vg) (vg_status((vg)) & CLUSTERED)
#define vg_is_exported(vg) (vg_status((vg)) & EXPORTED_VG)
struct vgcreate_params {
char *vg_name;

View File

@ -480,6 +480,43 @@ int lvm_vg_reduce(vg_t vg, const char *device);
*/
int lvm_vg_set_extent_size(vg_t vg, uint32_t new_size);
/**
* Get whether or not a volume group is clustered.
*
* \param vg
* VG handle obtained from lvm_vg_create or lvm_vg_open.
*
* \return
* 1 if the VG is clustered, 0 if not
*/
uint64_t lvm_vg_is_clustered(vg_t vg);
/**
* Get whether or not a volume group is exported.
*
* \param vg
* VG handle obtained from lvm_vg_create or lvm_vg_open.
*
* \return
* 1 if the VG is exported, 0 if not
*/
uint64_t lvm_vg_is_exported(vg_t vg);
/**
* Get whether or not a volume group is a partial volume group.
*
* When one or more physical volumes belonging to the volume group
* are missing from the system the volume group is a partial volume
* group.
*
* \param vg
* VG handle obtained from lvm_vg_create or lvm_vg_open.
*
* \return
* 1 if the VG is PVs, 0 if not
*/
uint64_t lvm_vg_is_partial(vg_t vg);
/**
* Get the current metadata sequence number of a volume group.
*

View File

@ -243,6 +243,21 @@ uint64_t lvm_vg_get_seqno(const vg_t vg)
return vg_seqno(vg);
}
uint64_t lvm_vg_is_clustered(const vg_t vg)
{
return vg_is_clustered(vg);
}
uint64_t lvm_vg_is_exported(const vg_t vg)
{
return vg_is_exported(vg);
}
uint64_t lvm_vg_is_partial(const vg_t vg)
{
return (vg_missing_pv_count(vg) != 0);
}
/* FIXME: invalid handle? return INTMAX? */
uint64_t lvm_vg_get_size(const vg_t vg)
{