Safe Haskell | None |
---|
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 anyXen
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
- 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.
data InvalidDomainShutdownReason Source
This error can be raised if peecked value of
DomainShutdownReason
is not expected.
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.
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
.
data DomainShutdownReason Source
Domain shutdown reason it's only meaningful if domain has DomainFlagShutdown
flag.
DomainShutdownReasonPoweroff | |
DomainShutdownReasonReboot | |
DomainShutdownReasonSuspend | |
DomainShutdownReasonCrash | |
DomainShutdownReasonWatchdog |
Eq DomainShutdownReason | |
Ord DomainShutdownReason | |
Read DomainShutdownReason | |
Show DomainShutdownReason | |
Storable DomainShutdownReason | Constats used in this instance defined in xen/sched.h. |
data DomainInfo Source
Information about a single domain.
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.