24#ifndef STORAGE_DEVICEGRAPH_H
25#define STORAGE_DEVICEGRAPH_H
28#include <boost/noncopyable.hpp>
30#include "storage/Devices/Device.h"
31#include "storage/Graphviz.h"
32#include "storage/Utils/Swig.h"
33#include "storage/UsedFeatures.h"
53 DeviceNotFound(
const std::string&
msg);
57 class DeviceNotFoundBySid :
public DeviceNotFound
61 DeviceNotFoundBySid(
sid_t sid);
65 class DeviceNotFoundByName :
public DeviceNotFound
69 DeviceNotFoundByName(
const std::string& name);
73 class DeviceNotFoundByUuid :
public DeviceNotFound
77 DeviceNotFoundByUuid(
const std::string& uuid);
81 class ST_DEPRECATED HolderNotFound:
public Exception
85 HolderNotFound(
const std::string&
msg);
89 class ST_DEPRECATED HolderNotFoundBySids :
public HolderNotFound
93 HolderNotFoundBySids(
sid_t source_sid,
sid_t target_sid);
101 HolderAlreadyExists(
sid_t source_sid,
sid_t target_sid);
109 WrongNumberOfParents(
size_t seen,
size_t expected);
117 WrongNumberOfChildren(
size_t seen,
size_t expected);
125 WrongNumberOfHolders(
size_t seen,
size_t expected);
169 class Devicegraph :
private boost::noncopyable
177 bool operator==(
const Devicegraph& rhs)
const;
178 bool operator!=(
const Devicegraph& rhs)
const;
198 void load(
const std::string& filename);
205 void load(
const std::string& filename,
bool keep_sids);
212 void save(
const std::string& filename)
const;
392 uint64_t used_features() const ST_DEPRECATED;
400 void copy(Devicegraph& dest) const;
428 friend std::ostream& operator<<(std::ostream& out, const Devicegraph& devicegraph);
434 Impl& get_impl() {
return *impl; }
435 const Impl& get_impl()
const {
return *impl; }
439 const std::unique_ptr<Impl> impl;
Definition BlkFilesystem.h:43
An abstract base class for storage devices.
Definition Device.h:82
Style callbacks used by Devicegraph::write_graphviz().
Definition Graphviz.h:105
void remove_device(sid_t sid)
Removes the device with sid from the devicegraph.
void remove_device(Device *a)
Removes the device from the devicegraph.
const Storage * get_storage() const
Get the storage object the devicegraph belongs to.
std::vector< BlkFilesystem * > get_all_blk_filesystems()
Get all BlkFilesystems.
bool device_exists(sid_t sid) const
Check whether the device with sid exists.
std::vector< const Disk * > get_all_disks() const
Get all Disks.
const Device * find_device(sid_t sid) const
bool empty() const
Query whether the devicegraph is empty.
Device * find_device(sid_t sid)
std::vector< Disk * > get_all_disks()
Get all Disks.
void clear()
Clear the devicegraph.
std::vector< Md * > get_all_mds()
Get all Mds.
void load(const std::string &filename)
Load the devicegraph from a file.
std::vector< const Md * > get_all_mds() const
Get all Mds.
void save(const std::string &filename) const
Save the devicegraph to a file.
std::vector< LvmVg * > get_all_lvm_vgs()
Get all LvmVgs.
std::vector< const Filesystem * > get_all_filesystems() const
Get all Filesystems.
std::vector< const BlkFilesystem * > get_all_blk_filesystems() const
Get all BlkFilesystems.
void load(const std::string &filename, bool keep_sids)
Load the devicegraph from a file.
Storage * get_storage()
Get the storage object the devicegraph belongs to.
void remove_devices(std::vector< Device * > devices)
Removes the devices from the devicegraph.
std::vector< const LvmVg * > get_all_lvm_vgs() const
Get all LvmVgs.
void write_graphviz(const std::string &filename, DevicegraphStyleCallbacks *style_callbacks, View view) const
Writes the devicegraph in graphviz format.
bool holder_exists(sid_t source_sid, sid_t target_sid) const
Check whether a holder with source_sid and target_sid exists.
size_t num_devices() const
Return the number of devices.
size_t num_holders() const
Return the number of holders.
std::vector< Filesystem * > get_all_filesystems()
Get all Filesystems.
std::vector< Holder * > find_holders(sid_t source_sid, sid_t target_sid)
Find all holders with source_sid and sid_t target_sid.
Holder * find_holder(sid_t source_sid, sid_t target_sid)
Find the holder with source_sid and target_sid.
const Holder * find_holder(sid_t source_sid, sid_t target_sid) const
Find the holder with source_sid and target_sid.
void check(const CheckCallbacks *check_callbacks=nullptr) const
Checks the devicegraph.
void remove_holder(Holder *holder)
Removes the holder from the devicegraph.
std::vector< const Holder * > find_holders(sid_t source_sid, sid_t target_sid) const
Find all holders with source_sid and sid_t target_sid.
A physical disk device.
Definition Disk.h:73
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
Definition Filesystem.h:41
An abstract base class for storage holders.
Definition Holder.h:57
A Volume Group of the Logical Volume Manager (LVM).
Definition LvmVg.h:61
A MD device.
Definition Md.h:79
The main entry point to libstorage.
Definition Storage.h:445
The storage namespace.
Definition Actiongraph.h:40
View
Enum with possible views on the devicegraph.
Definition View.h:34
unsigned int sid_t
Definition Device.h:67
UsedFeaturesDependencyType
Enum specifying the dependency type of used features.
Definition UsedFeatures.h:38
uint64_t uf_t
Type for used features.
Definition UsedFeatures.h:63
GraphvizFlags
Bitfield to control graphviz output.
Definition Graphviz.h:45