LGTM, thanks.
On Mon, Oct 7, 2013 at 4:37 PM, Jose A. Lopes <[email protected]> wrote: > * move confd request related constants to 'Ganeti.ConstantUtils' so > they can be used in both 'Ganeti.HsConstants' and > 'Ganeti.Confd.Types' without circularity problems and GHC stage > restrictions. > > * fix some comments > > Signed-off-by: Jose A. Lopes <[email protected]> > --- > src/Ganeti/Confd/Types.hs | 18 +++++++++++------- > src/Ganeti/ConstantUtils.hs | 28 ++++++++++++++++++++++++---- > 2 files changed, 35 insertions(+), 11 deletions(-) > > diff --git a/src/Ganeti/Confd/Types.hs b/src/Ganeti/Confd/Types.hs > index f503c3d..60fd79e 100644 > --- a/src/Ganeti/Confd/Types.hs > +++ b/src/Ganeti/Confd/Types.hs > @@ -52,6 +52,7 @@ import Text.JSON > import qualified Network.Socket as S > > import qualified Ganeti.Constants as C > +import qualified Ganeti.ConstantUtils as ConstantUtils > import Ganeti.Hash > import Ganeti.THH > import Ganeti.Utils (newUUID) > @@ -95,14 +96,17 @@ $(makeJSONInstance ''ConfdReqField) > > $(buildObject "ConfdReqQ" "confdReqQ" > [ renameField "Ip" . > - optionalField $ simpleField C.confdReqqIp [t| String |] > + optionalField $ > + simpleField ConstantUtils.confdReqqIp [t| String |] > , renameField "IpList" . > - defaultField [| [] |] $ > - simpleField C.confdReqqIplist [t| [String] |] > - , renameField "Link" . optionalField $ > - simpleField C.confdReqqLink [t| String |] > - , renameField "Fields" . defaultField [| [] |] $ > - simpleField C.confdReqqFields [t| [ConfdReqField] |] > + defaultField [| [] |] $ > + simpleField ConstantUtils.confdReqqIplist [t| [String] |] > + , renameField "Link" . > + optionalField $ > + simpleField ConstantUtils.confdReqqLink [t| String |] > + , renameField "Fields" . > + defaultField [| [] |] $ > + simpleField ConstantUtils.confdReqqFields [t| [ConfdReqField] |] > ]) > > -- | Confd query type. This is complex enough that we can't > diff --git a/src/Ganeti/ConstantUtils.hs b/src/Ganeti/ConstantUtils.hs > index b14ab7f..02c9701 100644 > --- a/src/Ganeti/ConstantUtils.hs > +++ b/src/Ganeti/ConstantUtils.hs > @@ -66,7 +66,7 @@ instance PyValue Protocol where > > -- | Failure exit code > -- > --- This is defined here and not in 'Ganeti.HsConstants' together with > +-- These are defined here and not in 'Ganeti.HsConstants' together with > -- the other exit codes in order to avoid a circular dependency > -- between 'Ganeti.HsConstants' and 'Ganeti.Runtime' > exitFailure :: Int > @@ -88,11 +88,12 @@ devConsole = "/dev/console" > randomUuidFile :: String > randomUuidFile = "/proc/sys/kernel/random/uuid" > > --- | Priority levels > +-- * Priority levels > -- > --- This is defined here and not in 'Ganeti.Types' order to avoid a GHC > --- stage restriction and because there is no suitable 'declareADT' > +-- This is defined here and not in 'Ganeti.Types' in order to avoid a > +-- GHC stage restriction and because there is no suitable 'declareADT' > -- variant that handles integer values directly. > + > priorityLow :: Int > priorityLow = 10 > > @@ -107,3 +108,22 @@ priorityHigh = -10 > buildVersion :: Int -> Int -> Int -> Int > buildVersion major minor revision = > 1000000 * major + 10000 * minor + 1 * revision > + > +-- * Confd request query fields. > +-- > +-- These are defined here and not in 'Ganeti.Types' due to GHC stage > +-- restrictions concerning Template Haskell. They are also not > +-- defined in 'Ganeti.HsConstants' in order to avoid a circular > +-- dependency between that module and 'Ganeti.Types'. > + > +confdReqqLink :: String > +confdReqqLink = "0" > + > +confdReqqIp :: String > +confdReqqIp = "1" > + > +confdReqqIplist :: String > +confdReqqIplist = "2" > + > +confdReqqFields :: String > +confdReqqFields = "3" > -- > 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
