Loader.hs: ignore expired ArSuspended policies
At the moment, because 'mergeData' is pure, it may set instance auto-repair policies that are of the form `ArSuspended $ Until timestamp_in_the_past`. If later on the auto-repair tool notices this, it has lost access to what would be the next-in-line policy to use (and would have to re-parse all tags again). To avoid this, we pass the current time to 'mergeData' from ExtLoader.hs, and we propagate it to Loader.getArPolicy. ExtLoader.loadExternalData is in the IO monad, so it has ready access to getClockTime. A few other places were calling 'mergeData' directly. For Hscan.hs and IAlloc.hs, we add appropriate calls to getClockTime. For files under test/, we use a current time of 0. Signed-off-by:Dato Simó <dato@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
Showing
- src/Ganeti/HTools/Backend/IAlloc.hs 7 additions, 4 deletionssrc/Ganeti/HTools/Backend/IAlloc.hs
- src/Ganeti/HTools/ExtLoader.hs 3 additions, 1 deletionsrc/Ganeti/HTools/ExtLoader.hs
- src/Ganeti/HTools/Loader.hs 17 additions, 15 deletionssrc/Ganeti/HTools/Loader.hs
- src/Ganeti/HTools/Program/Hscan.hs 6 additions, 4 deletionssrc/Ganeti/HTools/Program/Hscan.hs
- test/hs/Test/Ganeti/HTools/Backend/Text.hs 3 additions, 1 deletiontest/hs/Test/Ganeti/HTools/Backend/Text.hs
- test/hs/Test/Ganeti/HTools/Loader.hs 2 additions, 1 deletiontest/hs/Test/Ganeti/HTools/Loader.hs
Loading
Please register or sign in to comment