[Pkg-ganeti-devel] [ganeti] 65/165: Clean out old instances in Xen CPU load
Apollon Oikonomopoulos
apoikos at moszumanska.debian.org
Tue Aug 11 13:53:13 UTC 2015
This is an automated email from the git hooks/post-receive script.
apoikos pushed a commit to branch master
in repository ganeti.
commit 62cfd30d408241785ae8500b4dd07f6eb7e5e14b
Author: Klaus Aehlig <aehlig at google.com>
Date: Wed Feb 25 10:00:00 2015 +0100
Clean out old instances in Xen CPU load
If we don't find an instance in the output of xentop any
more that usually means it moved away. In this case, it might
be useful to still have the old CPU load as a best guess until
a new value is available on the new location. But after this
period, we should stop reporting usage information for that
instance.
Signed-off-by: Klaus Aehlig <aehlig at google.com>
Reviewed-by: Petr Pudlak <pudlak at google.com>
---
src/Ganeti/DataCollectors/XenCpuLoad.hs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/Ganeti/DataCollectors/XenCpuLoad.hs b/src/Ganeti/DataCollectors/XenCpuLoad.hs
index 897512d..2a66513 100644
--- a/src/Ganeti/DataCollectors/XenCpuLoad.hs
+++ b/src/Ganeti/DataCollectors/XenCpuLoad.hs
@@ -42,7 +42,7 @@ module Ganeti.DataCollectors.XenCpuLoad
, dcUpdate
) where
-import Control.Applicative ((<$>))
+import Control.Applicative ((<$>), liftA2)
import Control.Arrow ((***))
import Control.Monad (liftM, when)
import Control.Monad.IO.Class (liftIO)
@@ -141,7 +141,13 @@ dcUpdate maybeCollector = do
. (clockTimeToUSec now -)
. clockTimeToUSec . fst))
combinedValues
- return $ InstanceCpuLoad withinRange
+ withoutOld = Map.filter
+ (liftA2 (&&) (not . Seq.null)
+ $ (>) (fromIntegral $ C.xentopAverageThreshold * 1000000)
+ . (clockTimeToUSec now -) . clockTimeToUSec
+ . fst . flip Seq.index 0)
+ withinRange
+ return $ InstanceCpuLoad withoutOld
-- | From a list of timestamps and cumulative CPU data, compute the
-- average CPU activity in vCPUs.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ganeti/ganeti.git
More information about the Pkg-ganeti-devel
mailing list