libstorage-ng
Public Member Functions | Friends | List of all members
storage::Devicegraph Class Reference

The master container of the libstorage. More...

#include <Devicegraph.h>

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

Public Member Functions

 Devicegraph (Storage *storage)
 
bool operator== (const Devicegraph &rhs) const
 
bool operator!= (const Devicegraph &rhs) const
 
Storageget_storage ()
 
const Storageget_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
 
Devicefind_device (sid_t sid)
 
const Devicefind_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)
 
Holderfind_holder (sid_t source_sid, sid_t target_sid)
 
const Holderfind_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)
 

Detailed Description

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.

Whenever possible use the high-level functions.

Member Function Documentation

◆ check()

void storage::Devicegraph::check ( const CheckCallbacks check_callbacks = nullptr) const

Checks the devicegraph.

See also Storage::check().

Exceptions
Exception

◆ find_device() [1/2]

Device* storage::Devicegraph::find_device ( sid_t  sid)
Exceptions
DeviceNotFoundBySid

◆ find_device() [2/2]

const Device* storage::Devicegraph::find_device ( sid_t  sid) const
Exceptions
DeviceNotFoundBySid

◆ find_holder() [1/2]

Holder* storage::Devicegraph::find_holder ( sid_t  source_sid,
sid_t  target_sid 
)

◆ find_holder() [2/2]

const Holder* storage::Devicegraph::find_holder ( sid_t  source_sid,
sid_t  target_sid 
) const

◆ load()

void storage::Devicegraph::load ( const std::string &  filename)
Exceptions
Exception

◆ remove_device()

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().

Exceptions
DeviceNotFoundBySidTODO internally redirect to special delete functions?

◆ save()

void storage::Devicegraph::save ( const std::string &  filename) const
Exceptions
Exception

◆ write_graphviz()

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).

Exceptions
Exception

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