Top | ![]() |
![]() |
![]() |
![]() |
#define | BD_MD_SUPERBLOCK_SIZE |
#define | BD_MD_CHUNK_SIZE |
#define | BD_MD_ERROR |
enum | BDMDError |
BDMDExamineData | |
BDMDDetailData |
A plugin for basic operations with MD RAID. Also sizes are in bytes unless specified otherwise.
gboolean bd_md_init ();
Initializes the plugin. **This function is called automatically by the library's initialization functions.**
void
bd_md_close ();
Cleans up after the plugin. **This function is called automatically by the library's functions that unload it.**
BDMDExamineData *
bd_md_examine_data_copy (BDMDExamineData *data
);
Creates a new copy of data
.
[skip]
void
bd_md_examine_data_free (BDMDExamineData *data
);
Frees data
.
[skip]
BDMDDetailData *
bd_md_detail_data_copy (BDMDDetailData *data
);
Creates a new copy of data
.
[skip]
guint64 bd_md_get_superblock_size (guint64 member_size
,const gchar *version
,GError **error
);
member_size |
size of an array member |
|
version |
metadata version or |
[allow-none] |
error |
place to store error (if any). |
[out] |
gboolean bd_md_create (const gchar *raid_spec
,const gchar *level
,const gchar **disks
,guint64 spares
,const gchar *version
,gboolean bitmap
,guint64 chunk_size
,const BDExtraArg **extra
,GError **error
);
device_name |
name of the device to create |
|
level |
RAID level (as understood by mdadm, see mdadm(8)) |
|
disks |
disks to use for the new RAID (including spares). |
[array zero-terminated=1] |
spares |
number of spare devices |
|
version |
metadata version. |
[allow-none] |
bitmap |
whether to create an internal bitmap on the device or not |
|
chunk_size |
chunk size of the device to create |
|
extra |
extra options for the creation (right now passed to the 'mdadm' utility). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
gboolean bd_md_deactivate (const gchar *raid_spec
,GError **error
);
gboolean bd_md_activate (const gchar *raid_spec
,const gchar **members
,const gchar *uuid
,gboolean start_degraded
,const BDExtraArg **extra
,GError **error
);
raid_spec |
specification of the RAID device (name, node or path) to activate (if not given "--scan" is implied and |
[allow-none] |
members |
member devices to be considered for |
[allow-none][array zero-terminated=1] |
uuid |
UUID (in the MD RAID format!) of the MD RAID to activate. |
[allow-none] |
start_degraded |
whether to start the array even if it's degraded |
|
extra |
extra options for the activation (right now passed to the 'mdadm' utility). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
gboolean bd_md_run (const gchar *raid_spec
,GError **error
);
gboolean bd_md_nominate (const gchar *device
,GError **error
);
gboolean bd_md_denominate (const gchar *device
,GError **error
);
gboolean bd_md_add (const gchar *raid_spec
,const gchar *device
,guint64 raid_devs
,const BDExtraArg **extra
,GError **error
);
raid_spec |
specification of the RAID device (name, node or path) to add |
|
device |
name of the device to add to the |
|
raid_devs |
number of devices the |
|
extra |
extra options for the addition (right now passed to the 'mdadm' utility). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
whether the device
was successfully added to the raid_spec
RAID or
not
The raid_devs
parameter is used when adding devices to a raid array that has
no actual redundancy. In this case it is necessary to explicitly grow the
array all at once rather than manage it in the sense of adding spares.
Whether the new device will be added as a spare or an active member is decided by mdadm.
gboolean bd_md_remove (const gchar *raid_spec
,const gchar *device
,gboolean fail
,const BDExtraArg **extra
,GError **error
);
raid_spec |
specification of the RAID device (name, node or path) to remove |
|
device |
device to remove from the |
|
fail |
whether to mark the |
|
extra |
extra options for the removal (right now passed to the 'mdadm' utility). |
[allow-none][array zero-terminated=1] |
error |
place to store error (if any). |
[out] |
BDMDExamineData * bd_md_examine (const gchar *device
,GError **error
);
gchar * bd_md_get_md_uuid (const gchar *uuid
,GError **error
);
uuid |
UUID to transform into format used by MD RAID |
|
error |
place to store error (if any). |
[out] |
transformed form of uuid
This function expects a UUID in the canonical (traditional format) and
returns a UUID in the format used by MD RAID and is thus reverse to
bd_md_canonicalize_uuid()
. The change is as follows:
3386ff85-f501-2621-4a43-5f061eb47236 -> 3386ff85:f5012621:4a435f06:1eb47236.
[transfer full]
BDMDDetailData * bd_md_detail (const gchar *raid_spec
,GError **error
);
gchar * bd_md_get_status (const gchar *raid_spec
,GError **error
);
gboolean bd_md_set_bitmap_location (const gchar *raid_spec
,const gchar *location
,GError **error
);
gchar * bd_md_get_bitmap_location (const gchar *raid_spec
,GError **error
);
gboolean bd_md_request_sync_action (const gchar *raid_spec
,const gchar *action
,GError **error
);
typedef struct { gchar *device; gchar *level; guint64 num_devices; gchar *name; guint64 size; gchar *uuid; guint64 update_time; gchar *dev_uuid; guint64 events; gchar *metadata; guint64 chunk_size; } BDMDExamineData;
gchar * |
path of the MD device |
|
gchar * |
RAID level of the device |
|
guint64 |
number of devices used by the MD device |
|
gchar * |
name of the MD device |
|
guint64 |
size of the MD device |
|
gchar * |
array UUID |
|
guint64 |
update time of the MD device |
|
gchar * |
UUID of the member device |
|
guint64 |
number of events on the MD device |
|
gchar * |
version of the metadata used by the MD device |
|
guint64 |
chunk size used by the MD device |
typedef struct { gchar *device; gchar *metadata; gchar *creation_time; gchar *level; gchar *name; guint64 array_size; guint64 use_dev_size; guint64 raid_devices; guint64 total_devices; guint64 active_devices; guint64 working_devices; guint64 failed_devices; guint64 spare_devices; gboolean clean; gchar *uuid; } BDMDDetailData;
gchar * |
path of the device |
|
gchar * |
version of the metadata used by the device |
|
gchar * |
creation time |
|
gchar * |
level of the MD RAID |
|
gchar * |
name of the MD device |
|
guint64 |
size of the MD array |
|
guint64 |
size of the used space |
|
guint64 |
number of devices in the MD array |
|
guint64 |
total number of devices in the MD array |
|
guint64 |
number of active devices in the MD array |
|
guint64 |
number of working devices in the MD array |
|
guint64 |
number of failed devices in the MD array |
|
guint64 |
number of spare devices in the MD array |
|
gboolean |
whether the MD array is clean or not |
|
gchar * |
uuid of the MD array |