GduActivatableDrive

GduActivatableDrive — Activable Drives (RAID, LVM, etc.)

Synopsis

struct              GduActivatableDrive;
enum                GduActivableDriveKind;
enum                GduActivableDriveSlaveState;
gboolean            gdu_activatable_drive_has_slave     (GduActivatableDrive *activatable_drive,
                                                         GduDevice *device);
GList*              gdu_activatable_drive_get_slaves    (GduActivatableDrive *activatable_drive);
GduDevice*          gdu_activatable_drive_get_first_slave
                                                        (GduActivatableDrive *activatable_drive);
int                 gdu_activatable_drive_get_num_slaves
                                                        (GduActivatableDrive *activatable_drive);
int                 gdu_activatable_drive_get_num_ready_slaves
                                                        (GduActivatableDrive *activatable_drive);
GduActivableDriveKind gdu_activatable_drive_get_kind    (GduActivatableDrive *activatable_drive);
gboolean            gdu_activatable_drive_is_activated  (GduActivatableDrive *activatable_drive);
gboolean            gdu_activatable_drive_can_activate  (GduActivatableDrive *activatable_drive);
gboolean            gdu_activatable_drive_can_activate_degraded
                                                        (GduActivatableDrive *activatable_drive);
void                gdu_activatable_drive_activate      (GduActivatableDrive *activatable_drive,
                                                         GduActivatableDriveActivationFunc callback,
                                                         gpointer user_data);
void                gdu_activatable_drive_deactivate    (GduActivatableDrive *activatable_drive,
                                                         GduActivatableDriveDeactivationFunc callback,
                                                         gpointer user_data);
GduActivableDriveSlaveState gdu_activatable_drive_get_slave_state
                                                        (GduActivatableDrive *activatable_drive,
                                                         GduDevice *slave);

Object Hierarchy

  GObject
   +----GduDrive
         +----GduActivatableDrive

Implemented Interfaces

GduActivatableDrive implements GduPresentable.

Description

The GduActivatableDrive class represents drives that are built from one or more underlying block devices. This includes things like RAID arrays and LVM devices.

An activatable drive is typically added to GduPool as soon as a component device that is part of the abstraction is available. The drive can be started (gdu_activatable_drive_activate()) and stopped (gdu_activatable_drive_deactivate()) and one can query the state of the underlying components (gdu_activatable_drive_get_slave_state()).

See the documentation for GduPresentable for the big picture.

Details

struct GduActivatableDrive

struct GduActivatableDrive;


enum GduActivableDriveKind

typedef enum {
        GDU_ACTIVATABLE_DRIVE_KIND_LINUX_MD,
} GduActivableDriveKind;

The type of activatable drive.

GDU_ACTIVATABLE_DRIVE_KIND_LINUX_MD

Linux md Software RAID

enum GduActivableDriveSlaveState

typedef enum {
        GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_RUNNING,
        GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_RUNNING_SYNCING,
        GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_RUNNING_HOT_SPARE,
        GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_READY,
        GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_NOT_FRESH,
} GduActivableDriveSlaveState;

State for slaves of an activatable drive.

GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_RUNNING

The drive is activated and the slave is part of it.

GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_RUNNING_SYNCING

The drive is activated and the slave is part of the array but is in the process of being synced into the array (e.g. it was recently added).

GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_RUNNING_HOT_SPARE

The drive is activated and the slave is a hot spare ready to kick in if a drive fails.

GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_READY

The drive is not activated and the slave, compared to other slaves, is a valid member of the array.

GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_NOT_FRESH

Either the drive is not activated but the slave, compared to other slaves, is not valid since other slaves have higher event numbers / more recent usage dates / etc. Otherwise, if the drive is activated, slaves with this type have valid meta-data (e.g. uuid) but is not part of the array (typically happens if the wire connecting the slave was temporarily disconnected).

gdu_activatable_drive_has_slave ()

gboolean            gdu_activatable_drive_has_slave     (GduActivatableDrive *activatable_drive,
                                                         GduDevice *device);

Checks if device is a component of activatable_drive.

activatable_drive :

A GduActivatableDrive.

device :

A GduDevice.

Returns :

TRUE only if slave is a component of activatable_drive.

gdu_activatable_drive_get_slaves ()

GList*              gdu_activatable_drive_get_slaves    (GduActivatableDrive *activatable_drive);

Gets all slaves of activatable_drive.

activatable_drive :

A GduActivatableDrive.

Returns :

A GList of GduDevice objects. Caller must free this list (and call g_object_unref() on all elements).

gdu_activatable_drive_get_first_slave ()

GduDevice*          gdu_activatable_drive_get_first_slave
                                                        (GduActivatableDrive *activatable_drive);

Gets the first slave of activatable_drive.

activatable_drive :

A GduActivatableDrive.

Returns :

A GduDevice or NULL if there are no slaves. Caller must free this object with g_object_unref().

gdu_activatable_drive_get_num_slaves ()

int                 gdu_activatable_drive_get_num_slaves
                                                        (GduActivatableDrive *activatable_drive);

Gets the total number of slaves of activatable_drive.

activatable_drive :

A GduActivatableDrive.

Returns :

The number of slaves of activatable_drive.

gdu_activatable_drive_get_num_ready_slaves ()

int                 gdu_activatable_drive_get_num_ready_slaves
                                                        (GduActivatableDrive *activatable_drive);

Gets the number of fresh/ready (See GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_READY) slaves of activatable_drive.

activatable_drive :

A GduActivatableDrive.

Returns :

The number of fresh/ready slaves of activatable_drive.

gdu_activatable_drive_get_kind ()

GduActivableDriveKind gdu_activatable_drive_get_kind    (GduActivatableDrive *activatable_drive);

Gets the type of activatable drive.

activatable_drive :

A GduActivatableDrive.

Returns :

A value from the GduActivatableKind enumeration.

gdu_activatable_drive_is_activated ()

gboolean            gdu_activatable_drive_is_activated  (GduActivatableDrive *activatable_drive);

Checks if activatable_drive is already activated.

activatable_drive :

A GduActivatableDrive.

Returns :

TRUE only if activatable_drive is activated.

gdu_activatable_drive_can_activate ()

gboolean            gdu_activatable_drive_can_activate  (GduActivatableDrive *activatable_drive);

Check if activatable_drive can be activated in non-degraded mode. See also gdu_activatable_drive_can_activate_degraded().

activatable_drive :

A GduActivatableDrive.

Returns :

TRUE only if it can be activated. If activatable_drive is already activated this function returns FALSE.

gdu_activatable_drive_can_activate_degraded ()

gboolean            gdu_activatable_drive_can_activate_degraded
                                                        (GduActivatableDrive *activatable_drive);

Check if activatable_drive can be activated in degraded mode. See also gdu_activatable_drive_can_activate().

activatable_drive :

A GduActivatableDrive.

Returns :

TRUE only if it can be activated in degraded mode. If activatable_drive is already activated or can be activated in non-degraded mode, this function returns FALSE.

gdu_activatable_drive_activate ()

void                gdu_activatable_drive_activate      (GduActivatableDrive *activatable_drive,
                                                         GduActivatableDriveActivationFunc callback,
                                                         gpointer user_data);

Activates activatable_drive.

activatable_drive :

A GduActivatableDrive.

callback :

Callback function.

user_data :

User data.

gdu_activatable_drive_deactivate ()

void                gdu_activatable_drive_deactivate    (GduActivatableDrive *activatable_drive,
                                                         GduActivatableDriveDeactivationFunc callback,
                                                         gpointer user_data);

Deactivates activatable_drive.

activatable_drive :

A GduActivatableDrive.

callback :

Callback function.

user_data :

User data.

gdu_activatable_drive_get_slave_state ()

GduActivableDriveSlaveState gdu_activatable_drive_get_slave_state
                                                        (GduActivatableDrive *activatable_drive,
                                                         GduDevice *slave);

Gets the state of slave of activatable_drive.

activatable_drive :

A GduActivatableDrive.

slave :

A GduDevice.

Returns :

A value from GduActivatableDriveSlaveState for slave.