24#ifndef STORAGE_STORAGE_H
25#define STORAGE_STORAGE_H
33#include <boost/noncopyable.hpp>
35#include "storage/CommitOptions.h"
36#include "storage/Actions/Base.h"
37#include "storage/Utils/Callbacks.h"
38#include "storage/Utils/Swig.h"
108 virtual bool multipath(
bool looks_like_real_multipath)
const = 0;
121 virtual std::pair<bool, std::string>
luks(
const std::string& uuid,
int attempt)
const = 0;
136 const std::string& get_device_name()
const;
137 unsigned long long get_size()
const;
138 const std::string& get_dm_table_name()
const;
139 bool is_dm_table_name_generated()
const;
140 const std::string& get_uuid()
const;
141 const std::string& get_label()
const;
147 Impl& get_impl() {
return *impl; }
148 const Impl& get_impl()
const {
return *impl; }
152 const std::unique_ptr<Impl> impl;
171 virtual std::pair<bool, std::string>
luks(
const LuksInfo& luks_info,
int attempt)
const = 0;
186 const std::string& get_device_name()
const;
187 unsigned long long get_size()
const;
188 const std::string& get_dm_table_name()
const;
189 bool is_dm_table_name_generated()
const;
190 const std::string& get_uuid()
const;
196 Impl& get_impl() {
return *impl; }
197 const Impl& get_impl()
const {
return *impl; }
201 const std::unique_ptr<Impl> impl;
223 virtual void end()
const {}
260 bool multipath()
const;
261 bool dm_raid()
const;
265 bool bitlocker()
const;
271 Impl& get_impl() {
return *impl; }
272 const Impl& get_impl()
const {
return *impl; }
276 const std::unique_ptr<Impl> impl;
309 const std::string& command, uint64_t used_features)
const = 0;
328 virtual void end()
const {}
346 const std::string& name,
PtType pt_type,
347 FsType fs_type)
const = 0;
356 const std::string& name,
PtType pt_type)
const = 0;
365 const std::string& name,
PtType pt_type)
const = 0;
376 const std::string& name,
PtType pt_type)
const = 0;
387 const std::string& name, FsType fs_type)
const = 0;
398 virtual void error(
const std::string& message)
const = 0;
424 virtual void end()
const {}
458 const Arch& get_arch()
const;
484 bool equal_devicegraph(
const std::string& lhs,
const std::string& rhs)
const;
579 const std::
string& get_rootprefix() const;
580 void set_rootprefix(const std::
string& rootprefix) ST_DEPRECATED;
692 void rename_pool(const std::
string& old_name, const std::
string& new_name);
730 Impl& get_impl() {
return *impl; }
731 const Impl& get_impl()
const {
return *impl; }
735 const std::unique_ptr<Impl> impl;
The actiongraph has all actions including the dependencies among them to get from one devicegraph to ...
Definition: Actiongraph.h:62
Specialized callbacks with a more generic parameter for LUKS activation.
Definition: Storage.h:161
virtual std::pair< bool, std::string > luks(const LuksInfo &luks_info, int attempt) const =0
Decide whether the LUKS should be activated.
Specialized callbacks with a more generic parameter for Bitlocker activation.
Definition: Storage.h:210
virtual std::pair< bool, std::string > bitlocker(const BitlockerInfo &bitlocker_info, int attempt) const =0
Decide whether the BitLocker should be activated.
virtual void begin() const
Called at the begin of activation.
Definition: Storage.h:218
virtual void end() const
Called at the end of activation.
Definition: Storage.h:223
Other storage subsystems are activated automatically, e.g.
Definition: Storage.h:98
virtual bool multipath(bool looks_like_real_multipath) const =0
Decide whether multipath should be activated.
virtual std::pair< bool, std::string > luks(const std::string &uuid, int attempt) const =0
Decide whether the LUKS with uuid should be activated.
Stores information about a Bitlocker device.
Definition: Storage.h:180
Definition: Callbacks.h:34
virtual void message(const std::string &message) const =0
Callback for progress messages.
Definition: Storage.h:393
Definition: Storage.h:413
virtual void end_action(const Action::Base *action) const
Called at the end of commit of a single action.
Definition: Storage.h:434
virtual void begin_action(const Action::Base *action) const
Called at the begin of commit of a single action.
Definition: Storage.h:429
virtual void end() const
Called at the end of commit.
Definition: Storage.h:424
virtual void begin() const
Called at the begin of commit.
Definition: Storage.h:419
Definition: Storage.h:404
Definition: CommitOptions.h:32
Provides information whether deactivate_v2() was able to deactivate subsystems.
Definition: Storage.h:251
The main container of the libstorage-ng.
Definition: Devicegraph.h:170
Definition: Environment.h:64
Stores information about a LUKS device.
Definition: Storage.h:130
A pool represents a collection of devices.
Definition: Pool.h:83
Definition: Storage.h:291
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: Storage.h:315
virtual void begin() const
Called at the begin of probing.
Definition: Storage.h:323
virtual void end() const
Called at the end of probing.
Definition: Storage.h:328
Definition: Storage.h:334
virtual bool unsupported_filesystem(const std::string &message, const std::string &what, const std::string &name, FsType fs_type) const =0
This error callback is called when a known but unsupported filesystem type, e.g.
virtual bool ambiguity_partition_table_and_lvm_pv(const std::string &message, const std::string &what, const std::string &name, PtType pt_type) const =0
This error callback is called when a partition table and a LVM PV are found on a device.
virtual bool ambiguity_partition_table_and_luks(const std::string &message, const std::string &what, const std::string &name, PtType pt_type) const =0
This error callback is called when a partition table and a LUKS are found on a device.
virtual bool ambiguity_partition_table_and_filesystem(const std::string &message, const std::string &what, const std::string &name, PtType pt_type, FsType fs_type) const =0
This error callback is called when a partition table and a filesystem are found on a device.
virtual bool unsupported_partition_table(const std::string &message, const std::string &what, const std::string &name, PtType pt_type) const =0
This error callback is called when a known but unsupported partition table type, e....
Definition: Storage.h:282
The main entry point to libstorage.
Definition: Storage.h:443
void remove_pool(const std::string &name)
Remove a pool by name.
std::vector< std::string > get_devicegraph_names() const ST_DEPRECATED
Get the names of all devicegraphs.
MountByType get_default_mount_by() const
Query the default mount-by method.
Devicegraph * get_staging()
Return the staging devicegraph.
Pool * create_pool(const std::string &name)
Create a pool with name.
void generate_pools(const Devicegraph *devicegraph)
Generate pools, e.g.
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.
void restore_devicegraph(const std::string &name)
bool exists_pool(const std::string &name) const
Check whether a pool exists by name.
std::map< std::string, const Devicegraph * > get_devicegraphs() const
Get all devicegraphs with their names.
bool exist_devicegraph(const std::string &name) const
Check whether a devicegraph exists by name.
void rename_pool(const std::string &old_name, const std::string &new_name)
Rename a pool.
DeactivateStatusV2 deactivate_v2() const
Deactivate devices like multipath, DM and MD RAID, LVM and LUKS.
void set_default_mount_by(MountByType default_mount_by)
Set the default mount-by method.
std::string prepend_rootprefix(const std::string &mount_point) const
Prepends the root prefix to a mount point if necessary.
void check(const CheckCallbacks *check_callbacks=nullptr) const
Checks all devicegraphs.
Storage(const Environment &environment)
Construct Storage object.
void commit(const CommitOptions &commit_options, const CommitCallbacks *commit_callbacks=nullptr)
The actiongraph must be valid.
Devicegraph * get_system()
Return the system devicegraph.
void activate(const ActivateCallbacks *activate_callbacks) const
Activate devices like multipath, DM and MD RAID, LVM and LUKS.
Devicegraph * copy_devicegraph(const std::string &source_name, const std::string &dest_name)
Devicegraph * get_devicegraph(const std::string &name)
Return a devicegraph by name.
const Devicegraph * get_probed() const
Return the probed devicegraph.
Devicegraph * create_devicegraph(const std::string &name)
Create a devicegraph with name.
std::map< std::string, Pool * > get_pools()
Get all pools with their names.
DeactivateStatus deactivate() const ST_DEPRECATED
void probe(const ProbeCallbacks *probe_callbacks=nullptr)
Probe the system and replace the probed, system and staging devicegraphs.
void remove_devicegraph(const std::string &name)
Remove a devicegraph by name.
std::vector< std::string > get_pool_names() const ST_DEPRECATED
Get the names of all pools.
The storage namespace.
Definition: Actiongraph.h:40
PtType
Partition Table Type.
Definition: PartitionTable.h:42
MountByType
The key by which the mount program identifies a mountable.
Definition: Mountable.h:60
Definition: Storage.h:236