hen-0.0.2: Haskell bindings to Xen hypervisor interface

Safe HaskellNone

System.Xen

Contents

Description

Haskell bidings to Xen hypervisor interface. There are three interface levels in this library:

  • Low-level interface. System.Xen.Low. It just provides bindings to c-calls.
  • Mid-level interface. System.Xen.Mid. Contains helper functions and allow to use your favorite Monad.
  • High-level interface. System.Xen.High. Contains Xen monad and provides a safe way to run any Xen computation.

Last one is also re-exported by current module and intend for common usage. Usage example:

 module Main (main) where

 import System.Xen (runXen, domainGetInfo)

 main :: IO ()
 main = print =<< runXen domainGetInfo

Synopsis

Errors

data XcHandleOpenError Source

This error can be raised if handle can not be opened, insufficient rights for example.

Constructors

XcHandleOpenError Errno 

data DomainGetInfoError Source

This error can be raised if any error occured during receiving the list, for example: try to to fetch a list in domU.

Domain info

newtype DomId Source

Domain id, wrapper around Word32.

Constructors

DomId 

Fields

unDomId :: Word32
 

data DomainFlag Source

Domain flags. It's translated from xc_dominfo structure, so it's possible to be mutual exclusion flags in one domain, e.g. DomainFlagShutdown and DomainFlagRunning.

High-level API

data Xen a Source

This is a special monad for operations with XenCtrl, it's a wrapper around ReaderT transformer and it controls the connection to the hypervisor. Because Xen has instances of and MonadBase and MonadBaseControl over IO, you can use any functions of lifted-base library, or any IO with liftBase.

domainGetInfo :: Xen [DomainInfo]Source

Returns a lift of domains, this function can fail with InvalidDomainShutdownReason and DomainGetInfoError.

runXen :: MonadBaseControl IO m => Xen a -> m (Either SomeException a)Source

Open new connection to the hypervisor, run any Xen action and close connection if nessesary. This function can fail with Either SomeException with XcHandleOpenError and any error of providing Xen action.