| Top |
| #define | USE_DEFAULT_PE_SIZE |
| #define | BD_LVM_ERROR |
| enum | BDLVMError |
| BDLVMPVdata | |
| BDLVMVGdata | |
| BDLVMLVdata |
A plugin for operations with LVM. All sizes passed in/out to/from the functions are in bytes.
#define RESOLVE_PE_SIZE(size) ((size) == USE_DEFAULT_PE_SIZE ? BD_LVM_DEFAULT_PE_SIZE : (size))
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 (gchar *device,guint64 data_alignment,guint64 metadata_size,GError **error);
gboolean bd_lvm_pvresize (gchar *device,guint64 size,GError **error);
gboolean bd_lvm_pvmove (gchar *src,gchar *dest,GError **error);
src |
the PV device to move extents off of |
|
dest |
the PV device to move extents onto or |
[allow-none] |
error |
place to store error (if any). |
[out] |
whether the extents from the src
PV where successfully moved or not
If dest
is NULL, VG allocation rules are used for the extents from the src
PV (see pvmove(8)).
gboolean bd_lvm_pvscan (gchar *device,gboolean update_cache,GError **error);
device |
the device to scan for PVs or |
[allow-none] |
update_cache |
whether to update the lvmetad cache or not |
|
error |
place to store error (if any). |
[out] |
whether the system or device
was successfully scanned for PVs or not
The device
argument is used only if update_cache
is TRUE. Otherwise the
whole system is scanned for PVs.
BDLVMPVdata * bd_lvm_pvinfo (gchar *device,GError **error);
information about the PV on the given device
or
NULL in case of error (the error
) gets populated in those cases).
[transfer full]
gboolean bd_lvm_vgcreate (gchar *name,gchar **pv_list,guint64 pe_size,GError **error);
gboolean bd_lvm_vgextend (gchar *vg_name,gchar *device,GError **error);
gboolean bd_lvm_vgreduce (gchar *vg_name,gchar *device,GError **error);
vg_name |
name of the to be reduced VG |
|
device |
PV device the |
[allow-none] |
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.
BDLVMVGdata * bd_lvm_vginfo (gchar *vg_name,GError **error);
information about the vg_name
VG or NULL in case
of error (the error
) gets populated in those cases).
[transfer full]
gchar * bd_lvm_lvorigin (gchar *vg_name,gchar *lv_name,GError **error);
vg_name |
name of the VG containing the queried LV |
|
lv_name |
name of the queried LV |
|
error |
place to store error (if any). |
[out] |
the origin volume for the vg_name
/lv_name
LV or
NULL if failed to determine (error
) is set in those cases).
[transfer full]
gboolean bd_lvm_lvcreate (gchar *vg_name,gchar *lv_name,guint64 size,gchar **pv_list,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 |
|
pv_list |
list of PVs the newly created LV should use or |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
gboolean bd_lvm_lvremove (gchar *vg_name,gchar *lv_name,gboolean force,GError **error);
gboolean bd_lvm_lvresize (gchar *vg_name,gchar *lv_name,guint64 size,GError **error);
gboolean bd_lvm_lvactivate (gchar *vg_name,gchar *lv_name,gboolean ignore_skip,GError **error);
gboolean bd_lvm_lvdeactivate (gchar *vg_name,gchar *lv_name,GError **error);
gboolean bd_lvm_lvsnapshotcreate (gchar *vg_name,gchar *origin_name,gchar *snapshot_name,guint64 size,GError **error);
gboolean bd_lvm_lvsnapshotmerge (gchar *vg_name,gchar *snapshot_name,GError **error);
BDLVMLVdata * bd_lvm_lvinfo (gchar *vg_name,gchar *lv_name,GError **error);
vg_name |
name of the VG that contains the LV to get information about |
|
lv_name |
name of the LV to get information about |
|
error |
place to store error (if any). |
[out] |
information about the vg_name
/lv_name
LV or NULL in case
of error (the error
) gets populated in those cases).
[transfer full]
BDLVMLVdata ** bd_lvm_lvs (gchar *vg_name,GError **error);
vg_name |
name of the VG to get information about LVs from. |
[allow-none] |
error |
place to store error (if any). |
[out] |
information about LVs found in the given
vg_name
VG or in system if vg_name
is NULL.
[array zero-terminated=1]
gboolean bd_lvm_thpoolcreate (gchar *vg_name,gchar *lv_name,guint64 size,guint64 md_size,guint64 chunk_size,gchar *profile,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] |
error |
place to store error (if any). |
[out] |
gboolean bd_lvm_thlvcreate (gchar *vg_name,gchar *pool_name,gchar *lv_name,guint64 size,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 |
|
error |
place to store error (if any). |
[out] |
gchar * bd_lvm_thlvpoolname (gchar *vg_name,gchar *lv_name,GError **error);
vg_name |
name of the VG containing the queried thin LV |
|
lv_name |
name of the queried thin LV |
|
error |
place to store error (if any). |
[out] |
the name of the pool volume for the vg_name
/lv_name
thin LV or NULL if failed to determine (error
) is set in those cases).
[transfer full]
gboolean bd_lvm_thsnapshotcreate (gchar *vg_name,gchar *origin_name,gchar *snapshot_name,gchar *pool_name,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] |
error |
place to store error (if any). |
[out] |
gboolean bd_lvm_set_global_config (gchar *new_config,GError **error);
new_config |
string representation of the new global LVM
configuration to set or |
[allow-none] |
error |
place to store error (if any). |
[out] |
typedef struct {
gchar *pv_name;
gchar *pv_uuid;
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;
typedef struct {
gchar *name;
gchar *uuid;
guint64 size;
guint64 free;
guint64 extent_size;
guint64 extent_count;
guint64 free_count;
guint64 pv_count;
} BDLVMVGdata;