libstorage-ng
|
The main entry point to libstorage. More...
#include <Storage.h>
Public Member Functions | |
Storage (const Environment &environment) | |
Construct Storage object. More... | |
const Environment & | get_environment () const |
const Arch & | get_arch () const |
Devicegraph * | create_devicegraph (const std::string &name) |
Devicegraph * | copy_devicegraph (const std::string &source_name, const std::string &dest_name) |
void | remove_devicegraph (const std::string &name) |
void | restore_devicegraph (const std::string &name) |
bool | equal_devicegraph (const std::string &lhs, const std::string &rhs) const |
bool | exist_devicegraph (const std::string &name) const |
std::vector< std::string > | get_devicegraph_names () const |
Devicegraph * | get_devicegraph (const std::string &name) |
Return a devicegraph by name. More... | |
const Devicegraph * | get_devicegraph (const std::string &name) const |
Return a devicegraph by name. More... | |
Devicegraph * | get_staging () |
Return the staging devicegraph. More... | |
const Devicegraph * | get_staging () const |
Return the staging devicegraph. More... | |
const Devicegraph * | get_probed () const |
Return the probed devicegraph. More... | |
Devicegraph * | get_system () |
Return the system devicegraph. More... | |
const Devicegraph * | get_system () const |
Return the system devicegraph. More... | |
void | check (const CheckCallbacks *check_callbacks=nullptr) const |
Checks all devicegraphs. More... | |
MountByType | get_default_mount_by () const |
Query the default mount-by method. | |
void | set_default_mount_by (MountByType default_mount_by) |
Set the default mount-by method. | |
const std::string & | get_rootprefix () const |
void | set_rootprefix (const std::string &rootprefix) |
std::string | prepend_rootprefix (const std::string &mount_point) const |
Prepends the root prefix to a mount point if necessary. | |
const Actiongraph * | calculate_actiongraph () |
The actiongraph is only valid until either the probed or staging devicegraph is modified. More... | |
void | activate (const ActivateCallbacks *activate_callbacks) const |
Activate devices like multipath, DM and MD RAID, LVM and LUKS. More... | |
DeactivateStatus | deactivate () const |
Deactivate devices like multipath, DM and MD RAID, LVM and LUKS. More... | |
void | probe (const ProbeCallbacks *probe_callbacks=nullptr) |
Probe the system and replace the probed, system and staging devicegraphs. More... | |
void | commit (const CommitOptions &commit_options, const CommitCallbacks *commit_callbacks=nullptr) |
The actiongraph must be valid. More... | |
void | commit (const CommitCallbacks *commit_callbacks=nullptr) ST_DEPRECATED |
The actiongraph must be valid. More... | |
Impl & | get_impl () |
const Impl & | get_impl () const |
The main entry point to libstorage.
storage::Storage::Storage | ( | const Environment & | environment | ) |
void storage::Storage::activate | ( | const ActivateCallbacks * | activate_callbacks | ) | const |
Activate devices like multipath, DM and MD RAID, LVM and LUKS.
It is not required to have probed the system to call this function. On the other hand after calling activate() the system should be probed.
The message callback is unreliable since certain subsystems can be activated automatically (e.g. MD RAIDs by udev).
If an error reported via activate_callbacks is not ignored the function throws Aborted.
This function is only intended for the installation system.
const Actiongraph* storage::Storage::calculate_actiongraph | ( | ) |
The actiongraph is only valid until either the probed or staging devicegraph is modified.
Exception |
void storage::Storage::check | ( | const CheckCallbacks * | check_callbacks = nullptr | ) | const |
Checks all devicegraphs.
There are two types of errors that can be found:
Errors that indicate a problem inside the library or a severe misuse of the library, e.g. attaching a BlkFilesystem directly to a PartitionTable. For these errors an exception is thrown.
Errors that can be easily fixed by the user, e.g. an overcommitted volume group. For these errors CheckCallbacks::error() is called.
The checks are WIP.
Exception |
void storage::Storage::commit | ( | const CommitOptions & | commit_options, |
const CommitCallbacks * | commit_callbacks = nullptr |
||
) |
void storage::Storage::commit | ( | const CommitCallbacks * | commit_callbacks = nullptr | ) |
Devicegraph* storage::Storage::copy_devicegraph | ( | const std::string & | source_name, |
const std::string & | dest_name | ||
) |
Exception |
Devicegraph* storage::Storage::create_devicegraph | ( | const std::string & | name | ) |
Exception |
DeactivateStatus storage::Storage::deactivate | ( | ) | const |
Deactivate devices like multipath, DM and MD RAID, LVM and LUKS.
It is not required to have probed the system to call this function. On the other hand after calling this function activate() should be called and the system should be probed.
The purpose of this function is to reverse the actions of activate() and auto-assemble.
This function is only intended for the installation system.
Exception |
Devicegraph* storage::Storage::get_devicegraph | ( | const std::string & | name | ) |
Return a devicegraph by name.
Exception |
const Devicegraph* storage::Storage::get_devicegraph | ( | const std::string & | name | ) | const |
Return a devicegraph by name.
Exception |
const Devicegraph* storage::Storage::get_probed | ( | ) | const |
Return the probed devicegraph.
Exception |
Devicegraph* storage::Storage::get_staging | ( | ) |
Return the staging devicegraph.
Exception |
const Devicegraph* storage::Storage::get_staging | ( | ) | const |
Return the staging devicegraph.
Exception |
Devicegraph* storage::Storage::get_system | ( | ) |
Return the system devicegraph.
Exception |
const Devicegraph* storage::Storage::get_system | ( | ) | const |
Return the system devicegraph.
Exception |
void storage::Storage::probe | ( | const ProbeCallbacks * | probe_callbacks = nullptr | ) |
void storage::Storage::remove_devicegraph | ( | const std::string & | name | ) |
Exception |
void storage::Storage::restore_devicegraph | ( | const std::string & | name | ) |
Exception |