Commit 8eafdd51 authored by Klaus Aehlig's avatar Klaus Aehlig

Merge branch 'stable-2.12' into master

* stable-2.12
  Also clean up stale livelock files
  Add a function to list livelock files found on the system
  Change monitoring test invocation
  Make parallel performance rename test more serial
  Break up parallel performance QA tests
  Readd instance removal
  Set SO_REUSEADDR in ConfD
  Add systemd unit files to EXTRA_DIST

Conflicts:
	src/Ganeti/WConfd/DeathDetection.hs
Resolution:
	add newly added cleanup of stale files to
	cleanupLocksTask, leaving cleanupLocks
	unchanged.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarNiklas Hambuechen <niklash@google.com>
parents 9aba0357 6d5cede1
......@@ -1421,6 +1421,10 @@ EXTRA_DIST += \
doc/examples/gnt-debug/README \
doc/examples/gnt-debug/delay0.json \
doc/examples/gnt-debug/delay50.json \
doc/examples/systemd/ganeti-master.target \
doc/examples/systemd/ganeti-node.target \
doc/examples/systemd/ganeti.service \
doc/examples/systemd/ganeti.target \
doc/users/groupmemberships.in \
doc/users/groups.in \
doc/users/users.in \
......
......@@ -872,8 +872,17 @@ def RunInstanceTests():
def RunMonitoringTests():
if qa_config.TestEnabled("mon-collector"):
RunTest(qa_monitoring.TestInstStatusCollector)
RunTestIf("mon-collector", qa_monitoring.TestInstStatusCollector)
PARALLEL_TEST_DICT = {
"parallel-failover": qa_performance.TestParallelInstanceFailover,
"parallel-migration": qa_performance.TestParallelInstanceMigration,
"parallel-replace-disks": qa_performance.TestParallelInstanceReplaceDisks,
"parallel-reboot": qa_performance.TestParallelInstanceReboot,
"parallel-reinstall": qa_performance.TestParallelInstanceReinstall,
"parallel-rename": qa_performance.TestParallelInstanceRename,
}
def RunPerformanceTests():
......@@ -901,21 +910,20 @@ def RunPerformanceTests():
if qa_config.IsTemplateSupported(constants.DT_PLAIN):
RunTest(qa_performance.TestParallelPlainInstanceCreationPerformance)
if qa_config.IsTemplateSupported(constants.DT_DRBD8):
inodes = qa_config.AcquireManyNodes(2)
# Preparations need to be made only if some of these tests are enabled
if qa_config.IsTemplateSupported(constants.DT_DRBD8) and \
qa_config.TestEnabled(qa_config.Either(PARALLEL_TEST_DICT.keys())):
inodes = qa_config.AcquireManyNodes(2)
try:
instance = qa_instance.TestInstanceAddWithDrbdDisk(inodes)
try:
instance = qa_instance.TestInstanceAddWithDrbdDisk(inodes)
try:
RunTest(qa_performance.TestParallelInstanceFailover, instance)
RunTest(qa_performance.TestParallelInstanceMigration, instance)
RunTest(qa_performance.TestParallelInstanceReplaceDisks, instance)
RunTest(qa_performance.TestParallelInstanceReboot, instance)
RunTest(qa_performance.TestParallelInstanceReinstall, instance)
RunTest(qa_performance.TestParallelInstanceRename, instance)
finally:
instance.Release()
for (test_name, test_fn) in PARALLEL_TEST_DICT.items():
RunTestIf(test_name, test_fn, instance)
finally:
qa_config.ReleaseManyNodes(inodes)
instance.Release()
qa_instance.TestInstanceRemove(instance)
finally:
qa_config.ReleaseManyNodes(inodes)
def RunQa():
......
......@@ -545,7 +545,7 @@ def _TestInstanceOperationInParallelToInstanceCreation(*cmds):
return
job_id = _ExecuteJobSubmittingCmd(cmds[cmd_idx])
job_driver.AddJob(
job_id, running_fn=functools.partial(_SubmitNextCommand, cmd_idx + 1))
job_id, success_fn=functools.partial(_SubmitNextCommand, cmd_idx + 1))
assert qa_config.IsTemplateSupported(constants.DT_DRBD8)
assert len(cmds) > 0
......
......@@ -334,6 +334,7 @@ checkMain opts = do
prepMain :: PrepFn (S.Family, S.SockAddr) PrepResult
prepMain _ (af_family, bindaddr) = do
s <- S.socket af_family S.Datagram S.defaultProtocol
S.setSocketOption s S.ReuseAddr 1
S.bindSocket s bindaddr
cref <- newIORef (Bad "Configuration not yet loaded")
return (s, cref)
......
......@@ -35,13 +35,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
module Ganeti.Utils.Livelock
( Livelock
, mkLivelockFile
, listLiveLocks
, isDead
) where
import qualified Control.Exception as E
import Control.Monad
import Control.Monad.Error
import System.Directory (doesFileExist)
import System.Directory (doesFileExist, getDirectoryContents)
import System.FilePath.Posix ((</>))
import System.IO
import System.Posix.IO
import System.Posix.Types (Fd)
......@@ -49,7 +51,7 @@ import System.Time (ClockTime(..), getClockTime)
import Ganeti.BasicTypes
import Ganeti.Logging
import Ganeti.Path (livelockFile)
import Ganeti.Path (livelockFile, livelockDir)
import Ganeti.Utils (lockFile)
type Livelock = FilePath
......@@ -68,6 +70,16 @@ mkLivelockFile prefix = do
Ok fd -> return fd
return (fd, lockfile)
-- | List currently existing livelocks. Underapproximate if
-- some error occurs.
listLiveLocks :: IO [FilePath]
listLiveLocks =
fmap (genericResult (const [] :: IOError -> [FilePath]) id)
. runResultT . liftIO $ do
dir <- livelockDir
entries <- getDirectoryContents dir
filterM doesFileExist $ map (dir </>) entries
-- | Detect whether a the process identified by the given path
-- does not exist any more. This function never fails and only
-- returns True if it has positive knowledge that the process
......
......@@ -84,4 +84,14 @@ cleanupLocksTask :: WConfdMonadInt ()
cleanupLocksTask = forever . runResultT $ do
logDebug "Death detection timer fired"
cleanupLocks
remainingFiles <- liftIO listLiveLocks
logDebug $ "Livelockfiles remaining: " ++ show remainingFiles
let cleanupStaleIfDead fpath = do
died <- liftIO (isDead fpath)
when died $ do
logInfo $ "Cleaning up stale file " ++ fpath
_ <- liftIO . E.try $ removeFile fpath
:: WConfdMonad (Either IOError ())
return ()
mapM_ cleanupStaleIfDead remainingFiles
liftIO $ threadDelay cleanupInterval
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment