Commit b9612abb authored by Iustin Pop's avatar Iustin Pop

Merge branch 'devel-2.6' into submit

* devel-2.6:
  Fix compatibility with newer Haskell libraries
  Fix gnt-instance console with xl

Conflicts:
        Makefile.am (reordering, fixed)
        htools/Ganeti/Confd/Server.hs (hlint fixes on master)
        htools/Ganeti/Daemon.hs (hlint)
        htools/Ganeti/HTools/Backend/Rapi.hs (hlint)
        htools/Ganeti/HTools/ExtLoader.hs (hlint)
        htools/Ganeti/HTools/QC.hs (file renamed/split in master, fixed)
        htools/test.hs (we don't use maxDiscards, ignored)
        lib/constants.py (move to pathutils)
        lib/hypervisor/hv_xen.py (move to pathutils)
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parents f9435bdc 27639c4e
......@@ -685,7 +685,7 @@ dist_tools_SCRIPTS = \
$(python_scripts) \
tools/kvm-console-wrapper \
tools/master-ip-setup \
tools/xm-console-wrapper
tools/xen-console-wrapper
nodist_tools_SCRIPTS = \
tools/vcluster-setup
......
......@@ -326,7 +326,8 @@ prop_AllocBalance =
forAll (choose (3, 5)) $ \count ->
not (Node.offline node) && not (Node.failN1 node) ==>
let nl = makeSmallCluster node count
(hnode, nl') = IntMap.deleteFindMax nl
hnode = snd $ IntMap.findMax nl
nl' = IntMap.deleteMax nl
il = Container.empty
allocnodes = Cluster.genAllocNodes defGroupList nl' 2 True
i_templ = createInstance Types.unitMem Types.unitDsk Types.unitCpu
......
......@@ -37,7 +37,6 @@ import Data.List
import qualified Data.Map as M
import Data.Maybe (fromMaybe)
import qualified Network.Socket as S
import Prelude hiding (catch)
import System.Posix.Files
import System.Posix.Types
import System.Time
......@@ -294,7 +293,8 @@ updateConfig path r = do
-- | Wrapper over 'updateConfig' that handles IO errors.
safeUpdateConfig :: FilePath -> FStat -> CRef -> IO (FStat, ConfigReload)
safeUpdateConfig path oldfstat cref =
catch (do
Control.Exception.catch
(do
nt <- needsReload oldfstat path
case nt of
Nothing -> return (oldfstat, ConfigToDate)
......@@ -418,7 +418,8 @@ onReloadInner inotiaction path cref
-- it will return False.
addNotifier :: INotify -> FilePath -> CRef -> MVar ServerState -> IO Bool
addNotifier inotify path cref mstate =
catch (addWatch inotify [CloseWrite] path
Control.Exception.catch
(addWatch inotify [CloseWrite] path
(onInotify inotify path cref mstate) >> return True)
(\e -> const (return False) (e::IOError))
......
......@@ -48,7 +48,6 @@ import Data.Maybe (fromMaybe)
import Data.Word
import GHC.IO.Handle (hDuplicateTo)
import qualified Network.Socket as Socket
import Prelude hiding (catch)
import System.Console.GetOpt
import System.Exit
import System.Environment
......@@ -200,7 +199,8 @@ formatIOError msg err = msg ++ ": " ++ show err
-- 'Bad' value.
writePidFile :: FilePath -> IO (Result Fd)
writePidFile path =
catch (fmap Ok $ _writePidFile path)
Control.Exception.catch
(fmap Ok $ _writePidFile path)
(return . Bad . formatIOError "Failure during writing of the pid file")
-- | Helper function to ensure a socket doesn't exist. Should only be
......@@ -271,8 +271,9 @@ parseAddress opts defport = do
def_family <- Ssconf.getPrimaryIPFamily Nothing
case optBindAddress opts of
Nothing -> return (def_family >>= defaultBindAddr port)
Just saddr -> catch (resolveAddr port saddr)
(annotateIOError $ "Invalid address " ++ saddr)
Just saddr -> Control.Exception.catch
(resolveAddr port saddr)
(annotateIOError $ "Invalid address " ++ saddr)
-- | Run an I/O action as a daemon.
--
......
......@@ -38,7 +38,6 @@ import Network.Curl
import Network.Curl.Types ()
#endif
import Control.Monad
import Prelude hiding (catch)
import Text.JSON (JSObject, fromJSObject, decodeStrict)
import Text.JSON.Types (JSValue(..))
import Text.Printf (printf)
......@@ -94,8 +93,8 @@ getUrl url = do
-- | Helper to convert I/O errors in 'Bad' values.
ioErrToResult :: IO a -> IO (Result a)
ioErrToResult ioaction =
catch (liftM Ok ioaction)
(\e -> return . Bad . show $ (e::IOException))
Control.Exception.catch (liftM Ok ioaction)
(\e -> return . Bad . show $ (e::IOException))
-- | Append the default port if not passed in.
formatHost :: String -> String
......
......@@ -36,7 +36,6 @@ module Ganeti.HTools.ExtLoader
import Control.Monad
import Control.Exception
import Data.Maybe (isJust, fromJust)
import Prelude hiding (catch)
import System.FilePath
import System.IO
import Text.Printf (hPrintf)
......
......@@ -40,7 +40,6 @@ import Control.Exception
import Control.Monad (liftM)
import Data.Char (isSpace)
import Data.Maybe (fromMaybe)
import Prelude hiding (catch)
import qualified Network.Socket as Socket
import System.FilePath ((</>))
import System.IO.Error (isDoesNotExistError)
......@@ -97,7 +96,8 @@ catchIOErrors :: Maybe a -- ^ Optional default
-> IO a -- ^ Action to run
-> IO (Result a)
catchIOErrors def action =
catch (do
Control.Exception.catch
(do
result <- action
return (Ok result)
) (\err -> let bad_result = Bad (show err)
......
......@@ -28,7 +28,6 @@ module Main (main) where
import Control.Exception
import Control.Monad (guard)
import Data.Char (toLower)
import Prelude hiding (catch)
import System.Environment
import System.IO
import System.IO.Error (isDoesNotExistError)
......
......@@ -423,8 +423,8 @@ class XenHypervisor(hv_base.BaseHypervisor):
kind=constants.CONS_SSH,
host=instance.primary_node,
user=constants.SSH_CONSOLE_USER,
command=[pathutils.XM_CONSOLE_WRAPPER,
instance.name])
command=[pathutils.XEN_CONSOLE_WRAPPER,
constants.XEN_CMD, instance.name])
def Verify(self):
"""Verify the hypervisor.
......
......@@ -44,7 +44,7 @@ IMPORT_EXPORT_DAEMON = _autoconf.PKGLIBDIR + "/import-export"
KVM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/kvm-console-wrapper"
KVM_IFUP = _autoconf.PKGLIBDIR + "/kvm-ifup"
PREPARE_NODE_JOIN = _autoconf.PKGLIBDIR + "/prepare-node-join"
XM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/xm-console-wrapper"
XEN_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/xen-console-wrapper"
ETC_HOSTS = vcluster.ETC_HOSTS
# Top-level paths
......
......@@ -18,7 +18,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
INSTANCE="$1"
XEN_CMD="$1"
INSTANCE="$2"
unpause() {
ispaused=$(xm list -l "$INSTANCE" 2>/dev/null |
......@@ -35,4 +36,4 @@ unpause() {
}
unpause &
exec xm console "$INSTANCE"
exec $XEN_CMD console "$INSTANCE"
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