libstorage-ng
|
The master container of the libstorage. More...
#include <Devicegraph.h>
Public Member Functions | |
Devicegraph (Storage *storage) | |
bool | operator== (const Devicegraph &rhs) const |
bool | operator!= (const Devicegraph &rhs) const |
Storage * | get_storage () |
const Storage * | get_storage () const |
void | load (const std::string &filename) |
void | save (const std::string &filename) const |
bool | empty () const |
size_t | num_devices () const |
size_t | num_holders () const |
Device * | find_device (sid_t sid) |
const Device * | find_device (sid_t sid) const |
bool | device_exists (sid_t sid) const |
Check whether the device with sid exists. | |
bool | holder_exists (sid_t source_sid, sid_t target_sid) const |
Check whether the holder with source sid and target sid exists. | |
void | clear () |
std::vector< Disk * > | get_all_disks () |
std::vector< const Disk * > | get_all_disks () const |
std::vector< Md * > | get_all_mds () |
std::vector< const Md * > | get_all_mds () const |
std::vector< LvmVg * > | get_all_lvm_vgs () |
std::vector< const LvmVg * > | get_all_lvm_vgs () const |
std::vector< Filesystem * > | get_all_filesystems () |
std::vector< const Filesystem * > | get_all_filesystems () const |
std::vector< BlkFilesystem * > | get_all_blk_filesystems () |
std::vector< const BlkFilesystem * > | get_all_blk_filesystems () const |
void | remove_device (sid_t sid) |
Removes the device with sid from the devicegraph. More... | |
void | remove_device (Device *a) |
void | remove_devices (std::vector< Device *> devices) |
Holder * | find_holder (sid_t source_sid, sid_t target_sid) |
const Holder * | find_holder (sid_t source_sid, sid_t target_sid) const |
void | remove_holder (Holder *holder) |
void | check (const CheckCallbacks *check_callbacks=nullptr) const |
Checks the devicegraph. More... | |
uint64_t | used_features () const |
Calculates a bit-field with the used features of the devicegraph. | |
void | copy (Devicegraph &dest) const |
void | write_graphviz (const std::string &filename, GraphvizFlags flags=GraphvizFlags::NAME, GraphvizFlags tooltip_flags=GraphvizFlags::NONE) const |
Writes the devicegraph in graphviz format. More... | |
Impl & | get_impl () |
const Impl & | get_impl () const |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Devicegraph &devicegraph) |
The master container of the libstorage.
There are two levels of functions to manipulate the device graph. As an example we show how to create a partition table containing one partition on the disk sda.
These functions will not only create the Gpt and Partition object but also the holders in the device graph.
As you can see with the low-level functions you have to create the holders yourself.
Whenever possible use the high-level functions.
void storage::Devicegraph::check | ( | const CheckCallbacks * | check_callbacks = nullptr | ) | const |
DeviceNotFoundBySid |
DeviceNotFoundBySid |
HolderNotFoundBySids |
HolderNotFoundBySids |
void storage::Devicegraph::load | ( | const std::string & | filename | ) |
Exception |
void storage::Devicegraph::remove_device | ( | sid_t | sid | ) |
Removes the device with sid from the devicegraph.
Only use this function if there is no special function to delete a device, e.g. PartitionTable.delete_partition() or LvmVg.delete_lvm_lv().
DeviceNotFoundBySid | TODO internally redirect to special delete functions? |
void storage::Devicegraph::save | ( | const std::string & | filename | ) | const |
Exception |
void storage::Devicegraph::write_graphviz | ( | const std::string & | filename, |
GraphvizFlags | flags = GraphvizFlags::NAME , |
||
GraphvizFlags | tooltip_flags = GraphvizFlags::NONE |
||
) | const |
Writes the devicegraph in graphviz format.
The node id is the sid (storage id).
Exception |