Just a quick question: I thought we only move those constants to Haskell which are at least used in Haskell too, but leave pure Python constants in Python. AFAIK, things like FIRST_DRBD_PORT are not used in Haskell at all (an probably won't be used there for the foreseeable future). So did you decide to just move all constants?
Rest LGTM, thanks. On Mon, Oct 7, 2013 at 4:37 PM, Jose A. Lopes <[email protected]> wrote: > Signed-off-by: Jose A. Lopes <[email protected]> > --- > lib/constants.py | 24 ++++++++++++------------ > src/Ganeti/HsConstants.hs | 41 ++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 52 insertions(+), 13 deletions(-) > > diff --git a/lib/constants.py b/lib/constants.py > index e5bdddb..fc8b99c 100644 > --- a/lib/constants.py > +++ b/lib/constants.py > @@ -100,14 +100,14 @@ CPU_PINNING_ALL_XEN = "0-63" > CPU_PINNING_ALL_KVM = 0xFFFFFFFF > > # Wipe > -DD_CMD = "dd" > -MAX_WIPE_CHUNK = 1024 # 1GB > -MIN_WIPE_CHUNK_PERCENT = 10 > - > -RUN_DIRS_MODE = 0775 > -SECURE_DIR_MODE = 0700 > -SECURE_FILE_MODE = 0600 > -ADOPTABLE_BLOCKDEV_ROOT = "/dev/disk/" > +DD_CMD = _constants.DD_CMD > +MAX_WIPE_CHUNK = _constants.MAX_WIPE_CHUNK > +MIN_WIPE_CHUNK_PERCENT = _constants.MIN_WIPE_CHUNK_PERCENT > + > +RUN_DIRS_MODE = _constants.RUN_DIRS_MODE > +SECURE_DIR_MODE = _constants.SECURE_DIR_MODE > +SECURE_FILE_MODE = _constants.SECURE_FILE_MODE > +ADOPTABLE_BLOCKDEV_ROOT = _constants.ADOPTABLE_BLOCKDEV_ROOT > ENABLE_CONFD = _constants.ENABLE_CONFD > ENABLE_MOND = _constants.ENABLE_MOND > ENABLE_SPLIT_QUERY = _constants.ENABLE_SPLIT_QUERY > @@ -133,8 +133,8 @@ DEFAULT_CONFD_PORT = _constants.DEFAULT_CONFD_PORT > DEFAULT_MOND_PORT = _constants.DEFAULT_MOND_PORT > DEFAULT_RAPI_PORT = _constants.DEFAULT_RAPI_PORT > > -FIRST_DRBD_PORT = 11000 > -LAST_DRBD_PORT = 14999 > +FIRST_DRBD_PORT = _constants.FIRST_DRBD_PORT > +LAST_DRBD_PORT = _constants.LAST_DRBD_PORT > > DAEMONS_LOGBASE = _constants.DAEMONS_LOGBASE > > @@ -2252,8 +2252,8 @@ DISKSTATS_FILE = _constants.DISKSTATS_FILE > > # CPU load collector variables > STAT_FILE = _constants.STAT_FILE > -CPUAVGLOAD_BUFFER_SIZE = 150 > -CPUAVGLOAD_WINDOW_SIZE = 600 > +CPUAVGLOAD_BUFFER_SIZE = _constants.CPUAVGLOAD_BUFFER_SIZE > +CPUAVGLOAD_WINDOW_SIZE = _constants.CPUAVGLOAD_WINDOW_SIZE > > # Mond's variable for periodical data collection > MOND_TIME_INTERVAL = _constants.MOND_TIME_INTERVAL > diff --git a/src/Ganeti/HsConstants.hs b/src/Ganeti/HsConstants.hs > index c56de77..a4f4ab7 100644 > --- a/src/Ganeti/HsConstants.hs > +++ b/src/Ganeti/HsConstants.hs > @@ -208,6 +208,32 @@ sshLoginUser = AutoConf.sshLoginUser > sshConsoleUser :: String > sshConsoleUser = AutoConf.sshConsoleUser > > +-- * Wipe > + > +ddCmd :: String > +ddCmd = "dd" > + > +-- | 1GB > +maxWipeChunk :: Int > +maxWipeChunk = 1024 > + > +minWipeChunkPercent :: Int > +minWipeChunkPercent = 10 > + > +-- * Directories > + > +runDirsMode :: Int > +runDirsMode = 0o775 > + > +secureDirMode :: Int > +secureDirMode = 0o700 > + > +secureFileMode :: Int > +secureFileMode = 0o600 > + > +adoptableBlockdevRoot :: String > +adoptableBlockdevRoot = "/dev/disk/" > + > -- * 'autoconf' enable/disable > > enableConfd :: Bool > @@ -279,6 +305,12 @@ daemonsPorts = > (rapi, (Tcp, defaultRapiPort)), > (ssh, (Tcp, 22))] > > +firstDrbdPort :: Int > +firstDrbdPort = 11000 > + > +lastDrbdPort :: Int > +lastDrbdPort = 14999 > + > daemonsLogbase :: Map String String > daemonsLogbase = > Map.fromList > @@ -1479,10 +1511,17 @@ opcodeReason = "reason" > diskstatsFile :: String > diskstatsFile = "/proc/diskstats" > > --- | CPU load collector > +-- * CPU load collector > + > statFile :: String > statFile = "/proc/stat" > > +cpuavgloadBufferSize :: Int > +cpuavgloadBufferSize = 150 > + > +cpuavgloadWindowSize :: Int > +cpuavgloadWindowSize = 600 > + > -- | Mond's variable for periodical data collection > mondTimeInterval :: Int > mondTimeInterval = 5 > -- > 1.8.4 > > -- Thomas Thrainer | Software Engineer | [email protected] | Google Germany GmbH Dienerstr. 12 80331 München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores
