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

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

#include <LvmLv.h>

Inheritance diagram for storage::LvmLv:
[legend]
Collaboration diagram for storage::LvmLv:
[legend]

Public Member Functions

const std::string & get_lv_name () const
 Get logical volume name. More...
 
void set_lv_name (const std::string &lv_name)
 
LvType get_lv_type () const
 
unsigned int get_stripes () const
 
void set_stripes (unsigned int stripes)
 Set the number of stripes. More...
 
unsigned long long get_stripe_size () const
 
void set_stripe_size (unsigned long long stripe_size)
 
unsigned long long get_chunk_size () const
 
void set_chunk_size (unsigned long long chunk_size)
 Set the chunk size. More...
 
const LvmVgget_lvm_vg () const
 Return volume group this logical volume belongs to. More...
 
const LvmLvget_thin_pool () const
 Return the thin pool for a thin logical volume. More...
 
unsigned long long max_size_for_lvm_lv (LvType lv_type) const
 Return the max size in bytes for a new logical volume of type lv_type. More...
 
LvmLvcreate_lvm_lv (const std::string &lv_name, LvType lv_type, unsigned long long size)
 Create a logical volume with name lv_name and type lv_type in the thin pool. More...
 
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 LvmLvclone () const override
 
- Public Member Functions inherited from storage::BlkDevice
const std::string & get_name () const
 
void set_name (const std::string &name)
 
const Regionget_region () const
 
void set_region (const Region &region)
 
unsigned long long get_size () const
 
void set_size (unsigned long long size)
 
std::string get_size_string () const
 
bool is_active () const
 
const std::string & get_sysfs_name () const
 
const std::string & get_sysfs_path () const
 
const std::vector< std::string > & get_udev_paths () const
 
const std::vector< std::string > & get_udev_ids () const
 
bool is_usable_as_blk_device () const
 Checks whether the blk device is in general usable as a blk device. More...
 
const std::string & get_dm_table_name () const
 Return device-mapper table name (dm-table-name for short). More...
 
void set_dm_table_name (const std::string &dm_table_name)
 
BlkFilesystemcreate_blk_filesystem (FsType fs_type)
 Creates a block filesystem on the block device. More...
 
bool has_blk_filesystem () const
 
BlkFilesystemget_blk_filesystem ()
 
const BlkFilesystemget_blk_filesystem () const
 
BlkFilesystemcreate_filesystem (FsType fs_type) ST_DEPRECATED
 Creates a block filesystem on the block device. More...
 
bool has_filesystem () const ST_DEPRECATED
 
BlkFilesystemget_filesystem () ST_DEPRECATED
 
const BlkFilesystemget_filesystem () const ST_DEPRECATED
 
Encryptioncreate_encryption (const std::string &dm_name)
 Creates an encryption device on the blk device. More...
 
void remove_encryption ()
 Removes an encryption device on the blk device. More...
 
bool has_encryption () const
 
Encryptionget_encryption ()
 
const Encryptionget_encryption () const
 
Impl & get_impl ()
 
const Impl & get_impl () const
 
- Public Member Functions inherited from storage::Device
sid_t get_sid () const
 
bool operator== (const Device &rhs) const
 
bool operator!= (const Device &rhs) const
 
Devicecopy_to_devicegraph (Devicegraph *devicegraph) const
 Copies the device to the devicegraph. More...
 
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.
 
bool exists_in_system () const
 Checks if the device exists in the system devicegraph.
 
std::string get_displayname () const
 
ResizeInfo detect_resize_info () const
 Detect the resize info of the device. More...
 
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)
 
Devicegraphget_devicegraph ()
 
const Devicegraphget_devicegraph () const
 
Impl & get_impl ()
 
const Impl & get_impl () const
 
void save (xmlNode *node) const
 

Static Public Member Functions

static LvmLvcreate (Devicegraph *devicegraph, const std::string &vg_name, const std::string &lv_name, LvType lv_type)
 
static LvmLvload (Devicegraph *devicegraph, const xmlNode *node)
 
static std::vector< LvmLv * > get_all (Devicegraph *devicegraph)
 Get all LvmLvs.
 
static std::vector< const LvmLv * > get_all (const Devicegraph *devicegraph)
 Get all LvmLvs. More...
 
static bool compare_by_lv_name (const LvmLv *lhs, const LvmLv *rhs)
 Compare (less than) two LvmLvs by lv-name.
 
- Static Public Member Functions inherited from storage::BlkDevice
static std::vector< BlkDevice * > get_all (Devicegraph *devicegraph)
 Get all BlkDevices.
 
static std::vector< const BlkDevice * > get_all (const Devicegraph *devicegraph)
 Get all BlkDevices. More...
 
static BlkDevicefind_by_name (Devicegraph *devicegraph, const std::string &name)
 Find a block device by its name. More...
 
static const BlkDevicefind_by_name (const Devicegraph *devicegraph, const std::string &name)
 Find a block device by its name. More...
 
static BlkDevicefind_by_any_name (Devicegraph *devicegraph, const std::string &name)
 Find a block device by any name including any symbolic links in /dev. More...
 
static const BlkDevicefind_by_any_name (const Devicegraph *devicegraph, const std::string &name)
 Find a block device by any name including any symbolic links in /dev. More...
 
static bool compare_by_dm_table_name (const BlkDevice *lhs, const BlkDevice *rhs)
 Compare (less than) two BlkDevices by DM table name.
 
- Static Public Member Functions inherited from storage::Device
static std::vector< Device * > get_all (Devicegraph *devicegraph)
 
static std::vector< const Device * > get_all (const Devicegraph *devicegraph)
 
static bool compare_by_sid (const Device *lhs, const Device *rhs)
 Compare (less than) two Devices by sid.
 
static bool compare_by_name (const Device *lhs, const Device *rhs)
 Compare (less than) two Devices by name. More...
 

Protected Member Functions

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

Detailed Description

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

Member Function Documentation

◆ create_lvm_lv()

LvmLv* storage::LvmLv::create_lvm_lv ( const std::string &  lv_name,
LvType  lv_type,
unsigned long long  size 
)

Create a logical volume with name lv_name and type lv_type in the thin pool.

Only supported lv_type is THIN.

Exceptions
Exception

◆ get_all()

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

Get all LvmLvs.

◆ get_lv_name()

const std::string& storage::LvmLv::get_lv_name ( ) const

Get logical volume name.

This is different from get_name().

◆ get_lvm_lv()

LvmLv* storage::LvmLv::get_lvm_lv ( const std::string &  lv_name)
Exceptions
Exception

◆ get_lvm_vg()

const LvmVg* storage::LvmLv::get_lvm_vg ( ) const

Return volume group this logical volume belongs to.

Exceptions
Exception

◆ get_thin_pool()

const LvmLv* storage::LvmLv::get_thin_pool ( ) const

Return the thin pool for a thin logical volume.

Exceptions
Exception

◆ max_size_for_lvm_lv()

unsigned long long storage::LvmLv::max_size_for_lvm_lv ( LvType  lv_type) const

Return the max size in bytes for a new logical volume of type lv_type.

The size may be limited by other parameters, e.g. the filesystem on it.

The max size for thin logical volumes is in general theoretic since a thin pool logical volume should never be overcommited so much.

◆ set_chunk_size()

void storage::LvmLv::set_chunk_size ( unsigned long long  chunk_size)

Set the chunk size.

Only thin pools can have a chunk size.

Exceptions
Exception

◆ set_stripe_size()

void storage::LvmLv::set_stripe_size ( unsigned long long  stripe_size)
Exceptions
Exception

◆ set_stripes()

void storage::LvmLv::set_stripes ( unsigned int  stripes)

Set the number of stripes.

The size of the LV must be a multiple of the number of stripes and the stripe size. Thin LV cannot be striped.

Exceptions
Exception

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