ganeti

Safe HaskellNone

Ganeti.WConfd.Core

Contents

Description

The Ganeti WConfd core functions.

This module defines all the functions that WConfD exports for RPC calls. They are in a separate module so that in a later stage, TemplateHaskell can generate, e.g., the python interface for those.

Synopsis

Functions available to the RPC module

echo :: String -> WConfdMonad StringSource

Configuration related functions

readConfig :: WConfdMonad ConfigDataSource

Read the configuration.

writeConfig :: ClientId -> ConfigData -> WConfdMonad ()Source

Write the configuration, checking that an exclusive lock is held. If not, the call fails.

verifyConfig :: WConfdMonad ()Source

Explicitly run verification of the configuration. The caller doesn't need to hold the configuration lock.

Locks on the configuration (only transitional, will be removed later)

lockConfigSource

Arguments

:: ClientId 
-> Bool

set to True if the lock should be shared

-> WConfdMonad (MaybeForJSON ConfigData) 

Tries to acquire ConfigLock for the client. If the second parameter is set to True, the lock is acquired in shared mode.

If the lock was successfully acquired, returns the current configuration state.

unlockConfig :: ClientId -> WConfdMonad ()Source

Release the config lock, if the client currently holds it.

writeConfigAndUnlock :: ClientId -> ConfigData -> WConfdMonad BoolSource

Write the configuration, if the config lock is held exclusively, and release the config lock. It the caller does not have the config lock, return False.

flushConfig :: WConfdMonad ()Source

Force the distribution of configuration without actually modifying it. It is not necessary to hold a lock for this operation.

flushConfigGroup :: String -> WConfdMonad ()Source

Force the distribution of configuration to a given group without actually modifying it. It is not necessary to hold a lock for this operation.

Temporary reservations related functions

DRBD

MACs

DRBDSecrets

LVs

IPv4s

reserveIp :: ClientId -> NetworkUUID -> Ip4Address -> Bool -> WConfdMonad ()Source

Reserve a given IPv4 address for use by an instance.

releaseIp :: ClientId -> NetworkUUID -> Ip4Address -> WConfdMonad ()Source

Give a specific IP address back to an IP pool. The IP address is returned to the IP pool designated by network id and marked as reserved.

commitTemporaryIps :: ClientId -> WConfdMonad ()Source

Commit all reserved/released IP address to an IP pool. The IP addresses are taken from the network's IP pool and marked as reserved/free for instances.

Note that the reservations are kept, they are supposed to be cleaned when a job finishes.

commitReleaseTemporaryIp :: NetworkUUID -> Ip4Address -> WConfdMonad ()Source

Immediately release an IP address, without using the reservations pool.

listReservedIps :: ClientId -> WConfdMonad [IPv4Reservation]Source

List all IP reservations for the current client.

This function won't be needed once the corresponding calls are moved to WConfd.

Locking related functions

listLocks :: ClientId -> WConfdMonad [(GanetiLocks, OwnerState)]Source

List the locks of a given owner (i.e., a job-id lockfile pair).

listAllLocks :: WConfdMonad [GanetiLocks]Source

List all active locks.

listAllLocksOwners :: WConfdMonad [(GanetiLocks, [(ClientId, OwnerState)])]Source

List all active locks with their owners.

listLocksWaitingStatus :: WConfdMonad ([(GanetiLocks, [(ClientId, OwnerState)])], [(Integer, ClientId, [LockRequest GanetiLocks])])Source

Get full information of the lock waiting status, i.e., provide the information about all locks owners and all pending requests.

tryUpdateLocks :: ClientId -> GanetiLockRequest -> WConfdMonad [ClientId]Source

Try to update the locks of a given owner (i.e., a job-id lockfile pair). This function always returns immediately. If the lock update was possible, the empty list is returned; otherwise, the lock status is left completly unchanged, and the return value is the list of jobs which need to release some locks before this request can succeed.

updateLocksWaiting :: ClientId -> Integer -> GanetiLockRequest -> WConfdMonad [ClientId]Source

Try to update the locks of a given owner and make that a pending request if not immediately possible.

hasPendingRequest :: ClientId -> WConfdMonad BoolSource

Tell whether a given owner has pending requests.

freeLocks :: ClientId -> WConfdMonad ()Source

Free all locks of a given owner (i.e., a job-id lockfile pair).

freeLocksLevel :: ClientId -> LockLevel -> WConfdMonad ()Source

Free all locks of a given owner (i.e., a job-id lockfile pair) of a given level in the Ganeti sense (e.g., cluster, node).

downGradeLocksLevel :: ClientId -> LockLevel -> WConfdMonad ()Source

Downgrade all locks of the given level to shared.

intersectLocks :: ClientId -> [GanetiLocks] -> WConfdMonad ()Source

Intersect the possesed locks of an owner with a given set.

opportunisticLockUnion :: ClientId -> [(GanetiLocks, OwnerState)] -> WConfdMonad [GanetiLocks]Source

Opportunistically allocate locks for a given owner.

guardedOpportunisticLockUnion :: Int -> ClientId -> [(GanetiLocks, OwnerState)] -> WConfdMonad [GanetiLocks]Source

Opprtunistially allocate locks for a given owner, requesting a certain minimum of success.

Prepareation for cluster destruction

prepareClusterDestruction :: ClientId -> WConfdMonad ()Source

Prepare daemon for cluster destruction. This consists of verifying that the requester owns the BGL exclusively, transfering the BGL to WConfD itself, and modifying the configuration so that no node is the master any more. Note that, since we own the BGL exclusively, we can safely modify the configuration, as no other process can request changes.

The list of all functions exported to RPC.