ganeti-3.1: Cluster-based virtualization management software
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ganeti.WConfd.ConfigModifications

Description

The WConfd functions for direct configuration manipulation

This module contains the client functions exported by WConfD for specific configuration manipulation.

Synopsis

Documentation

type DiskUUID = String #

type InstanceUUID = String #

type NodeUUID = String #

accessor functions

getters

getAllLVs :: ConfigState -> Set String #

Gets all logical volumes in the cluster

getAllIDs :: ConfigState -> Set String #

Gets the ids of nodes, instances, node groups, networks, disks, nics, and the cluster itself.

getAllMACs :: ConfigState -> Set String #

isIdentical :: (Eq a, SerialNoObjectL a, TimeStampObjectL a) => ClockTime -> a -> a -> Bool #

Checks if the two objects are equal, excluding timestamps. The serial number of current must be one greater than that of target.

If this is true, it implies that the update RPC updated the config, but did not successfully return.

checkSerial :: SerialNoObject a => a -> a -> GenericResult GanetiException () #

Checks if the two objects given have the same serial number

replaceIn :: (UuidObject a, TimeStampObjectL a, SerialNoObjectL a) => ClockTime -> a -> Container a -> GenericResult GanetiException (Container a) #

Updates an object present in a container. The presence of the object in the container is determined by the uuid of the object.

A check that serial number of the object is consistent with the serial number of the object in the container is performed.

If the check passes, the object's serial number is incremented, and modification time is updated, and then is inserted into the container.

updateConfigIfNecessary :: (Monad m, MonadError GanetiException m, Eq a, UuidObject a, SerialNoObjectL a, TimeStampObjectL a) => ClockTime -> a -> (ConfigState -> Container a) -> (ConfigState -> m ((Int, ClockTime), ConfigState)) -> ConfigState -> m ((Int, ClockTime), ConfigState) #

Utility fuction that combines the two possible actions that could be taken when given a target.

If the target is identical to the current value, we return the modification time of the current value, and not change the config.

If not, we update the config.

UUID config checks

checkUUIDpresent :: UuidObject a => ConfigState -> a -> Bool #

Checks if the config has the given UUID

checkUniqueUUID :: UuidObject a => ConfigState -> a -> Bool #

Checks if the given UUID is new (i.e., no in the config)

RPC checks

addInstanceChecks :: Instance -> Bool -> ConfigState -> GenericResult GanetiException () #

Verifications done before adding an instance. Currently confirms that the instance's macs are not in use, and that the instance's UUID being present (or not present) in the config based on weather the instance is being replaced (or not).

TODO: add more verifications to this call; the client should have a lock on the name of the instance.

Pure config modifications functions

Monadic config modification functions which can return errors

RPCs

addInstance :: Instance -> ClientId -> Bool -> WConfdMonad Bool #

Add a new instance to the configuration, release DRBD minors, and commit temporary IPs, all while temporarily holding the config lock. Return True upon success and False if the config lock was not available and the client should retry.

detachInstanceDisk :: InstanceUUID -> DiskUUID -> WConfdMonad Bool #

Detach a disk from an instance.

removeInstanceDisk :: InstanceUUID -> DiskUUID -> WConfdMonad Bool #

Detach a disk from an instance and remove it from the config.

removeInstance :: InstanceUUID -> WConfdMonad Bool #

Remove the instance from the configuration.

allocatePort :: WConfdMonad (MaybeForJSON Int) #

Allocate a port. The port will be taken from the available port pool or from the default port range (and in this case we increase highest_used_port).

addTcpUdpPort :: Int -> WConfdMonad Bool #

Adds a new port to the available port pool.

setInstancePrimaryNode :: InstanceUUID -> NodeUUID -> WConfdMonad Bool #

Sets the primary node of an existing instance

updateCluster :: Cluster -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON)) #

The configuration is updated by the provided cluster

updateNode :: Node -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON)) #

The configuration is updated by the provided node

updateInstance :: Instance -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON)) #

The configuration is updated by the provided instance

updateNodeGroup :: NodeGroup -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON)) #

The configuration is updated by the provided nodegroup

updateNetwork :: Network -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON)) #

The configuration is updated by the provided network

updateDisk :: Disk -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON)) #

The configuration is updated by the provided disk

The list of functions exported to RPC.