Package ganeti :: Module objects :: Class Disk
[hide private]
[frames] | no frames]

Class Disk

source code


Config object representing a block device.

Instance Methods [hide private]
 
CreateOnSecondary(self)
Test if this device needs to be created on a secondary node.
source code
 
AssembleOnSecondary(self)
Test if this device needs to be assembled on a secondary node.
source code
 
OpenOnSecondary(self)
Test if this device needs to be opened on a secondary node.
source code
 
StaticDevPath(self)
Return the device path if this device type has a static one.
source code
 
ChildrenNeeded(self)
Compute the needed number of children for activation.
source code
boolean
IsBasedOnDiskType(self, dev_type)
Check if the disk or its children are based on the given type.
source code
 
GetNodes(self, node)
This function returns the nodes this device lives on.
source code
 
ComputeNodeTree(self, parent_node)
Compute the node/disk tree for this disk and its children.
source code
 
RecordGrow(self, amount)
Update the size of this disk after growth.
source code
 
UnsetSize(self)
Sets recursively the size to zero for the disk and its children.
source code
 
SetPhysicalID(self, target_node, nodes_ip)
Convert the logical ID to the physical ID.
source code
 
ToDict(self)
Disk-specific conversion to standard python types.
source code
 
__str__(self)
Custom str() formatter for disks.
source code
 
Verify(self)
Checks that this disk is correctly configured.
source code
 
UpgradeConfig(self)
Fill defaults for missing configuration values.
source code

Inherited from ConfigObject: Copy, __getattr__, __getstate__, __init__, __repr__, __setstate__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Methods [hide private]
 
FromDict(cls, val)
Custom function for Disks
source code

Inherited from ConfigObject (private): _all_slots

Static Methods [hide private]
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

StaticDevPath(self)

source code 

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.

Warning: The path returned is not a normalized pathname; callers should check that it is a valid path.

ChildrenNeeded(self)

source code 

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.

IsBasedOnDiskType(self, dev_type)

source code 

Check if the disk or its children are based on the given type.

Parameters:
Returns: boolean
boolean indicating if a device of the given type was found or not

GetNodes(self, node)

source code 

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.

ComputeNodeTree(self, parent_node)

source code 

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, 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.

RecordGrow(self, amount)

source code 

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.

SetPhysicalID(self, target_node, nodes_ip)

source code 

Convert the logical ID to the physical ID.

This is used only for drbd, which needs ip/port configuration.

The routine descends down and updates its children also, because this helps when the only the top device is passed to the remote node.

Arguments:

  • target_node: the node we wish to configure for
  • nodes_ip: a mapping of node name to ip

The target_node must exist in in nodes_ip, and must be one of the nodes in the logical ID for each of the DRBD devices encountered in the disk tree.

ToDict(self)

source code 

Disk-specific conversion to standard python types.

This replaces the children lists of objects with lists of standard python types.

Overrides: ConfigObject.ToDict

FromDict(cls, val)
Class Method

source code 

Custom function for Disks

Overrides: ConfigObject.FromDict

__str__(self)
(Informal representation operator)

source code 

Custom str() formatter for disks.

Overrides: object.__str__

UpgradeConfig(self)

source code 

Fill defaults for missing configuration values.

Overrides: ConfigObject.UpgradeConfig