Safe Haskell | None |
---|
The WConfd functions for direct configuration manipulation
This module contains the client functions exported by WConfD for specific configuration manipulation.
- type DiskUUID = String
- type InstanceUUID = String
- type NodeUUID = String
- getInstanceByUUID :: ConfigState -> InstanceUUID -> GenericResult GanetiException Instance
- getAllLVs :: ConfigState -> Set String
- getAllIDs :: ConfigState -> Set String
- getAllMACs :: ConfigState -> Set String
- isIdentical :: (Eq a, SerialNoObjectL a, TimeStampObjectL a) => ClockTime -> a -> a -> Bool
- checkSerial :: SerialNoObject a => a -> a -> GenericResult GanetiException ()
- replaceIn :: (UuidObject a, TimeStampObjectL a, SerialNoObjectL a) => ClockTime -> a -> Container a -> GenericResult GanetiException (Container a)
- 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)
- checkUUIDpresent :: UuidObject a => ConfigState -> a -> Bool
- checkUniqueUUID :: UuidObject a => ConfigState -> a -> Bool
- addInstanceChecks :: Instance -> Bool -> ConfigState -> GenericResult GanetiException ()
- addDiskChecks :: Disk -> Bool -> ConfigState -> GenericResult GanetiException ()
- attachInstanceDiskChecks :: InstanceUUID -> DiskUUID -> MaybeForJSON Int -> ConfigState -> GenericResult GanetiException ()
- attachInstanceDisk' :: InstanceUUID -> DiskUUID -> MaybeForJSON Int -> ClockTime -> ConfigState -> ConfigState
- detachInstanceDisk' :: MonadError GanetiException m => InstanceUUID -> DiskUUID -> ClockTime -> ConfigState -> m ConfigState
- removeInstanceDisk' :: MonadError GanetiException m => InstanceUUID -> DiskUUID -> ClockTime -> ConfigState -> m ConfigState
- addInstance :: Instance -> ClientId -> Bool -> WConfdMonad Bool
- addInstanceDisk :: InstanceUUID -> Disk -> MaybeForJSON Int -> Bool -> WConfdMonad Bool
- attachInstanceDisk :: InstanceUUID -> DiskUUID -> MaybeForJSON Int -> WConfdMonad Bool
- detachInstanceDisk :: InstanceUUID -> DiskUUID -> WConfdMonad Bool
- removeInstanceDisk :: InstanceUUID -> DiskUUID -> WConfdMonad Bool
- removeInstance :: InstanceUUID -> WConfdMonad Bool
- allocatePort :: WConfdMonad (MaybeForJSON Int)
- addTcpUdpPort :: Int -> WConfdMonad Bool
- setInstanceStatus :: InstanceUUID -> MaybeForJSON AdminState -> MaybeForJSON Bool -> MaybeForJSON AdminStateSource -> WConfdMonad (MaybeForJSON Instance)
- setInstancePrimaryNode :: InstanceUUID -> NodeUUID -> WConfdMonad Bool
- updateCluster :: Cluster -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON))
- updateNode :: Node -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON))
- updateInstance :: Instance -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON))
- updateNodeGroup :: NodeGroup -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON))
- updateNetwork :: Network -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON))
- updateDisk :: Disk -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON))
- exportedFunctions :: [Name]
Documentation
type InstanceUUID = StringSource
accessor functions
getters
getAllLVs :: ConfigState -> Set StringSource
Gets all logical volumes in the cluster
getAllIDs :: ConfigState -> Set StringSource
Gets the ids of nodes, instances, node groups, networks, disks, nics, and the cluster itself.
getAllMACs :: ConfigState -> Set StringSource
isIdentical :: (Eq a, SerialNoObjectL a, TimeStampObjectL a) => ClockTime -> a -> a -> BoolSource
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 ()Source
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)Source
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)Source
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 -> BoolSource
Checks if the config has the given UUID
checkUniqueUUID :: UuidObject a => ConfigState -> a -> BoolSource
Checks if the given UUID is new (i.e., no in the config)
RPC checks
addInstanceChecks :: Instance -> Bool -> ConfigState -> GenericResult GanetiException ()Source
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.
addDiskChecks :: Disk -> Bool -> ConfigState -> GenericResult GanetiException ()Source
attachInstanceDiskChecks :: InstanceUUID -> DiskUUID -> MaybeForJSON Int -> ConfigState -> GenericResult GanetiException ()Source
Pure config modifications functions
attachInstanceDisk' :: InstanceUUID -> DiskUUID -> MaybeForJSON Int -> ClockTime -> ConfigState -> ConfigStateSource
Monadic config modification functions which can return errors
detachInstanceDisk' :: MonadError GanetiException m => InstanceUUID -> DiskUUID -> ClockTime -> ConfigState -> m ConfigStateSource
removeInstanceDisk' :: MonadError GanetiException m => InstanceUUID -> DiskUUID -> ClockTime -> ConfigState -> m ConfigStateSource
RPCs
addInstance :: Instance -> ClientId -> Bool -> WConfdMonad BoolSource
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.
addInstanceDisk :: InstanceUUID -> Disk -> MaybeForJSON Int -> Bool -> WConfdMonad BoolSource
attachInstanceDisk :: InstanceUUID -> DiskUUID -> MaybeForJSON Int -> WConfdMonad BoolSource
detachInstanceDisk :: InstanceUUID -> DiskUUID -> WConfdMonad BoolSource
Detach a disk from an instance.
removeInstanceDisk :: InstanceUUID -> DiskUUID -> WConfdMonad BoolSource
Detach a disk from an instance and remove it from the config.
removeInstance :: InstanceUUID -> WConfdMonad BoolSource
Remove the instance from the configuration.
allocatePort :: WConfdMonad (MaybeForJSON Int)Source
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 BoolSource
Adds a new port to the available port pool.
setInstanceStatus :: InstanceUUID -> MaybeForJSON AdminState -> MaybeForJSON Bool -> MaybeForJSON AdminStateSource -> WConfdMonad (MaybeForJSON Instance)Source
Set the instances' status to a given value.
setInstancePrimaryNode :: InstanceUUID -> NodeUUID -> WConfdMonad BoolSource
Sets the primary node of an existing instance
updateCluster :: Cluster -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON))Source
The configuration is updated by the provided cluster
updateNode :: Node -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON))Source
The configuration is updated by the provided node
updateInstance :: Instance -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON))Source
The configuration is updated by the provided instance
updateNodeGroup :: NodeGroup -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON))Source
The configuration is updated by the provided nodegroup
updateNetwork :: Network -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON))Source
The configuration is updated by the provided network
updateDisk :: Disk -> WConfdMonad (MaybeForJSON (Int, TimeAsDoubleJSON))Source
The configuration is updated by the provided disk
The list of functions exported to RPC.
exportedFunctions :: [Name]Source