24 #ifndef STORAGE_STORAGE_H
25 #define STORAGE_STORAGE_H
32 #include <boost/noncopyable.hpp>
34 #include "storage/Filesystems/Mountable.h"
35 #include "storage/CommitOptions.h"
36 #include "storage/Utils/Callbacks.h"
103 virtual bool multipath(
bool looks_like_real_multipath)
const = 0;
117 virtual std::pair<bool, std::string>
luks(
const std::string& uuid,
int attempt)
const = 0;
133 const std::string& get_device_name()
const;
135 const std::string& get_uuid()
const;
137 const std::string& get_label()
const;
143 Impl& get_impl() {
return *impl; }
144 const Impl& get_impl()
const {
return *impl; }
148 const std::unique_ptr<Impl> impl;
167 virtual std::pair<bool, std::string>
luks(
const LuksInfo& info,
int attempt)
const = 0;
216 const std::string& command, uint64_t used_features)
const = 0;
235 virtual void end()
const {}
246 virtual void error(
const std::string& message)
const = 0;
277 const Arch& get_arch()
const;
303 bool equal_devicegraph(
const std::string& lhs,
const std::string& rhs)
const;
398 const std::
string& get_rootprefix() const;
399 void set_rootprefix(const std::
string& rootprefix);
529 Impl& get_impl() {
return *impl; }
530 const Impl& get_impl()
const {
return *impl; }
534 const std::unique_ptr<Impl> impl;
std::vector< std::string > get_pool_names() const ST_DEPRECATED
Get the names of all pools.
Definition: Storage.h:222
void remove_devicegraph(const std::string &name)
Remove a devicegraph by name.
Devicegraph * get_devicegraph(const std::string &name)
Return a devicegraph by name.
Other storage subsystems are activated automatically, e.g.
Definition: Storage.h:93
void probe(const ProbeCallbacks *probe_callbacks=nullptr)
Probe the system and replace the probed, system and staging devicegraphs.
virtual void end() const
Called at the end of probing.
Definition: Storage.h:235
Storage(const Environment &environment)
Construct Storage object.
void set_default_mount_by(MountByType default_mount_by)
Set the default mount-by method.
std::map< std::string, const Pool * > get_pools() const
Get all pools with their names.
Devicegraph * copy_devicegraph(const std::string &source_name, const std::string &dest_name)
void generate_pools(const Devicegraph *devicegraph)
Generate pools, e.g.
Devicegraph * create_devicegraph(const std::string &name)
Create a devicegraph with name.
Pool * get_pool(const std::string &name)
Return a pool by name.
const Actiongraph * calculate_actiongraph()
The actiongraph is only valid until either the probed or staging devicegraph is modified.
Definition: Storage.h:252
The main entry point to libstorage.
Definition: Storage.h:262
The storage namespace.
Definition: Actiongraph.h:39
Provides information whether deactivate() was able to deactivate subsystems.
Definition: Storage.h:178
virtual std::pair< bool, std::string > luks(const std::string &uuid, int attempt) const =0
Decide whether the LUKS with uuid should be activated.
void activate(const ActivateCallbacks *activate_callbacks) const
Activate devices like multipath, DM and MD RAID, LVM and LUKS.
const Devicegraph * get_probed() const
Return the probed devicegraph.
virtual bool missing_command(const std::string &message, const std::string &what, const std::string &command, uint64_t used_features) const =0
Callback for missing commands.
Definition: Environment.h:53
Definition: Storage.h:198
bool exists_pool(const std::string &name) const
Check whether a pool exists by name.
DeactivateStatus deactivate() const
Deactivate devices like multipath, DM and MD RAID, LVM and LUKS.
The main container of the libstorage-ng.
Definition: Devicegraph.h:170
The actiongraph has all actions including the dependencies among them to get from one devicegraph to ...
Definition: Actiongraph.h:61
void restore_devicegraph(const std::string &name)
bool exist_devicegraph(const std::string &name) const
Check whether a devicegraph exists by name.
Definition: Storage.h:241
MountByType get_default_mount_by() const
Query the default mount-by method.
A pool represents a collection of devices.
Definition: Pool.h:81
Specialized callbacks with a more generic parameter for LUKS activation.
Definition: Storage.h:157
std::map< std::string, const Devicegraph * > get_devicegraphs() const
Get all devicegraphs with their names.
Devicegraph * get_staging()
Return the staging devicegraph.
std::string prepend_rootprefix(const std::string &mount_point) const
Prepends the root prefix to a mount point if necessary.
MountByType
The key by which the mount program identifies a mountable.
Definition: Mountable.h:60
virtual void begin() const
Called at the begin of probing.
Definition: Storage.h:230
void remove_pool(const std::string &name)
Remove a pool by name.
Stores information about a LUKS device.
Definition: Storage.h:126
Definition: Storage.h:189
Pool * create_pool(const std::string &name)
Create a pool with name.
std::vector< std::string > get_devicegraph_names() const ST_DEPRECATED
Get the names of all devicegraphs.
Devicegraph * get_system()
Return the system devicegraph.
virtual bool multipath(bool looks_like_real_multipath) const =0
Decide whether multipath should be activated.
virtual std::pair< bool, std::string > luks(const LuksInfo &info, int attempt) const =0
Decide whether the LUKS should be activated.
void commit(const CommitOptions &commit_options, const CommitCallbacks *commit_callbacks=nullptr)
The actiongraph must be valid.
void check(const CheckCallbacks *check_callbacks=nullptr) const
Checks all devicegraphs.