Logical units dealing with storage of instances.
Class |
|
Bring up an instance's disks. |
Class |
|
Shutdown an instance's disks. |
Class |
|
Grow a disk of an instance. |
Class |
|
Recreate an instance's missing disks. |
Class |
|
Replace the disks of an instance. |
Class |
|
Creates a new temporary bootable disk, and makes sure it is destroyed. |
Class |
|
Replaces disks for an instance. |
Function |
|
Prepare the block devices for an instance. |
Function |
|
Calculate final instance file storage dir. |
Function |
|
Wrapper around _CheckDiskConsistencyInner . |
Function |
|
Check that the given disk should or should not have the provider param. |
Function |
|
Checks if nodes have enough free disk space in all the VGs. |
Function |
|
Compute disk size requirements inside the RADOS cluster. |
Function |
|
Check the presence of the spindle options with exclusive_storage. |
Function |
|
Recursively remove the forthcoming flag |
Function |
|
Computes the instance disks. |
Function |
|
Computes the new instance's disks for the template conversion. |
Function |
|
Compute disk size requirements in the volume group |
Function |
|
Create all disks for an instance. |
Function |
|
Create a single block device on a given node. |
Function |
|
Return the instance disks selected by the disks list |
Function |
|
Generate the entire disk layout for a given template type. |
Function |
|
Dumps an image onto an instance disk. |
Function |
|
Whether exclusive_storage is in effect for the given node. |
Function |
|
Shutdown block devices of an instance. |
Function |
|
Start the disks of an instance. |
Function |
|
Sleep and poll for an instance's disk to sync. |
Function |
|
Wipes instance disks. |
Function |
|
Wrapper for WipeDisks that handles errors. |
Function | _ |
Wrapper around call_blockdev_find to annotate diskparams. |
Function | _ |
Calculates the ETA based on size written and total size. |
Function | _ |
Check that mirrors are not degraded. |
Function | _ |
Checks if nodes have enough free disk space in the specified VG. |
Function | _ |
Checks the vg capacity for a given node. |
Function | _ |
Wrapper around _CreateBlockDevInner . |
Function | _ |
Create a tree of block devices on a given node. |
Function | _ |
Converts a disk size in bytes to mebibytes. |
Function | _ |
Generate a drbd8 device complete with its children. |
Function | _ |
Generate a suitable LV name. |
Function | _ |
Prepares the input and performs a node info call. |
Function | _ |
Shutdown block devices of an instance. |
Function | _ |
Undo the work performed by CreateDisks . |
Constant | _DISK |
Undocumented |
Prepare the block devices for an instance.
This sets up the block devices on all nodes.
Modifies the configuration of the instance, so the caller should re-read the instance configuration, if needed.
Parameters | |
lu:LogicalUnit | the logical unit on whose behalf we execute |
instance:objects.Instance | the instance for whose disks we assemble |
disks:list of objects.Disk or None | which disks to assemble (or all, if None) |
ignore | if true, errors on secondary nodes won't result in an error return from the function |
ignore | if true, the current known size of the disk will not be used during the disk activation, useful for cases when the size is wrong |
Returns | |
False if the operation failed, otherwise a list of (host, instance_visible_name, node_visible_name) with the mapping from node devices to instance devices, as well as the payloads of the RPC calls |
Calculate final instance file storage dir.
Parameters | |
disk | constants.DT_FILE , constants.DT_SHARED_FILE , or constants.DT_GLUSTER |
cfg:ConfigWriter | the configuration that is to be used. |
instance | name of the instance this disk is for. |
file | the path below the configured base. |
Returns | |
string | The file storage directory for the instance |
Check that the given disk should or should not have the provider param.
Parameters | |
diskdict:dict | disk parameters |
disk | the desired template of this disk |
Raises | |
errors.OpPrereqError | when the parameter is used in the wrong way |
Checks if nodes have enough free disk space in all the VGs.
This function checks if all given nodes have the needed amount of free disk. In case any node has less disk or we cannot get the information from the node, this function raises an OpPrereqError exception.
Parameters | |
lu:LogicalUnit | a logical unit from which we get configuration data |
node | the list of node UUIDs to check |
req | the hash of vg and corresponding amount of disk in MiB to check for |
Raises | |
errors.OpPrereqError | if the node doesn't have enough disk, or we cannot check the node |
Check the presence of the spindle options with exclusive_storage.
Parameters | |
diskdict:dict | disk parameters |
es | the effective value of the exlusive_storage flag |
required:bool | whether spindles are required or just optional @raise errors.OpPrereqError when spindles are given and they should not |
Computes the instance disks.
Parameters | |
disks:list of dictionaries | The disks' input dictionary |
disk | The disk template of the instance |
default | The default_vg to assume |
Returns | |
The computed disks |
Computes the new instance's disks for the template conversion.
This method is used by the disks template conversion mechanism. Using the 'ComputeDisks' method as an auxiliary method computes the disks that will be used for generating the new disk template of the instance. It computes the size, mode, and name parameters from the instance's current disks, such as the volume group and the access parameters for the templates that support them. For conversions targeting an extstorage template, the mandatory provider's name or any user-provided extstorage parameters will also be included in the result.
Parameters | |
disks:list of {objects.Disk} | The current disks of the instance |
disk | The disk template of the instance |
default | The default volume group to assume |
ext | The extstorage parameters |
Returns | |
list of dictionaries | The computed disks' information for the new template |
Create all disks for an instance.
This abstracts away some work from AddInstance.
Since the instance may not have been saved to the config file yet, this function can not query the config file for the instance's disks; in that case they need to be passed as an argument.
This function is also used by the disk template conversion mechanism to create the new disks of the instance. Since the instance will have the old template at the time we create the new disks, the new template must be passed as an extra argument.
Parameters | |
lu:LogicalUnit | the logical unit on whose behalf we execute |
instance:objects.Instance | the instance whose disks we should create |
disk | if provided, overrides the instance's disk_template |
to | list of indices to skip |
target | if passed, overrides the target node for creation |
disks:list of {objects.Disk} | the disks to create; if not specified, all the disks of the instance are created |
Returns | |
information about the created disks, to be used to call _UndoCreateDisks | |
Raises | |
errors.OpPrereqError | in case of error |
Create a single block device on a given node.
This will not recurse over children of the device, so they must be created in advance.
Parameters | |
lu | the lu on whose behalf we execute |
node | the node on which to create the device |
instance:objects.Instance | the instance which owns the device |
device:objects.Disk | the device to create |
info | the extra 'metadata' we should attach to the device (this will be represented as a LVM tag) |
force | this parameter will be passes to the backend.BlockdevCreate function where it specifies whether we run on primary or not, and it affects both the child assembly and the device own Open() execution |
excl | Whether exclusive_storage is active for the node |
Return the instance disks selected by the disks list
Parameters | |
instance | Undocumented |
disks:list of objects.Disk or None | selected disks |
Returns | |
list of objects.Disk | selected instance disks to act on |
Generate the entire disk layout for a given template type.
Dumps an image onto an instance disk.
Parameters | |
lu:LogicalUnit | the logical unit on whose behalf we execute |
instance:objects.Instance | the instance whose disks we should create |
image:string | the image whose disks we should create |
disks:None or list of ints | disk indices |
Whether exclusive_storage is in effect for the given node.
Parameters | |
cfg:config.ConfigWriter | The cluster configuration |
node | The node UUID |
Returns | |
bool | The effective value of exclusive_storage |
Raises | |
errors.OpPrereqError | if no node exists with the given name |
Shutdown block devices of an instance.
This does the shutdown on all nodes of the instance.
If the ignore_primary is false, errors on the primary node are ignored.
Modifies the configuration of the instance, so the caller should re-read the instance configuration, if needed.
Start the disks of an instance.
Modifies the configuration of the instance, so the caller should re-read the instance configuration, if needed.
Wipes instance disks.
Parameters | |
lu:LogicalUnit | the logical unit on whose behalf we execute |
instance:objects.Instance | the instance whose disks we should create |
disks:None or list of tuple of (number, objects.Disk , number) | Disk details; tuple contains disk index, disk object and the start offset |
Wrapper for WipeDisks
that handles errors.
Parameters | |
lu:LogicalUnit | the logical unit on whose behalf we execute |
instance:objects.Instance | the instance whose disks we should wipe |
disks | see WipeDisks |
cleanup | the result returned by CreateDisks , used for cleanup in case of error |
Raises | |
errors.OpPrereqError | in case of failure |
Wrapper around call_blockdev_find to annotate diskparams.
Parameters | |
lu | A reference to the lu object |
node | The node to call out |
dev | The device to find |
instance | The instance object the device belongs to @returns The result of the rpc call |
Calculates the ETA based on size written and total size.
Parameters | |
time | The time taken so far |
written | amount written so far |
total | The total size of data to be written |
Returns | |
The remaining time in seconds |
Check that mirrors are not degraded.
Unknown Field: attention | |
The device has to be annotated already. The ldisk parameter, if True, will change the test from the is_degraded attribute (which represents overall non-ok status for the device(s)) to the ldisk (representing the local storage status). |
Checks if nodes have enough free disk space in the specified VG.
This function checks if all given nodes have the needed amount of free disk. In case any node has less disk or we cannot get the information from the node, this function raises an OpPrereqError exception.
Parameters | |
lu:LogicalUnit | a logical unit from which we get configuration data |
node | the list of node UUIDs to check |
vg:str | the volume group to check |
requested:int | the amount of disk in MiB to check for |
Raises | |
errors.OpPrereqError | if the node doesn't have enough disk, or we cannot check the node |
Checks the vg capacity for a given node.
Parameters | |
node | the name of the node |
node | the result of the node info call for one node |
vg:string | volume group name |
requested:int | the amount of disk in MiB to check for |
Raises | |
errors.OpPrereqError | if the node doesn't have enough disk, or we cannot check the node |
Create a tree of block devices on a given node.
If this device type has to be created on secondaries, create it and all its children.
If not, just recurse to children keeping the same 'force' value.
Parameters | |
lu | the lu on whose behalf we execute |
node | the node on which to create the device |
instance:objects.Instance | the instance which owns the device |
device:objects.Disk | the device to create |
force | whether to force creation of this device; this will be change to True whenever we find a device which has CreateOnSecondary() attribute |
info | the extra 'metadata' we should attach to the device (this will be represented as a LVM tag) |
force | this parameter will be passes to the backend.BlockdevCreate function where it specifies whether we run on primary or not, and it affects both the child assembly and the device own Open() execution |
excl | Whether exclusive_storage is active for the node |
Returns | |
list of created devices | |
Unknown Field: attention | |
The device has to be annotated already. |
Converts a disk size in bytes to mebibytes.
Warns and rounds up if the size isn't an even multiple of 1 MiB.
Generate a drbd8 device complete with its children.
Prepares the input and performs a node info call.
Parameters | |
lu:LogicalUnit | a logical unit from which we get configuration data |
node | list of node UUIDs to perform the call for |
vg:string | the volume group's name |
Shutdown block devices of an instance.
This function checks if an instance is running, before calling _ShutdownInstanceDisks.
Undo the work performed by CreateDisks
.
This function is called in case of an error to undo the work of CreateDisks
.
Parameters | |
lu:LogicalUnit | the logical unit on whose behalf we execute |
disks | the result returned by CreateDisks |
instance:objects.Instance | the instance for which disks were created |
Undocumented
Value |
|