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"
109 virtual bool multipath(
bool looks_like_real_multipath)
const = 0;
122 virtual std::pair<bool, std::string>
luks(
const std::string& uuid,
int attempt)
const = 0;
137 const std::string& get_device_name()
const;
138 unsigned long long get_size()
const;
139 const std::string& get_dm_table_name()
const;
140 bool is_dm_table_name_generated()
const;
141 const std::string& get_uuid()
const;
142 const std::string& get_label()
const;
148 Impl& get_impl() {
return *impl; }
149 const Impl& get_impl()
const {
return *impl; }
153 const std::unique_ptr<Impl> impl;
172 virtual std::pair<bool, std::string>
luks(
const LuksInfo& luks_info,
int attempt)
const = 0;
187 const std::string& get_device_name()
const;
188 unsigned long long get_size()
const;
189 const std::string& get_dm_table_name()
const;
190 bool is_dm_table_name_generated()
const;
191 const std::string& get_uuid()
const;
197 Impl& get_impl() {
return *impl; }
198 const Impl& get_impl()
const {
return *impl; }
202 const std::unique_ptr<Impl> impl;
224 virtual void end()
const {}
261 bool multipath()
const;
262 bool dm_raid()
const;
266 bool bitlocker()
const;
272 Impl& get_impl() {
return *impl; }
273 const Impl& get_impl()
const {
return *impl; }
277 const std::unique_ptr<Impl> impl;
310 const std::string& command, uint64_t used_features)
const = 0;
329 virtual void end()
const {}
347 const std::string& name,
PtType pt_type,
348 FsType fs_type)
const = 0;
357 const std::string& name,
PtType pt_type)
const = 0;
366 const std::string& name,
PtType pt_type)
const = 0;
377 const std::string& name,
PtType pt_type)
const = 0;
388 const std::string& name, FsType fs_type)
const = 0;
399 virtual void error(
const std::string& message)
const = 0;
425 virtual void end()
const {}
489 bool equal_devicegraph(
const std::string& lhs,
const std::string& rhs)
const;
584 const std::
string& get_rootprefix() const;
585 void set_rootprefix(const std::
string& rootprefix) ST_DEPRECATED;
710 void rename_pool(const std::
string& old_name, const std::
string& new_name);
748 Impl& get_impl() {
return *impl; }
749 const Impl& get_impl()
const {
return *impl; }
753 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:162
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:211
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:219
virtual void end() const
Called at the end of activation.
Definition: Storage.h:224
Other storage subsystems are activated automatically, e.g.
Definition: Storage.h:99
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:181
Definition: Callbacks.h:34
virtual void message(const std::string &message) const =0
Callback for progress messages.
Definition: Storage.h:394
Definition: Storage.h:414
virtual void end_action(const Action::Base *action) const
Called at the end of commit of a single action.
Definition: Storage.h:435
virtual void begin_action(const Action::Base *action) const
Called at the begin of commit of a single action.
Definition: Storage.h:430
virtual void end() const
Called at the end of commit.
Definition: Storage.h:425
virtual void begin() const
Called at the begin of commit.
Definition: Storage.h:420
Definition: Storage.h:405
Definition: CommitOptions.h:32
Provides information whether deactivate_v2() was able to deactivate subsystems.
Definition: Storage.h:252
The main container of the libstorage-ng.
Definition: Devicegraph.h:170
Definition: Environment.h:64
Stores information about a LUKS device.
Definition: Storage.h:131
A pool represents a collection of devices.
Definition: Pool.h:83
Definition: Storage.h:292
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:316
virtual void begin() const
Called at the begin of probing.
Definition: Storage.h:324
virtual void end() const
Called at the end of probing.
Definition: Storage.h:329
Definition: Storage.h:335
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:283
The main entry point to libstorage.
Definition: Storage.h:444
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.
const Arch & get_arch() const
So far only valid after probing.
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 SystemInfo class keeps various system information.
Definition: SystemInfo.h:49
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:237