libstorage-ng
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
storage::LvmVg Class Reference

A Volume Group of the Logical Volume Manager (LVM). More...

#include <LvmVg.h>

Inheritance diagram for storage::LvmVg:
Inheritance graph
[legend]
Collaboration diagram for storage::LvmVg:
Collaboration graph
[legend]

Public Member Functions

const std::string & get_vg_name () const
 Get volume group name. More...
 
void set_vg_name (const std::string &vg_name)
 
const Regionget_region () const
 
unsigned long long get_size () const
 
std::string get_size_string () const
 
unsigned long long get_extent_size () const
 Returns the extent size of the volume group. More...
 
void set_extent_size (unsigned long long extent_size)
 Set the extent size of the volume group. More...
 
unsigned long long number_of_extents () const
 Calculates the number of extents in the volume group.
 
unsigned long long number_of_used_extents () const
 Calculates the number of used extents in the volume group. More...
 
unsigned long long number_of_free_extents () const
 Calculates the number of free extents in the volume group.
 
LvmPvadd_lvm_pv (BlkDevice *blk_device)
 Adds a block device as a physical volume to the volume group. More...
 
void remove_lvm_pv (BlkDevice *blk_device)
 Removes a block device from the volume group. More...
 
LvmLvcreate_lvm_lv (const std::string &lv_name, unsigned long long size)
 Create a logical volume with name lv_name in the volume group.
 
void delete_lvm_lv (LvmLv *lvm_lv)
 Delete a logical volume in the volume group. More...
 
std::vector< LvmPv * > get_lvm_pvs ()
 
std::vector< const LvmPv * > get_lvm_pvs () const
 
LvmLvget_lvm_lv (const std::string &lv_name)
 
std::vector< LvmLv * > get_lvm_lvs ()
 
std::vector< const LvmLv * > get_lvm_lvs () const
 
Impl & get_impl ()
 
const Impl & get_impl () const
 
virtual LvmVgclone () const override
 
- Public Member Functions inherited from storage::Device
sid_t get_sid () const
 
bool operator== (const Device &rhs) const
 
bool operator!= (const Device &rhs) const
 
bool exists_in_devicegraph (const Devicegraph *devicegraph) const
 Checks if the device exists in the devicegraph.
 
bool exists_in_probed () const
 Checks if the device exists in the probed devicegraph.
 
bool exists_in_staging () const
 Checks if the device exists in the staging devicegraph.
 
std::string get_displayname () const
 
virtual ResizeInfo detect_resize_info () const
 
bool has_children () const
 
size_t num_children () const
 
bool has_parents () const
 
size_t num_parents () const
 
std::vector< Device * > get_children ()
 
std::vector< const Device * > get_children () const
 
std::vector< Device * > get_parents ()
 
std::vector< const Device * > get_parents () const
 
std::vector< Device * > get_siblings (bool itself)
 
std::vector< const Device * > get_siblings (bool itself) const
 
std::vector< Device * > get_descendants (bool itself)
 
std::vector< const Device * > get_descendants (bool itself) const
 
std::vector< Device * > get_ancestors (bool itself)
 
std::vector< const Device * > get_ancestors (bool itself) const
 
std::vector< Device * > get_leaves (bool itself)
 
std::vector< const Device * > get_leaves (bool itself) const
 
std::vector< Device * > get_roots (bool itself)
 
std::vector< const Device * > get_roots (bool itself) const
 
std::vector< Holder * > get_in_holders ()
 
std::vector< const Holder * > get_in_holders () const
 
std::vector< Holder * > get_out_holders ()
 
std::vector< const Holder * > get_out_holders () const
 
void remove_descendants ()
 
const std::map< std::string, std::string > & get_userdata () const
 
void set_userdata (const std::map< std::string, std::string > &userdata)
 
Impl & get_impl ()
 
const Impl & get_impl () const
 
void save (xmlNode *node) const
 

Static Public Member Functions

static LvmVgcreate (Devicegraph *devicegraph, const std::string &vg_name)
 
static LvmVgload (Devicegraph *devicegraph, const xmlNode *node)
 
static std::vector< LvmVg * > get_all (Devicegraph *devicegraph)
 Sorted by vg_name.
 
static std::vector< const LvmVg * > get_all (const Devicegraph *devicegraph)
 Sorted by vg_name. More...
 
static LvmVgfind_by_vg_name (Devicegraph *devicegraph, const std::string &vg_name)
 Find a volume group by vg-name.
 
static const LvmVgfind_by_vg_name (const Devicegraph *devicegraph, const std::string &vg_name)
 Find a volume group by vg-name. More...
 

Protected Member Functions

 LvmVg (Impl *impl)
 
- Protected Member Functions inherited from storage::Device
 Device (Impl *impl)
 
void create (Devicegraph *devicegraph)
 
void load (Devicegraph *devicegraph)
 

Detailed Description

A Volume Group of the Logical Volume Manager (LVM).

Member Function Documentation

§ add_lvm_pv()

LvmPv* storage::LvmVg::add_lvm_pv ( BlkDevice blk_device)

Adds a block device as a physical volume to the volume group.

If there is not a physical volume on the block device it will be created.

§ delete_lvm_lv()

void storage::LvmVg::delete_lvm_lv ( LvmLv lvm_lv)

Delete a logical volume in the volume group.

Also deletes all descendants of the logical volume.

§ find_by_vg_name()

static const LvmVg* storage::LvmVg::find_by_vg_name ( const Devicegraph devicegraph,
const std::string &  vg_name 
)
static

Find a volume group by vg-name.

§ get_all()

static std::vector<const LvmVg*> storage::LvmVg::get_all ( const Devicegraph devicegraph)
static

Sorted by vg_name.

§ get_extent_size()

unsigned long long storage::LvmVg::get_extent_size ( ) const

Returns the extent size of the volume group.

Returns
extent size

§ get_vg_name()

const std::string& storage::LvmVg::get_vg_name ( ) const

Get volume group name.

This is different from get_name().

§ number_of_used_extents()

unsigned long long storage::LvmVg::number_of_used_extents ( ) const

Calculates the number of used extents in the volume group.

May be larger than the number of extents in the volume group.

§ remove_lvm_pv()

void storage::LvmVg::remove_lvm_pv ( BlkDevice blk_device)

Removes a block device from the volume group.

The physical volume on the block device will the deleted.

§ set_extent_size()

void storage::LvmVg::set_extent_size ( unsigned long long  extent_size)

Set the extent size of the volume group.

This can modify the size of the logical volumes.

Exceptions
InvalidExtentSize

The documentation for this class was generated from the following file: