Skip to content
Snippets Groups Projects
Commit d4de2ea8 authored by Michele Tartara's avatar Michele Tartara
Browse files

Export the actual instance state


Compute the actual state of the instance and export it.

Signed-off-by: default avatarMichele Tartara <mtartara@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent d7e9323b
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,7 @@ import Ganeti.Common
import Ganeti.DataCollectors.CLI
import Ganeti.DataCollectors.InstStatusTypes
import Ganeti.Hypervisor.Xen
import Ganeti.Hypervisor.Xen.Types
import Ganeti.Objects
import Ganeti.Utils
......@@ -89,11 +90,21 @@ buildStatus domains uptimes inst = do
currUInfo = idNum >>= (`Map.lookup` uptimes)
uptime = fmap uInfoUptime currUInfo
adminState = instAdminState inst
actualState =
if adminState == AdminDown && isNothing currDomain
then ActualShutdown
else case currDomain of
(Just dom@(Domain _ _ _ _ (Just isHung))) ->
if isHung
then ActualHung
else domState dom
_ -> ActualUnknown
return $
InstStatus
name
(instUuid inst)
adminState
actualState
uptime
(instMtime inst)
......
......@@ -29,6 +29,7 @@ module Ganeti.DataCollectors.InstStatusTypes
) where
import Ganeti.Hypervisor.Xen.Types
import Ganeti.Objects
import Ganeti.THH
......@@ -37,6 +38,7 @@ $(buildObject "InstStatus" "iStat"
[ simpleField "name" [t| String |]
, simpleField "uuid" [t| String |]
, simpleField "adminState" [t| AdminState |]
, simpleField "actualState" [t| ActualState |]
, optionalNullSerField $
simpleField "uptime" [t| String |]
, simpleField "mtime" [t| Double |]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment