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

Holder from a BlkDevice to an Md. More...

#include <MdUser.h>

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

Public Member Functions

virtual MdUserclone () const override
 
bool is_spare () const
 Return whether the target device is a spare device.
 
void set_spare (bool spare)
 Set the target device to be a spare device. More...
 
bool is_faulty () const
 Return whether the target device is a faulty device.
 
void set_faulty (bool faulty)
 Set the target device to be a faulty device. More...
 
bool is_journal () const
 Return whether the target device is a journal device. More...
 
void set_journal (bool journal)
 Set the target device to be a journal device. More...
 
unsigned int get_sort_key () const
 Return the sort key. More...
 
void set_sort_key (unsigned int sort_key)
 Set the sort key. More...
 
Impl & get_impl ()
 
const Impl & get_impl () const
 
 MdUser (Impl *impl)
 
- Public Member Functions inherited from storage::User
Impl & get_impl ()
 
const Impl & get_impl () const
 
 User (Impl *impl)
 
- Public Member Functions inherited from storage::Holder
Deviceget_source ()
 Get the source device of the holder.
 
const Deviceget_source () const
 Get the source device of the holder. More...
 
void set_source (const Device *source)
 Set the source device of the holder. More...
 
void set_target (const Device *target)
 Set the target device of the holder. More...
 
sid_t get_source_sid () const
 Return the storage id (sid) of the source of the holder. More...
 
Deviceget_target ()
 Get the target device of the holder.
 
const Deviceget_target () const
 Get the target device of the holder. More...
 
sid_t get_target_sid () const
 Return the storage id (sid) of the target of the holder. More...
 
bool operator== (const Holder &rhs) const
 
bool operator!= (const Holder &rhs) const
 
Holdercopy_to_devicegraph (Devicegraph *devicegraph) const
 Copies the holder to the devicegraph. More...
 
bool exists_in_devicegraph (const Devicegraph *devicegraph) const
 Checks if the holder exists in the devicegraph.
 
bool exists_in_probed () const
 Checks if the holder exists in the probed devicegraph.
 
bool exists_in_staging () const
 Checks if the holder exists in the staging devicegraph.
 
bool exists_in_system () const
 Checks if the holder exists in the system devicegraph.
 
const std::map< std::string, std::string > & get_userdata () const
 Return the userdata of the holder.
 
void set_userdata (const std::map< std::string, std::string > &userdata)
 Set the userdata of the holder.
 
Devicegraphget_devicegraph ()
 Return the devicegraph the holder belongs to.
 
const Devicegraphget_devicegraph () const
 Return the devicegraph the holder belongs to. More...
 
Impl & get_impl ()
 
const Impl & get_impl () const
 
void save (xmlNode *node) const ST_DEPRECATED
 

Static Public Member Functions

static MdUsercreate (Devicegraph *devicegraph, const Device *source, const Device *target)
 Create a holder of type MdUser. More...
 
static MdUserload (Devicegraph *devicegraph, const xmlNode *node)
 
- Static Public Member Functions inherited from storage::User
static Usercreate (Devicegraph *devicegraph, const Device *source, const Device *target)
 Create a holder of type User. More...
 
static Userload (Devicegraph *devicegraph, const xmlNode *node)
 

Additional Inherited Members

- Protected Member Functions inherited from storage::Holder
 Holder (Impl *impl)
 
void create (Devicegraph *devicegraph, const Device *source, const Device *target) ST_DEPRECATED
 Create a holder between source and target in the devicegraph. More...
 
void load (Devicegraph *devicegraph, const xmlNode *node) ST_DEPRECATED
 

Detailed Description

Holder from a BlkDevice to an Md.

See also
User, Holder

Member Function Documentation

◆ create()

static MdUser* storage::MdUser::create ( Devicegraph devicegraph,
const Device source,
const Device target 
)
static

Create a holder of type MdUser.

Usually this function is not called directly. Functions like Md::add_device() call it.

See also
Holder::create(Devicegraph*, const Device*, const Device*)
Exceptions
HolderAlreadyExists

◆ get_sort_key()

unsigned int storage::MdUser::get_sort_key ( ) const

Return the sort key.

When creating a MD RAID the device list passed to the mdadm command is sorted according to the sort-key. For use-cases see https://fate.suse.com/313521/.

The RAID devices, spare and journal devices are sorted independently. Sorting of devices with the same sort-key is undefined. Any value is allowed but 0 should mean unknown/unspecified.

See also
set_sort_key()

◆ is_journal()

bool storage::MdUser::is_journal ( ) const

Return whether the target device is a journal device.

Only one device of an MD RAID can be a journal device. Only for RAID levels 4, 5 and 6.

◆ set_faulty()

void storage::MdUser::set_faulty ( bool  faulty)

Set the target device to be a faulty device.

See also
is_faulty()
Exceptions
Exception

◆ set_journal()

void storage::MdUser::set_journal ( bool  journal)

Set the target device to be a journal device.

Changing the value is not supported for RAIDs already created on-disk. Does not work with metadata version 1.0.

See also
is_journal()
Exceptions
Exception

◆ set_sort_key()

void storage::MdUser::set_sort_key ( unsigned int  sort_key)

Set the sort key.

See also
get_sort_key().

◆ set_spare()

void storage::MdUser::set_spare ( bool  spare)

Set the target device to be a spare device.

See also
is_spare()
Exceptions
Exception

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