diff --git a/src/Cluster.hs b/Ganeti/HTools/Cluster.hs similarity index 99% rename from src/Cluster.hs rename to Ganeti/HTools/Cluster.hs index 7b69ef5dced5aff609b3da78123787d8f8ec2b52..c7b73501f28cb8b223e0affe30c25dc2cc04f231 100644 --- a/src/Cluster.hs +++ b/Ganeti/HTools/Cluster.hs @@ -5,7 +5,7 @@ goes into the "Main" module. -} -module Cluster +module Ganeti.HTools.Cluster ( -- * Types NodeList @@ -38,10 +38,10 @@ import Data.Maybe (isNothing, fromJust) import Text.Printf (printf) import Data.Function -import qualified Container -import qualified Instance -import qualified Node -import Utils +import qualified Ganeti.HTools.Container as Container +import qualified Ganeti.HTools.Instance as Instance +import qualified Ganeti.HTools.Node as Node +import Ganeti.HTools.Utils type NodeList = Container.Container Node.Node type InstanceList = Container.Container Instance.Instance @@ -224,10 +224,10 @@ checkRemoval nl victims = -- | Computes the removals list for a given depth -computeRemovals :: Cluster.NodeList +computeRemovals :: NodeList -> [Instance.Instance] -> Int - -> [Maybe Cluster.Removal] + -> [Maybe Removal] computeRemovals nl bad_instances depth = map (checkRemoval nl) $ genNames depth bad_instances diff --git a/src/Container.hs b/Ganeti/HTools/Container.hs similarity index 98% rename from src/Container.hs rename to Ganeti/HTools/Container.hs index d728238451f436e84de58866a25f005d8e59fafd..0fb2c7f44d3f702f1d641031e1a9cfeb1412be02 100644 --- a/src/Container.hs +++ b/Ganeti/HTools/Container.hs @@ -5,7 +5,7 @@ give the best performance for our workload. -} -module Container +module Ganeti.HTools.Container ( -- * Types Container diff --git a/src/Instance.hs b/Ganeti/HTools/Instance.hs similarity index 98% rename from src/Instance.hs rename to Ganeti/HTools/Instance.hs index f29039aa2d4ffb9911ad6dad8d5ee26c99f3d78f..0e5d965cb6eb2683116370dfe0358153c4ddb08c 100644 --- a/src/Instance.hs +++ b/Ganeti/HTools/Instance.hs @@ -4,7 +4,7 @@ The instance data type holds very few fields, the algorithm intelligence is in the "Node" and "Cluster" modules. -} -module Instance where +module Ganeti.HTools.Instance where data Instance = Instance { mem :: Int -- ^ memory of the instance , dsk :: Int -- ^ disk size of instance diff --git a/src/Node.hs b/Ganeti/HTools/Node.hs similarity index 97% rename from src/Node.hs rename to Ganeti/HTools/Node.hs index 160136610e1984b7ef82d1e5cba1a7fcfa82baf7..e95a60d2e25de7e91b5708d02b881f26d74b64e7 100644 --- a/src/Node.hs +++ b/Ganeti/HTools/Node.hs @@ -4,7 +4,7 @@ updated value. -} -module Node +module Ganeti.HTools.Node ( Node(failN1, idx, f_mem, f_dsk, p_mem, p_dsk, slist, plist, p_rem) -- * Constructor @@ -26,11 +26,11 @@ module Node import Data.List import Text.Printf (printf) -import qualified Container -import qualified Instance -import qualified PeerMap +import qualified Ganeti.HTools.Container as Container +import qualified Ganeti.HTools.Instance as Instance +import qualified Ganeti.HTools.PeerMap as PeerMap -import Utils +import Ganeti.HTools.Utils data Node = Node { t_mem :: Double -- ^ total memory (Mib) , f_mem :: Int -- ^ free memory (MiB) diff --git a/src/PeerMap.hs b/Ganeti/HTools/PeerMap.hs similarity index 84% rename from src/PeerMap.hs rename to Ganeti/HTools/PeerMap.hs index 284fa70f61d3b2dbae31e7ccf46ff211b6a4f7c1..173c8c99239c7b5059d853c3593e05a4b8b2dd8a 100644 --- a/src/PeerMap.hs +++ b/Ganeti/HTools/PeerMap.hs @@ -7,19 +7,19 @@ implementation should be easy in case it's needed. -} -module PeerMap ( - PeerMap, - Key, - Elem, - empty, - create, - accumArray, - PeerMap.find, - add, - remove, - maxElem - ) - where +module Ganeti.HTools.PeerMap + ( + PeerMap, + Key, + Elem, + empty, + create, + accumArray, + Ganeti.HTools.PeerMap.find, + add, + remove, + maxElem + ) where import Data.Maybe (fromMaybe) import Data.List diff --git a/src/Rapi.hs b/Ganeti/HTools/Rapi.hs similarity index 98% rename from src/Rapi.hs rename to Ganeti/HTools/Rapi.hs index 263cf13f06c4c5f5bc7e8ea97c8568fdb28f39d6..e3523135285619c12678b4cddf432bf8487e543c 100644 --- a/src/Rapi.hs +++ b/Ganeti/HTools/Rapi.hs @@ -2,7 +2,7 @@ -} -module Rapi +module Ganeti.HTools.Rapi ( getNodes , getInstances @@ -16,7 +16,7 @@ import Data.Maybe import Control.Monad import Text.JSON import Text.Printf (printf) -import Utils () +import Ganeti.HTools.Utils () {-- Our cheap monad-like stuff. diff --git a/src/Utils.hs b/Ganeti/HTools/Utils.hs similarity index 96% rename from src/Utils.hs rename to Ganeti/HTools/Utils.hs index e092f72049be940142309d3867a11a16d62fc6f0..737b94a97b6f8175834a6773c57b1ec50725e46d 100644 --- a/src/Utils.hs +++ b/Ganeti/HTools/Utils.hs @@ -1,6 +1,6 @@ {-| Utility functions -} -module Utils where +module Ganeti.HTools.Utils where import Data.Either import Data.List @@ -10,7 +10,7 @@ import System import System.IO import System.Info import Text.Printf -import qualified Version +import qualified Ganeti.HTools.Version as Version import Debug.Trace diff --git a/src/Version.hs.in b/Ganeti/HTools/Version.hs.in similarity index 76% rename from src/Version.hs.in rename to Ganeti/HTools/Version.hs.in index 063bbd7b54e66341c9e5c75badc6d9cd251151ec..daffa76caf87badce789cafaf61dd4329587d712 100644 --- a/src/Version.hs.in +++ b/Ganeti/HTools/Version.hs.in @@ -1,4 +1,4 @@ -module Version +module Ganeti.HTools.Version ( version -- ^ the version of the tree ) where diff --git a/Makefile b/Makefile index 6f6254bbf86cf4a53f3574b200c7bdce8a3173f0..9f1f3834e4192f14451c1231bf3d362f883ce534 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,10 @@ HDDIR = apidoc # Haskell rules -all: version - $(MAKE) -C src +all: hbal hn1 + +hn1 hbal: Ganeti/HTools/Version.hs + ghc --make -O2 -W $@ README.html: README rst2html $< $@ @@ -25,16 +27,24 @@ doc: README.html $(HSRCS) clean: - rm -f *.o *.cmi *.cmo *.cmx *.old hn1 zn1 *.prof *.ps *.stat *.aux \ - gmon.out *.hi README.html TAGS version + rm -f *.o hn1 zn1 *.prof *.ps *.stat *.aux \ + gmon.out *.hi README.html TAGS Ganeti/HTools/Version.hs + git describe >/dev/null && rm -f version version: git describe > $@ +Ganeti/HTools/Version.hs: Ganeti/HTools/Version.hs.in version + sed -e "s/%ver%/$$(cat ../version)/" < $< > $@ + dist: version VN=$$(cat version|sed 's/^v//') ; \ ANAME="htools-$$VN.tar" ; \ - git archive --format=tar --prefix=htools-$$VN/ HEAD > $$ANAME ; \ - tar -r -f $$ANAME --transform="s,^,htools-$$VN/," version + rm -f $$ANAME $$ANAME.gz ; \ + git archive --format=tar --prefix=htools-$$VN/ HEAD > $$ANAME ; \ + tar -r -f $$ANAME --owner root --group root \ + --transform="s,^,htools-$$VN/," version ; \ + gzip -v9 $$ANAME ; \ + tar tzvf $$ANAME.gz .PHONY : all doc clean hn1 dist diff --git a/src/hbal.hs b/hbal.hs similarity index 97% rename from src/hbal.hs rename to hbal.hs index fea3f9ff55f0cda270ff95841edf30bbb49e8877..3d36700439206bfa92a67e24ff172acbfc96bc9e 100644 --- a/src/hbal.hs +++ b/hbal.hs @@ -14,11 +14,11 @@ import qualified System import Text.Printf (printf) -import qualified Container -import qualified Cluster -import qualified Version -import Rapi -import Utils +import qualified Ganeti.HTools.Container as Container +import qualified Ganeti.HTools.Cluster as Cluster +import qualified Ganeti.HTools.Version as Version +import Ganeti.HTools.Rapi +import Ganeti.HTools.Utils -- | Command line options structure. data Options = Options diff --git a/src/hn1.hs b/hn1.hs similarity index 96% rename from src/hn1.hs rename to hn1.hs index 2c8af7bbad92f032f59ab8b0920c7a8210907e00..754d926e2e7201d8f951dabd3b7bc669d82d3f40 100644 --- a/src/hn1.hs +++ b/hn1.hs @@ -14,12 +14,12 @@ import qualified System import Text.Printf (printf) -import qualified Container -import qualified Instance -import qualified Cluster -import qualified Version -import Utils -import Rapi +import qualified Ganeti.HTools.Container as Container +import qualified Ganeti.HTools.Instance as Instance +import qualified Ganeti.HTools.Cluster as Cluster +import qualified Ganeti.HTools.Version as Version +import Ganeti.HTools.Rapi +import Ganeti.HTools.Utils -- | Command line options structure. data Options = Options diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index aefd67b0cd6d2062b25944545fb29de1f4bff5f7..0000000000000000000000000000000000000000 --- a/src/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -all: hn1 hbal - -hn1: Version.hs - ghc --make -O2 -W hn1 - -hbal: Version.hs - ghc --make -O2 -W hbal - -clean: - rm -f *.o *.old hn1 hbal *.prof *.ps *.stat *.aux \ - *.hi README.html TAGS Version.hs - -Version.hs: Version.hs.in ../version - sed -e "s/%ver%/$$(cat ../version)/" < $< > $@ - -.PHONY : all clean hn1 hbal