On Fri, 28 Aug 2015 at 14:20 'Klaus Aehlig' via ganeti-devel <
[email protected]> wrote:

> In this way, all the magic tag prefixes specified in the design
> are together in one place, simplifying maintenance and avoiding
> inconsistencies.
>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  src/Ganeti/Constants.hs               | 8 ++++++++
>  src/Ganeti/MaintD/CollectIncidents.hs | 2 +-
>  src/Ganeti/MaintD/FailIncident.hs     | 3 ++-
>  3 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs
> index cf1a922..21a2f0e 100644
> --- a/src/Ganeti/Constants.hs
> +++ b/src/Ganeti/Constants.hs
> @@ -5442,3 +5442,11 @@ dataCollectorDiagnoseDirectory = sysconfdir ++
> "/ganeti/node-diagnose-commands"
>
>  exTagsPrefix :: String
>  exTagsPrefix = Tags.exTagsPrefix
> +
> +-- * MaintD tag prefixes
> +
> +maintdSuccessTagPrefix :: String
> +maintdSuccessTagPrefix = "maintd:repairready:"
> +
> +maintdFailureTagPrefix :: String
> +maintdFailureTagPrefix = "maintd:repairfailed:"
>

I'd suggest to make a constant for the 'maintd' prefix and composing the
others with it. But that's just a nit, your call.


> diff --git a/src/Ganeti/MaintD/CollectIncidents.hs
> b/src/Ganeti/MaintD/CollectIncidents.hs
> index fa5eb52..ece48bc 100644
> --- a/src/Ganeti/MaintD/CollectIncidents.hs
> +++ b/src/Ganeti/MaintD/CollectIncidents.hs
> @@ -104,7 +104,7 @@ updateNode memstate node = do
>              logInfo $ "Registering new incident on " ++ name ++ ": " ++
> origs
>              uuid <- liftIO newUUID
>              now <- liftIO getClockTime
> -            let tag = "maintd:repairready:" ++ uuid
> +            let tag = C.maintdSuccessTagPrefix ++ uuid
>                  incident = Incident { incidentOriginal = orig
>                                      , incidentAction = state
>                                      , incidentRepairStatus = RSNoted
> diff --git a/src/Ganeti/MaintD/FailIncident.hs
> b/src/Ganeti/MaintD/FailIncident.hs
> index c2d9db4..4f9a7b8 100644
> --- a/src/Ganeti/MaintD/FailIncident.hs
> +++ b/src/Ganeti/MaintD/FailIncident.hs
> @@ -47,6 +47,7 @@ import Data.IORef (IORef)
>  import System.IO.Error (tryIOError)
>
>  import Ganeti.BasicTypes (ResultT, mkResultT, GenericResult(..))
> +import qualified Ganeti.Constants as C
>  import Ganeti.JQueue (currentTimestamp)
>  import Ganeti.Jobs (execJobsWaitOkJid)
>  import Ganeti.Logging.Lifted
> @@ -63,7 +64,7 @@ import Ganeti.Types (JobId, fromJobId, TagKind(..))
>  markAsFailed :: IORef MemoryState -> Incident -> ResultT String IO ()
>  markAsFailed memstate incident = do
>    let uuid = incidentUuid incident
> -      newtag = "maintd:repairfailed:" ++ uuid
> +      newtag = C.maintdFailureTagPrefix ++ uuid
>    logInfo $ "Marking incident " ++ uuid ++ " as failed"
>    now <- liftIO currentTimestamp
>    luxiSocket <- liftIO Path.defaultQuerySocket
> --
> 2.5.0.457.gab17608
>
>
LGTM, thanks (no need to resend)
-- 

Helga Velroyen
Software Engineer
[email protected]

Google Germany GmbH
Dienerstraße 12
80331 München

Geschäftsführer: Graham Law, Christine Elizabeth Flores
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Diese E-Mail ist vertraulich. Wenn Sie nicht der richtige Adressat sind,
leiten Sie diese bitte nicht weiter, informieren Sie den Absender und
löschen Sie die E-Mail und alle Anhänge. Vielen Dank.

This e-mail is confidential. If you are not the right addressee please do
not forward it, please inform the sender, and please erase this e-mail
including any attachments. Thanks.

Reply via email to