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

The main entry point to libstorage. More...

#include <Storage.h>

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

Public Member Functions

 Storage (const Environment &environment)
 Construct Storage object. More...
 
const Environmentget_environment () const
 
const Arch & get_arch () const
 
Devicegraphcreate_devicegraph (const std::string &name)
 
Devicegraphcopy_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
 
Devicegraphget_devicegraph (const std::string &name)
 Return a devicegraph by name. More...
 
const Devicegraphget_devicegraph (const std::string &name) const
 Return a devicegraph by name. More...
 
Devicegraphget_staging ()
 Return the staging devicegraph. More...
 
const Devicegraphget_staging () const
 Return the staging devicegraph. More...
 
const Devicegraphget_probed () const
 Return the probed devicegraph. More...
 
Devicegraphget_system ()
 Return the system devicegraph. More...
 
const Devicegraphget_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 Actiongraphcalculate_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
 

Detailed Description

The main entry point to libstorage.

Constructor & Destructor Documentation

◆ Storage()

storage::Storage::Storage ( const Environment environment)

Construct Storage object.

Does not call activate() nor probe().

Exceptions
LockException,Exception

Member Function Documentation

◆ activate()

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.

Exceptions
Aborted,Exception

◆ calculate_actiongraph()

const Actiongraph* storage::Storage::calculate_actiongraph ( )

The actiongraph is only valid until either the probed or staging devicegraph is modified.

Exceptions
Exception

◆ check()

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.

Exceptions
Exception

◆ commit() [1/2]

void storage::Storage::commit ( const CommitOptions &  commit_options,
const CommitCallbacks commit_callbacks = nullptr 
)

The actiongraph must be valid.

If an error reported via commit_callbacks is not ignored the function throws Aborted.

Exceptions
Aborted,Exception

◆ commit() [2/2]

void storage::Storage::commit ( const CommitCallbacks commit_callbacks = nullptr)

The actiongraph must be valid.

If an error reported via commit_callbacks is not ignored the function throws Aborted.

Exceptions
Aborted,Exception

◆ copy_devicegraph()

Devicegraph* storage::Storage::copy_devicegraph ( const std::string &  source_name,
const std::string &  dest_name 
)
Exceptions
Exception

◆ create_devicegraph()

Devicegraph* storage::Storage::create_devicegraph ( const std::string &  name)
Exceptions
Exception

◆ deactivate()

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.

Exceptions
Exception

◆ get_devicegraph() [1/2]

Devicegraph* storage::Storage::get_devicegraph ( const std::string &  name)

Return a devicegraph by name.

Exceptions
Exception

◆ get_devicegraph() [2/2]

const Devicegraph* storage::Storage::get_devicegraph ( const std::string &  name) const

Return a devicegraph by name.

Exceptions
Exception

◆ get_probed()

const Devicegraph* storage::Storage::get_probed ( ) const

Return the probed devicegraph.

Exceptions
Exception

◆ get_staging() [1/2]

Devicegraph* storage::Storage::get_staging ( )

Return the staging devicegraph.

Exceptions
Exception

◆ get_staging() [2/2]

const Devicegraph* storage::Storage::get_staging ( ) const

Return the staging devicegraph.

Exceptions
Exception

◆ get_system() [1/2]

Devicegraph* storage::Storage::get_system ( )

Return the system devicegraph.

Exceptions
Exception

◆ get_system() [2/2]

const Devicegraph* storage::Storage::get_system ( ) const

Return the system devicegraph.

Exceptions
Exception

◆ probe()

void storage::Storage::probe ( const ProbeCallbacks probe_callbacks = nullptr)

Probe the system and replace the probed, system and staging devicegraphs.

If an error reported via probe_callbacks is not ignored the function throws Aborted.

Exceptions
Aborted,Exception

◆ remove_devicegraph()

void storage::Storage::remove_devicegraph ( const std::string &  name)
Exceptions
Exception

◆ restore_devicegraph()

void storage::Storage::restore_devicegraph ( const std::string &  name)
Exceptions
Exception

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