23#ifndef STORAGE_LVM_VG_H
24#define STORAGE_LVM_VG_H
27#include "storage/Devices/Device.h"
28#include "storage/Devices/LvmLv.h"
29#include "storage/Devicegraph.h"
40 class LvmVgNotFoundByVgName :
public DeviceNotFound
44 LvmVgNotFoundByVgName(
const std::string& vg_name);
52 InvalidExtentSize(
unsigned long long extent_size) ST_DEPRECATED;
53 InvalidExtentSize(
const std::string&
msg);
60 class LvmVg :
public Device
71 static LvmVg* load(
Devicegraph* devicegraph,
const xmlNode* node);
185 unsigned long long size);
187 LvmLv*
create_lvm_lv(
const std::string& lv_name,
unsigned long long size) ST_DEPRECATED;
259 const Impl& get_impl()
const;
261 virtual LvmVg* clone()
const override;
An abstract Block Device.
Definition BlkDevice.h:49
An abstract base class for storage devices.
Definition Device.h:82
The main container of the libstorage-ng.
Definition Devicegraph.h:170
Exception(LogLevel log_level=LogLevel::ERROR)
Default constructor.
const std::string & msg() const
Return the message string provided to the constructor.
Definition Exception.h:150
A Logical Volume of the Logical Volume Manager (LVM).
Definition LvmLv.h:147
A Volume Group of the Logical Volume Manager (LVM).
Definition LvmVg.h:61
unsigned long long number_of_extents() const
Returns the number of extents in the volume group.
static const LvmVg * find_by_vg_name(const Devicegraph *devicegraph, const std::string &vg_name)
Find a volume group by vg-name.
std::string get_size_string() const
Returns the size of the volume group as a localised string.
void remove_lvm_pv(BlkDevice *blk_device)
Removes a block device from the volume group.
const std::string & get_vg_name() const
Get volume group name.
static std::vector< LvmVg * > get_all(Devicegraph *devicegraph)
Get all LvmVgs.
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 volume group.
std::vector< const LvmPv * > get_lvm_pvs() const
Get all physical volumes of the volume group.
bool is_overcommitted() const
Check whether the volume group is overcommitted.
unsigned long long get_extent_size() const
Returns the extent size of the volume group.
std::vector< LvmPv * > get_lvm_pvs()
Get all physical volumes of the volume group.
static bool compare_by_vg_name(const LvmVg *lhs, const LvmVg *rhs)
Compare (less than) two LvmVgs by vg-name.
unsigned long long number_of_used_extents() const
Calculates the number of used extents in the volume group.
std::vector< const LvmLv * > get_lvm_lvs() const
Get all logical volumes of the volume group that are direct children of the volume group.
LvmPv * add_lvm_pv(BlkDevice *blk_device)
Adds a block device as a physical volume to the volume group.
void set_extent_size(unsigned long long extent_size)
Set the extent size of the volume group.
static bool is_valid_vg_name(const std::string &vg_name)
Check whether a volume group name is valid.
static std::vector< const LvmVg * > get_all(const Devicegraph *devicegraph)
Get all LvmVgs.
std::vector< LvmLv * > get_lvm_lvs()
Get all logical volumes of the volume group that are direct children of the volume group.
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.
void delete_lvm_lv(LvmLv *lvm_lv)
Delete a logical volume in the volume group.
static LvmVg * find_by_vg_name(Devicegraph *devicegraph, const std::string &vg_name)
Find a volume group by vg-name.
unsigned long long get_size() const
Returns the size of the volume group in bytes.
void set_vg_name(const std::string &vg_name)
Set the volume group name.
static LvmVg * create(Devicegraph *devicegraph, const std::string &vg_name)
Create a device of type LvmVg.
LvmLv * get_lvm_lv(const std::string &lv_name)
const Region & get_region() const
Get the region of the volume group.
unsigned long long number_of_free_extents() const
Calculates the number of free extents in the volume group.
A start/length pair with a block size.
Definition Region.h:85
The storage namespace.
Definition Actiongraph.h:40
bool is_lvm_vg(const Device *device)
Checks whether device points to a LvmVg.
LvType
LVM logical volume types, see lvs(8).
Definition LvmLv.h:41
LvmVg * to_lvm_vg(Device *device)
Converts pointer to Device to pointer to LvmVg.