{-
-Copyright (C) 2009 Google Inc.
+Copyright (C) 2009, 2010 Google Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
, opID
) where
-import Data.List
import Control.Monad
-import Text.JSON (JSObject, JSValue, readJSON, showJSON, makeObj, JSON)
+import Text.JSON (readJSON, showJSON, makeObj, JSON)
import qualified Text.JSON as J
import Text.JSON.Types
| ReplaceOnSecondary
| ReplaceNewSecondary
| ReplaceAuto
- deriving Show
+ deriving (Show, Read, Eq)
instance JSON ReplaceDisksMode where
showJSON m = case m of
[Int] (Maybe String)
| OpFailoverInstance String Bool
| OpMigrateInstance String Bool Bool
- deriving Show
+ deriving (Show, Read, Eq)
opID :: OpCode -> String
return $ OpTestDelay duration on_master on_nodes
"OP_INSTANCE_REPLACE_DISKS" -> do
inst <- fromObj "instance_name" o
- node <- fromObj "remote_node" o
+ node <- maybeFromObj "remote_node" o
mode <- fromObj "mode" o
disks <- fromObj "disks" o
- ialloc <- fromObj "iallocator" o
+ ialloc <- maybeFromObj "iallocator" o
return $ OpReplaceDisks inst node mode disks ialloc
"OP_INSTANCE_FAILOVER" -> do
inst <- fromObj "instance_name" o