Package ganeti :: Package cmdlib :: Module instance_storage :: Class TLReplaceDisks
[hide private]
[frames] | no frames]

Class TLReplaceDisks

source code


Replaces disks for an instance.

Note: Locking is not within the scope of this class.

Instance Methods [hide private]
 
__init__(self, lu, instance_uuid, instance_name, mode, iallocator_name, remote_node_uuid, disks, early_release, ignore_ipolicy)
Initializes this class.
source code
 
_FindFaultyDisks(self, node_uuid)
Wrapper for FindFaultyInstanceDisks.
source code
 
_CheckDisksActivated(self, instance)
Checks if the instance disks are activated.
source code
 
CheckPrereq(self)
Check prerequisites.
source code
 
Exec(self, feedback_fn)
Execute disk replacement.
source code
 
_CheckVolumeGroup(self, node_uuids) source code
 
_CheckDisksExistence(self, node_uuids) source code
 
_CheckDisksConsistency(self, node_uuid, on_primary, ldisk) source code
 
_CreateNewStorage(self, node_uuid)
Create new storage on the primary or secondary node.
source code
 
_CheckDevices(self, node_uuid, iv_names) source code
 
_RemoveOldStorage(self, node_uuid, iv_names) source code
 
_ExecDrbd8DiskOnly(self, feedback_fn)
Replace a disk on the primary or secondary for DRBD 8.
source code
 
_UpdateDisksSecondary(self, iv_names, feedback_fn)
Update the configuration of disks to have a new secondary.
source code
 
_ExecDrbd8Secondary(self, feedback_fn)
Replace the secondary node for DRBD 8.
source code

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

Static Methods [hide private]
 
_RunAllocator(lu, iallocator_name, instance_uuid, relocate_from_node_uuids)
Compute a new secondary node using an IAllocator.
source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, lu, instance_uuid, instance_name, mode, iallocator_name, remote_node_uuid, disks, early_release, ignore_ipolicy)
(Constructor)

source code 

Initializes this class.

Overrides: object.__init__

_CheckDisksActivated(self, instance)

source code 

Checks if the instance disks are activated.

Parameters:
  • instance - The instance to check disks
Returns:
True if they are activated, False otherwise

CheckPrereq(self)

source code 

Check prerequisites.

This checks that the instance is in the cluster.

Overrides: base.Tasklet.CheckPrereq

Exec(self, feedback_fn)

source code 

Execute disk replacement.

This dispatches the disk replacement to the appropriate handler.

Overrides: base.Tasklet.Exec

_CreateNewStorage(self, node_uuid)

source code 

Create new storage on the primary or secondary node.

This is only used for same-node replaces, not for changing the secondary node, hence we don't want to modify the existing disk.

_ExecDrbd8DiskOnly(self, feedback_fn)

source code 

Replace a disk on the primary or secondary for DRBD 8.

The algorithm for replace is quite complicated:

  1. for each disk to be replaced:
    1. create new LVs on the target node with unique names
    1. detach old LVs from the drbd device
    1. rename old LVs to name_replaced.<time_t>
    1. rename new LVs to old LVs
    1. attach the new LVs (with the old names now) to the drbd device
  1. wait for sync across all devices
  1. for each modified disk:
    1. remove old LVs (which have the name name_replaces.<time_t>)

Failures are not very well handled.

_UpdateDisksSecondary(self, iv_names, feedback_fn)

source code 

Update the configuration of disks to have a new secondary.

Parameters:
  • iv_names - iterable of triples for all volumes of the instance. The first component has to be the device and the third the logical id.
  • feedback_fn - function to used send feedback back to the caller of the OpCode

_ExecDrbd8Secondary(self, feedback_fn)

source code 

Replace the secondary node for DRBD 8.

The algorithm for replace is quite complicated:

  • for all disks of the instance:
    • create new LVs on the new node with same names
    • shutdown the drbd device on the old secondary
    • disconnect the drbd network on the primary
    • create the drbd device on the new secondary
    • network attach the drbd on the primary, using an artifice: the drbd code for Attach() will connect to the network if it finds a device which is connected to the good local disks but not network enabled
  • wait for sync across all devices
  • remove all disks from the old secondary

Failures are not very well handled.