class Disk(ConfigObject):
Config object representing a block device.
Class Method |
|
Custom function for Disks |
Static Method |
|
Computes Logical Disk parameters from Disk Template parameters. |
Method | __str__ |
Custom str() formatter for disks. |
Method |
|
Test if this device needs to be assembled on a secondary node. |
Method |
|
Compute the needed number of children for activation. |
Method |
|
Compute the per-VG growth requirements. |
Method |
|
Compute the node/disk tree for this disk and its children. |
Method |
|
Test if this device needs to be created on a secondary node. |
Method |
|
This function returns the nodes this device lives on. |
Method |
|
This function returns the primary node of the device. |
Method |
|
Check if the disk or its children are based on the given type. |
Method |
|
Test if this device needs to be opened on a secondary node. |
Method |
|
Update the size of this disk after growth. |
Method |
|
Return the device path if this device type has a static one. |
Method |
|
Test if this device supports snapshots. |
Method |
|
Disk-specific conversion to standard python types. |
Method |
|
Sets recursively the size to zero for the disk and its children. |
Method |
|
Apply changes to size, spindles and mode. |
Method |
|
Updates the dynamic disk params for the given node. |
Method |
|
Fill defaults for missing configuration values. |
Method |
|
Checks that this disk is correctly configured. |
Class Variable | __slots__ |
Undocumented |
Class Variable | all |
Undocumented |
Instance Variable | ctime |
Undocumented |
Instance Variable | dev |
Undocumented |
Instance Variable | dynamic |
Undocumented |
Instance Variable | mode |
Undocumented |
Instance Variable | mtime |
Undocumented |
Instance Variable | params |
Undocumented |
Instance Variable | serial |
Undocumented |
Instance Variable | size |
Undocumented |
Instance Variable | spindles |
Undocumented |
Method | _ |
Compute the list of all nodes covered by a device and its children. |
Inherited from ConfigObject
:
Method | __getattr__ |
Undocumented |
Method | __repr__ |
Implement __repr__ for ConfigObjects. |
Method | __setstate__ |
Undocumented |
Method |
|
Makes a deep copy of the current object and its children. |
Method |
|
Validates the slots. |
Inherited from ValidatedSlots
(via ConfigObject
):
Class Method |
|
Compute the list of all declared slots for a class. |
Method | __init__ |
Constructor for BaseOpCode. |
Computes Logical Disk parameters from Disk Template parameters.
Parameters | |
disk | disk template, one of constants.DISK_TEMPLATES |
disk | disk template parameters; dict(template_name -> parameters |
Returns | |
list(dict) | a list of dicts, one for each node of the disk hierarchy. Each dict contains the LD parameters of the node. The tree is flattened in-order. |
Compute the needed number of children for activation.
This method will return either -1 (all children) or a positive number denoting the minimum number of children needed for activation (only mirrored devices will usually return >=0).
Currently, only DRBD8 supports diskless activation (therefore we return 0), for all other we keep the previous semantics and return -1.
Compute the per-VG growth requirements.
This only works for VG-based disks.
Parameters | |
amount:integer | the desired increase in (user-visible) disk space |
Returns | |
dict | a dictionary of volume-groups and the required size |
Compute the node/disk tree for this disk and its children.
This method, given the node on which the parent disk lives, will return the list of all (node UUID, disk) pairs which describe the disk tree in the most compact way. For example, a drbd/lvm stack will be returned as (primary_node, drbd) and (secondary_node, drbd) which represents all the top-level devices on the nodes.
This function returns the nodes this device lives on.
Given the node on which the parent of the device lives on (or, in case of a top-level device, the primary node of the devices' instance), this function will return a list of nodes on which this devices needs to (or can) be assembled.
This function returns the primary node of the device.
If the device is not a DRBD device, we still return the node the device lives on.
Check if the disk or its children are based on the given type.
Parameters | |
devconstants.DTS_BLOCK | the type to look for |
Returns | |
boolean | boolean indicating if a device of the given type was found or not |
Update the size of this disk after growth.
This method recurses over the disks's children and updates their size correspondigly. The method needs to be kept in sync with the actual algorithms from bdev.
Return the device path if this device type has a static one.
Some devices (LVM for example) live always at the same /dev/ path, irrespective of their status. For such devices, we return this path, for others we return None.
Unknown Field: warning | |
The path returned is not a normalized pathname; callers should check that it is a valid path. |
ganeti.objects.ConfigObject.ToDict
Disk-specific conversion to standard python types.
This replaces the children lists of objects with lists of standard python types.
Updates the dynamic disk params for the given node.
This is mainly used for drbd, which needs ip/port configuration.
Arguments:
- target_node_uuid: the node UUID we wish to configure for
- nodes_ip: a mapping of node name to ip
The target_node must exist in nodes_ip, and should be one of the nodes in the logical ID if this device is a DRBD device.