| Top |
| #define | BD_LVM_MAX_LV_SIZE |
| #define | BD_LVM_DEFAULT_PE_SIZE |
| #define | BD_LVM_DEFAULT_PE_START |
| #define | BD_LVM_MIN_PE_SIZE |
| #define | BD_LVM_MAX_PE_SIZE |
| #define | USE_DEFAULT_PE_SIZE |
| #define | BD_LVM_MIN_THPOOL_MD_SIZE |
| #define | BD_LVM_MAX_THPOOL_MD_SIZE |
| #define | BD_LVM_MIN_THPOOL_CHUNK_SIZE |
| #define | BD_LVM_MAX_THPOOL_CHUNK_SIZE |
| #define | THPOOL_MD_FACTOR_NEW |
| #define | THPOOL_MD_FACTOR_EXISTS |
| #define | BD_LVM_MIN_CACHE_MD_SIZE |
| #define | BD_LVM_ERROR |
| enum | BDLVMError |
| BDLVMPVdata | |
| BDLVMVGdata | |
| BDLVMLVdata | |
| enum | BDLVMCacheMode |
| enum | BDLVMCachePoolFlags |
| BDLVMCacheStats |
A plugin for operations with LVM. All sizes passed in/out to/from the functions are in bytes.
void
bd_lvm_close ();
Cleans up after the plugin. **This function is called automatically by the library's functions that unload it.**
gboolean
bd_lvm_init ();
Initializes the plugin. **This function is called automatically by the library's initialization functions.**
#define RESOLVE_PE_SIZE(size) ((size) == USE_DEFAULT_PE_SIZE ? BD_LVM_DEFAULT_PE_SIZE : (size))
BDLVMPVdata *
bd_lvm_pvdata_copy (BDLVMPVdata *data);
Creates a new copy of data
.
[skip]
BDLVMVGdata *
bd_lvm_vgdata_copy (BDLVMVGdata *data);
Creates a new copy of data
.
[skip]
BDLVMLVdata *
bd_lvm_lvdata_copy (BDLVMLVdata *data);
Creates a new copy of data
.
[skip]
BDLVMCacheStats *
bd_lvm_cache_stats_copy (BDLVMCacheStats *data);
Creates a new copy of data
.
[skip]
void
bd_lvm_cache_stats_free (BDLVMCacheStats *data);
Frees data
.
[skip]
guint64 bd_lvm_round_size_to_pe (guint64 size,guint64 pe_size,gboolean roundup,GError **error);
guint64 bd_lvm_get_lv_physical_size (guint64 lv_size,guint64 pe_size,GError **error);
guint64 bd_lvm_get_thpool_padding (guint64 size,guint64 pe_size,gboolean included,GError **error);
gboolean bd_lvm_is_valid_thpool_md_size (guint64 size,GError **error);
gboolean bd_lvm_is_valid_thpool_chunk_size (guint64 size,gboolean discard,GError **error);
gboolean bd_lvm_pvcreate (const gchar *device,guint64 data_alignment,guint64 metadata_size,const BDExtraArg **extra,GError **error);
device |
the device to make PV from |
|
data_alignment |
data (first PE) alignment or 0 to use the default |
|
metadata_size |
size of the area reserved for metadata or 0 to use the default |
|
extra |
extra options for the PV creation (just passed to LVM as is). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
gboolean bd_lvm_pvresize (const gchar *device,guint64 size,const BDExtraArg **extra,GError **error);
gboolean bd_lvm_pvremove (const gchar *device,const BDExtraArg **extra,GError **error);
gboolean bd_lvm_pvmove (const gchar *src,const gchar *dest,const BDExtraArg **extra,GError **error);
gboolean bd_lvm_pvscan (const gchar *device,gboolean update_cache,const BDExtraArg **extra,GError **error);
gboolean bd_lvm_vgcreate (const gchar *name,const gchar **pv_list,guint64 pe_size,const BDExtraArg **extra,GError **error);
name |
name of the newly created VG |
|
pv_list |
list of PVs the newly created VG should use. |
[array zero-terminated=1] |
pe_size |
PE size or 0 if the default value should be used |
|
extra |
extra options for the VG creation (just passed to LVM as is). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
gboolean bd_lvm_vgremove (const gchar *vg_name,const BDExtraArg **extra,GError **error);
gboolean bd_lvm_vgrename (const gchar *old_vg_name,const gchar *new_vg_name,const BDExtraArg **extra,GError **error);
gboolean bd_lvm_vgactivate (const gchar *vg_name,const BDExtraArg **extra,GError **error);
gboolean bd_lvm_vgdeactivate (const gchar *vg_name,const BDExtraArg **extra,GError **error);
gboolean bd_lvm_vgextend (const gchar *vg_name,const gchar *device,const BDExtraArg **extra,GError **error);
gboolean bd_lvm_vgreduce (const gchar *vg_name,const gchar *device,const BDExtraArg **extra,GError **error);
vg_name |
name of the to be reduced VG |
|
device |
PV device the |
[allow-none] |
extra |
extra options for the VG reduction (just passed to LVM as is). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
whether the VG vg_name
was successfully reduced of the given device
or not
Note: This function does not move extents off of the PV before removing it from the VG. You must do that first by calling bd_lvm_pvmove.
gchar * bd_lvm_lvorigin (const gchar *vg_name,const gchar *lv_name,GError **error);
gboolean bd_lvm_lvcreate (const gchar *vg_name,const gchar *lv_name,guint64 size,const gchar *type,const gchar **pv_list,const BDExtraArg **extra,GError **error);
vg_name |
name of the VG to create a new LV in |
|
lv_name |
name of the to-be-created LV |
|
size |
requested size of the new LV |
|
type |
type of the new LV ("striped", "raid1",..., see lvcreate (8)). |
[allow-none] |
pv_list |
list of PVs the newly created LV should use or |
[allow-none][array zero-terminated=1] |
extra |
extra options for the LV creation (just passed to LVM as is). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
gboolean bd_lvm_lvremove (const gchar *vg_name,const gchar *lv_name,gboolean force,const BDExtraArg **extra,GError **error);
gboolean bd_lvm_lvrename (const gchar *vg_name,const gchar *lv_name,const gchar *new_name,const BDExtraArg **extra,GError **error);
gboolean bd_lvm_lvresize (const gchar *vg_name,const gchar *lv_name,guint64 size,const BDExtraArg **extra,GError **error);
gboolean bd_lvm_lvactivate (const gchar *vg_name,const gchar *lv_name,gboolean ignore_skip,const BDExtraArg **extra,GError **error);
vg_name |
name of the VG containing the to-be-activated LV |
|
lv_name |
name of the to-be-activated LV |
|
ignore_skip |
whether to ignore the skip flag or not |
|
extra |
extra options for the LV activation (just passed to LVM as is). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
gboolean bd_lvm_lvdeactivate (const gchar *vg_name,const gchar *lv_name,const BDExtraArg **extra,GError **error);
gboolean bd_lvm_lvsnapshotcreate (const gchar *vg_name,const gchar *origin_name,const gchar *snapshot_name,guint64 size,const BDExtraArg **extra,GError **error);
vg_name |
name of the VG containing the LV a new snapshot should be created of |
|
origin_name |
name of the LV a new snapshot should be created of |
|
snapshot_name |
name fo the to-be-created snapshot |
|
size |
requested size for the snapshot |
|
extra |
extra options for the LV snapshot creation (just passed to LVM as is). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
gboolean bd_lvm_lvsnapshotmerge (const gchar *vg_name,const gchar *snapshot_name,const BDExtraArg **extra,GError **error);
BDLVMLVdata * bd_lvm_lvinfo (const gchar *vg_name,const gchar *lv_name,GError **error);
BDLVMLVdata ** bd_lvm_lvs (const gchar *vg_name,GError **error);
gboolean bd_lvm_thpoolcreate (const gchar *vg_name,const gchar *lv_name,guint64 size,guint64 md_size,guint64 chunk_size,const gchar *profile,const BDExtraArg **extra,GError **error);
vg_name |
name of the VG to create a thin pool in |
|
lv_name |
name of the to-be-created pool LV |
|
size |
requested size of the to-be-created pool |
|
md_size |
requested metadata size or 0 to use the default |
|
chunk_size |
requested chunk size or 0 to use the default |
|
profile |
profile to use (see lvm(8) for more information) or |
[allow-none] |
extra |
extra options for the thin pool creation (just passed to LVM as is). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
gboolean bd_lvm_thpool_convert (const gchar *vg_name,const gchar *data_lv,const gchar *metadata_lv,const gchar *name,const BDExtraArg **extra,GError **error);
Converts the data_lv
and metadata_lv
into a new thin pool in the vg_name
VG.
vg_name |
name of the VG to create the new thin pool in |
|
data_lv |
name of the LV that should become the data part of the new pool |
|
metadata_lv |
name of the LV that should become the metadata part of the new pool |
|
name |
name for the thin pool (if |
[allow-none] |
extra |
extra options for the thin pool creation (just passed to LVM as is). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
gboolean bd_lvm_thlvcreate (const gchar *vg_name,const gchar *pool_name,const gchar *lv_name,guint64 size,const BDExtraArg **extra,GError **error);
vg_name |
name of the VG containing the thin pool providing extents for the to-be-created thin LV |
|
pool_name |
name of the pool LV providing extents for the to-be-created thin LV |
|
lv_name |
name of the to-be-created thin LV |
|
size |
requested virtual size of the to-be-created thin LV |
|
extra |
extra options for the thin LV creation (just passed to LVM as is). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
gchar * bd_lvm_thlvpoolname (const gchar *vg_name,const gchar *lv_name,GError **error);
gboolean bd_lvm_thsnapshotcreate (const gchar *vg_name,const gchar *origin_name,const gchar *snapshot_name,const gchar *pool_name,const BDExtraArg **extra,GError **error);
vg_name |
name of the VG containing the thin LV a new snapshot should be created of |
|
origin_name |
name of the thin LV a new snapshot should be created of |
|
snapshot_name |
name fo the to-be-created snapshot |
|
pool_name |
name of the thin pool to create the snapshot in or |
[allow-none] |
extra |
extra options for the thin LV snapshot creation (just passed to LVM as is). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
gboolean bd_lvm_set_global_config (const gchar *new_config,GError **error);
gboolean bd_lvm_cache_attach (const gchar *vg_name,const gchar *data_lv,const gchar *cache_pool_lv,const BDExtraArg **extra,GError **error);
vg_name |
name of the VG containing the |
|
data_lv |
data LV to attache the |
|
cache_pool_lv |
cache pool LV to attach to the |
|
extra |
extra options for the cache attachment (just passed to LVM as is). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
gboolean bd_lvm_cache_create_cached_lv (const gchar *vg_name,const gchar *lv_name,guint64 data_size,guint64 cache_size,guint64 md_size,BDLVMCacheMode mode,BDLVMCachePoolFlags flags,const gchar **slow_pvs,const gchar **fast_pvs,GError **error);
vg_name |
name of the VG to create a cached LV in |
|
lv_name |
name of the cached LV to create |
|
data_size |
size of the data LV |
|
cache_size |
size of the cache (or cached LV more precisely) |
|
md_size |
size of the cache metadata LV or 0 to use the default |
|
mode |
cache mode for the cached LV |
|
flags |
a combination of (ORed) BDLVMCachePoolFlags |
|
slow_pvs |
list of slow PVs (used for the data LV). |
[array zero-terminated=1] |
fast_pvs |
list of fast PVs (used for the cache LV). |
[array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
gboolean bd_lvm_cache_create_pool (const gchar *vg_name,const gchar *pool_name,guint64 pool_size,guint64 md_size,BDLVMCacheMode mode,BDLVMCachePoolFlags flags,const gchar **fast_pvs,GError **error);
vg_name |
name of the VG to create |
|
pool_name |
name of the cache pool LV to create |
|
pool_size |
desired size of the cache pool |
|
md_size |
desired size of the |
|
mode |
cache mode of the |
|
flags |
a combination of (ORed) BDLVMCachePoolFlags |
|
fast_pvs |
list of (fast) PVs to create the |
[array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
gboolean bd_lvm_cache_pool_convert (const gchar *vg_name,const gchar *data_lv,const gchar *metadata_lv,const gchar *name,const BDExtraArg **extra,GError **error);
Converts the data_lv
and metadata_lv
into a new cache pool in the vg_name
VG.
vg_name |
name of the VG to create the new thin pool in |
|
data_lv |
name of the LV that should become the data part of the new pool |
|
metadata_lv |
name of the LV that should become the metadata part of the new pool |
|
name |
name for the thin pool (if |
[allow-none] |
extra |
extra options for the thin pool creation (just passed to LVM as is). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
gboolean bd_lvm_cache_detach (const gchar *vg_name,const gchar *cached_lv,gboolean destroy,const BDExtraArg **extra,GError **error);
vg_name |
name of the VG containing the |
|
cached_lv |
name of the cached LV to detach its cache from |
|
destroy |
whether to destroy the cache after detach or not |
|
extra |
extra options for the cache detachment (just passed to LVM as is). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
guint64 bd_lvm_cache_get_default_md_size (guint64 cache_size,GError **error);
BDLVMCacheMode bd_lvm_cache_get_mode_from_str (const gchar *mode_str,GError **error);
const gchar * bd_lvm_cache_get_mode_str (BDLVMCacheMode mode,GError **error);
gchar * bd_lvm_cache_pool_name (const gchar *vg_name,const gchar *cached_lv,GError **error);
BDLVMCacheStats * bd_lvm_cache_stats (const gchar *vg_name,const gchar *cached_lv,GError **error);
gchar * bd_lvm_data_lv_name (const gchar *vg_name,const gchar *lv_name,GError **error);
typedef struct {
gchar *pv_name;
gchar *pv_uuid;
guint64 pv_free;
guint64 pv_size;
guint64 pe_start;
gchar *vg_name;
gchar *vg_uuid;
guint64 vg_size;
guint64 vg_free;
guint64 vg_extent_size;
guint64 vg_extent_count;
guint64 vg_free_count;
guint64 vg_pv_count;
} BDLVMPVdata;
name of the PV |
||
UUID of the PV |
||
size of the free space in the PV |
||
size of the PV |
||
start of the physical extents area (i.e. offset of the first PE) |
||
name of the VG the PV belongs to |
||
UUID of the VG the PV belongs to |
||
size of the VG the PV belongs to |
||
size of the free space in the PV's VG |
||
extent size used by the PV's VG |
||
number of extents in the PV's VG |
||
number of free extents in the PV's VG |
||
number of PVs that belong to this PV's VG |
typedef struct {
gchar *name;
gchar *uuid;
guint64 size;
guint64 free;
guint64 extent_size;
guint64 extent_count;
guint64 free_count;
guint64 pv_count;
} BDLVMVGdata;
typedef struct {
gchar *lv_name;
gchar *vg_name;
gchar *uuid;
guint64 size;
gchar *attr;
gchar *segtype;
gchar *origin;
gchar *pool_lv;
gchar *data_lv;
gchar *metadata_lv;
gchar *roles;
gchar *move_pv;
guint64 data_percent;
guint64 metadata_percent;
guint64 copy_percent;
} BDLVMLVdata;
name of the LV |
||
name of the VG the LV belongs to |
||
UUID of the LV |
||
size of the LV |
||
attributes of the LV |
||
segment type of the LV |
||
origin of the LV (for snapshots, etc.) |
||
pool LV of the LV (for thin and cached LVs) |
||
data LV of the LV (for thin and cache pools) |
||
metadata LV of the LV (for thin and cache pools) |
||
typedef struct {
guint64 block_size;
guint64 cache_size;
guint64 cache_used;
guint64 md_block_size;
guint64 md_size;
guint64 md_used;
guint64 read_hits;
guint64 read_misses;
guint64 write_hits;
guint64 write_misses;
BDLVMCacheMode mode;
} BDLVMCacheStats;
block size used by the cache |
||
size of the cache |
||
size of the used space in the cache |
||
block size used for cache metadata |
||
size of the metadata space of the cache |
||
size of the used metadata space in the cache |
||
number of read hits |
||
number of read misses |
||
number of write hits |
||
number of write misses |
||
BDLVMCacheMode |
mode the cache is operating in |