class DRBD8Dev(base.BlockDev):
DRBD v8.x block device.
This implements the local host part of the DRBD device, i.e. it doesn't do anything to the supposed peer. If you need a fully connected DRBD pair, you need to use this class on both hosts.
The unique_id for the drbd device is a (pnode_uuid, snode_uuid, port, pnode_minor, lnode_minor, secret) tuple, and it must have two children: the data device and the meta_device. The meta device is checked for valid size and is zeroed on create.
Class Method |
|
Create a new DRBD8 device. |
Method | __init__ |
Undocumented |
Method |
|
Add a disk to the DRBD device. |
Method |
|
Assemble the drbd. |
Method |
|
Check if our minor is configured. |
Method |
|
Reconnects the network. |
Method |
|
Make the local state secondary. |
Method |
|
Removes network configuration. |
Method |
|
Return the current status data from /proc/drbd for this device. |
Method |
|
Returns the sync status of the device. |
Method |
|
Resize the DRBD device and its backing storage. |
Method |
|
Make the local state primary. |
Method |
|
Pauses or resumes the sync of a DRBD device. |
Method |
|
Stub remove for DRBD devices. |
Method |
|
Detach the drbd device from local storage. |
Method |
|
Rename a device. |
Method |
|
Set the synchronization parameters of the DRBD syncer. |
Method |
|
Shutdown the DRBD device. |
Instance Variable | attached |
Undocumented |
Instance Variable | dev |
Undocumented |
Instance Variable | major |
Undocumented |
Instance Variable | minor |
Undocumented |
Class Method | _ |
Initialize a meta device. |
Static Method | _ |
Check if the given meta device looks like a valid one. |
Static Method | _ |
Return the path to a drbd device for a given minor. |
Static Method | _ |
Undocumented |
Static Method | _ |
Undocumented |
Method | _ |
Configure the local part of a DRBD device. |
Method | _ |
Configure the network part of the device. |
Method | _ |
Assemble the drbd device from zero. |
Method | _ |
Return the `drbdsetup show` data. |
Method | _ |
Return parsed information from `drbdsetup show`. |
Method | _ |
Test if our local config matches with an existing device. |
Method | _ |
Test if our network config matches with an existing device. |
Method | _ |
Set our parameters based on the given minor. |
Method | _ |
Set the parameters of the DRBD syncer. |
Method | _ |
Detach from the local device. |
Method | _ |
Disconnect from the remote peer. |
Method | _ |
Assembles the DRBD device from a (partially) configured device. |
Constant | _DRBD |
Undocumented |
Constant | _NET |
Undocumented |
Instance Variable | _aminor |
Undocumented |
Instance Variable | _children |
Undocumented |
Instance Variable | _cmd |
Undocumented |
Instance Variable | _lhost |
Undocumented |
Instance Variable | _lport |
Undocumented |
Instance Variable | _rhost |
Undocumented |
Instance Variable | _rport |
Undocumented |
Instance Variable | _secret |
Undocumented |
Instance Variable | _show |
Undocumented |
Inherited from BlockDev
:
Method | __eq__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method |
|
Calculate the mirror status recursively for our children. |
Method |
|
Builds the shell command for exporting data from device. |
Method |
|
Return the actual disk size and number of spindles used. |
Method |
|
Return the actual disk size. |
Method |
|
Return the actual number of spindles used. |
Method |
|
Return URIs hypervisors can use to access disks in userspace mode. |
Method |
|
Builds the shell command for importing data to device. |
Method |
|
Update metadata with info text. |
Method |
|
Creates a snapshot of the block device. |
Instance Variable | dyn |
Undocumented |
Instance Variable | params |
Undocumented |
Instance Variable | size |
Undocumented |
Instance Variable | unique |
Undocumented |
def Create(cls, unique_id, children, size, spindles, params, excl_stor, dyn_params, **kwargs): ¶
ganeti.storage.base.BlockDev.Create
Create a new DRBD8 device.
Since DRBD devices are not created per se, just assembled, this function only initializes the metadata.
ganeti.storage.base.BlockDev.Assemble
Assemble the drbd.
Method:
- if we have a configured device, we try to ensure that it matches our config
- if not, we create it from zero
- anyway, set the device parameters
ganeti.storage.base.BlockDev.Attach
Check if our minor is configured.
This doesn't do any device configurations - it only checks if the minor is in a state different from Unconfigured.
Note that this function will not change the state of the system in any way (except in case of side-effects caused by reading from /proc).
Reconnects the network.
This method connects the network side of the device with a specified multi-master flag. The device needs to be 'Standalone' but have valid network configuration data.
Parameters | |
multimaster:boolean | init the network in dual-primary mode |
ganeti.storage.base.BlockDev.Close
Make the local state secondary.
This will, of course, fail if the device is in use.
Removes network configuration.
This method shutdowns the network side of the device.
The method will wait up to a hardcoded timeout for the device to go into standalone after the 'disconnect' command before re-configuring it, as sometimes it takes a while for the disconnect to actually propagate and thus we might issue a 'net' command while the device is still connected. If the device will still be attached to the network and we time out, we raise an exception.
Returns the sync status of the device.
If sync_percent is None, it means all is ok If estimated_time is None, it means we can't estimate the time needed, otherwise it's the time left in seconds.
We set the is_degraded parameter to True on two conditions: network not connected or local disk missing.
We compute the ldisk parameter based on whether we have a local disk or not.
Returns | |
objects.BlockDevStatus | Undocumented |
ganeti.storage.base.BlockDev.Grow
Resize the DRBD device and its backing storage.
See BlockDev.Grow
for parameter description.
ganeti.storage.base.BlockDev.Open
Make the local state primary.
If the 'force' parameter is given, DRBD is instructed to switch the device into primary mode. Since this is a potentially dangerous operation, the force flag should be only given after creation, when it actually is mandatory.
Pauses or resumes the sync of a DRBD device.
See BlockDev.PauseResumeSync
for parameter description.
ganeti.storage.base.BlockDev.Rename
Rename a device.
This is not supported for drbd devices.
Set the synchronization parameters of the DRBD syncer.
See BlockDev.SetSyncParams
for parameter description.
Initialize a meta device.
This will not work if the given minor is in use.
Parameters | |
minor:int | the DRBD minor whose (future) meta device should be initialized |
dev | path to the meta device to initialize |
Check if the given meta device looks like a valid one.
This currently only checks the size, which must be around 128MiB.
Parameters | |
meta | the path to the device to check |
Return the path to a drbd device for a given minor.
Parameters | |
minor:int | Undocumented |
Returns | |
string | Undocumented |
Configure the local part of a DRBD device.
Parameters | |
minor:int | the minor to assemble locally |
backend:string | path to the data device to use |
meta:string | path to the meta device to use |
size:int | size in MiB |
Configure the network part of the device.
Parameters | |
minor:int | the minor to assemble the network for |
net | tuple containing the local address, local port, remote address and remote port |
dual | whether two primaries should be allowed or not |
hmac:string | the HMAC algorithm to use |
secret:string | the shared secret to use |
Return the `drbdsetup show` data.
Parameters | |
minor:int | the minor to collect show output for |
Returns | |
string | Undocumented |
Return parsed information from `drbdsetup show`.
Parameters | |
minor:int | the minor to return information for |
Returns | |
dict as described in drbd_info.BaseShowInfo.GetDevInfo | Undocumented |
Test if our local config matches with an existing device.
The parameter should be as returned from `_GetShowInfo()`. This method tests if our local backing device is the same as the one in the info parameter, in effect testing if we look like the given device.
Parameters | |
info:dict as described in drbd_info.BaseShowInfo.GetDevInfo | Undocumented |
Returns | |
boolean | Undocumented |
Test if our network config matches with an existing device.
The parameter should be as returned from `_GetShowInfo()`. This method tests if our network configuration is the same as the one in the info parameter, in effect testing if we look like the given device.
Parameters | |
info:dict as described in drbd_info.BaseShowInfo.GetDevInfo | Undocumented |
Returns | |
boolean | Undocumented |
Set our parameters based on the given minor.
This sets our minor variable and our dev_path.
Parameters | |
minor:int | Undocumented |
Set the parameters of the DRBD syncer.
This is the low-level implementation.
Parameters | |
minor:int | the drbd minor whose settings we change |
params:dict | LD level disk parameters related to the synchronization |
Returns | |
list | a list of error messages |
Detach from the local device.
I/Os will continue to be served from the remote device. If we don't have a remote device, this operation will fail.
Parameters | |
minor:int | the device to detach from the local device |
Disconnect from the remote peer.
This fails if we don't have a local device.
Parameters | |
minor:boolean | the device to disconnect from the remote peer |