ganeti

Ganeti.Hypervisor.Xen.XmParser

Description

Parser for the output of the xm list --long command of Xen

Synopsis

# Documentation

lispConfigParser :: Parser LispConfig Source #

A parser for parsing generic config files written in the (LISP-like) format that is the output of the xm list --long command. This parser only takes care of the syntactic parse, but does not care about the semantics. Note: parsing the double requires checking for the next character in order to prevent string like "9a" to be recognized as the number 9.

findConf :: String -> [LispConfig] -> Result LispConfig Source #

Find a configuration having the given string as its first element, from a list of configurations.

getValue :: FromLispConfig a => String -> [LispConfig] -> Result a Source #

Get the value of of a configuration having the given string as its first element. The value is the content of the configuration, discarding the name itself.

Extract the values of a configuration containing a list of them.

isNamed :: String -> LispConfig -> Bool Source #

Verify whether the given configuration has a certain name or not.fmap The name of a configuration is its first parameter, if it is a string.

parseState :: String -> ActualState Source #

Parser for recognising the current state of a Xen domain.

Extract the configuration data of a Xen domain from a generic LispConfig data structure. Fail if the LispConfig does not represent a domain.

xmListParser :: Parser (Map String Domain) Source #

A parser for parsing the output of the xm list --long command. It adds the semantic layer on top of lispConfigParser. It returns a map of domains, with their name as the key. FIXME: This is efficient under the assumption that only a few fields of the domain configuration are actually needed. If many of them are required, a parser able to directly extract the domain config would actually be better.

xmUptimeParser :: Parser (Map Int UptimeInfo) Source #

A parser for parsing the output of the xm uptime command.

uptimeLineParser :: Parser UptimeInfo Source #

A helper for parsing a single line of the xm uptime output.