| Safe Haskell | None |
|---|
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
Xenmonad and provides a safe way to run anyXencomputation.
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
- data XcHandleOpenError = XcHandleOpenError Errno
- data InvalidDomainShutdownReason = InvalidDomainShutdownReason CInt
- data DomainGetInfoError = DomainGetInfoError Errno
- newtype DomId = DomId {}
- data DomainFlag
- data DomainShutdownReason
- data DomainInfo = DomainInfo {
- domainInfoId :: !DomId
- domainInfoSsidRef :: !Word32
- domainInfoFlags :: BitSet DomainFlag
- domainInfoShutdownReason :: Maybe DomainShutdownReason
- domainInfoNumberOfPages :: !Word32
- domainInfoNumberOfSharedPages :: !Word32
- domainInfoSharedInfoFrame :: !Word32
- domainInfoCpuTime :: !Word64
- domainInfoMaxMemKb :: !Word32
- domainInfoNubmerOfOnlineVcpus :: !Word32
- domainInfoMaxVcpuId :: !Word32
- domainInfoDomHandle :: UUID
- domainInfoCpuPool :: !Word32
- data Xen a
- domainGetInfo :: Xen [DomainInfo]
- runXen :: MonadBaseControl IO m => Xen a -> m (Either SomeException a)
Errors
data XcHandleOpenError Source
This error can be raised if handle can not be opened, insufficient rights for example.
Constructors
| XcHandleOpenError Errno |
data InvalidDomainShutdownReason Source
This error can be raised if peecked value of
DomainShutdownReason is not expected.
Constructors
| InvalidDomainShutdownReason CInt | Peeked value |
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.
Constructors
| DomainGetInfoError Errno |
Domain info
Domain id, wrapper around 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.
Constructors
| DomainFlagDying | |
| DomainFlagCrashed | |
| DomainFlagShutdown | |
| DomainFlagPaused | |
| DomainFlagBlocked | |
| DomainFlagRunning | |
| DomainFlagHVM | |
| DomainFlagDebugged |
Instances
data DomainShutdownReason Source
Domain shutdown reason it's only meaningful if domain has DomainFlagShutdown
flag.
Constructors
| DomainShutdownReasonPoweroff | |
| DomainShutdownReasonReboot | |
| DomainShutdownReasonSuspend | |
| DomainShutdownReasonCrash | |
| DomainShutdownReasonWatchdog |
Instances
| Eq DomainShutdownReason | |
| Ord DomainShutdownReason | |
| Show DomainShutdownReason | |
| Storable DomainShutdownReason | Constats used in this instance defined in xen/sched.h. |
data DomainInfo Source
Information about a single domain.
Constructors
Instances
High-level API
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.