import Ganeti.OpParams (pTagsObject)
import Ganeti.OpCodes
import qualified Ganeti.Query.Language as Qlang
+import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..))
import Ganeti.THH
import Ganeti.Types
+import Ganeti.Utils
-- * Utility functions
, simpleField "fields" [t| [String] |]
, simpleField "lock" [t| Bool |]
])
+ , (luxiReqQueryNetworks,
+ [ simpleField "names" [t| [String] |]
+ , simpleField "fields" [t| [String] |]
+ , simpleField "lock" [t| Bool |]
+ ])
, (luxiReqQueryInstances,
[ simpleField "names" [t| [String] |]
, simpleField "fields" [t| [String] |]
)
, (luxiReqQueryClusterInfo, [])
, (luxiReqQueryTags,
- [ pTagsObject ])
+ [ pTagsObject
+ , simpleField "name" [t| String |]
+ ])
, (luxiReqSubmitJob,
[ simpleField "job" [t| [MetaOpCode] |] ]
)
+ , (luxiReqSubmitJobToDrainedQueue,
+ [ simpleField "job" [t| [MetaOpCode] |] ]
+ )
, (luxiReqSubmitManyJobs,
[ simpleField "ops" [t| [[MetaOpCode]] |] ]
)
return Client { socket=h, rbuf=rf }
-- | Creates and returns a server endpoint.
-getServer :: FilePath -> IO S.Socket
-getServer path = do
+getServer :: Bool -> FilePath -> IO S.Socket
+getServer setOwner path = do
s <- S.socket S.AF_UNIX S.Stream S.defaultProtocol
S.bindSocket s (S.SockAddrUnix path)
+ when setOwner . setOwnerAndGroupFromNames path GanetiLuxid $
+ ExtraGroup DaemonsGroup
S.listen s 5 -- 5 is the max backlog
return s
return $ QueryGroups names fields locking
ReqQueryClusterInfo ->
return QueryClusterInfo
+ ReqQueryNetworks -> do
+ (names, fields, locking) <- fromJVal args
+ return $ QueryNetworks names fields locking
ReqQuery -> do
(what, fields, qfilter) <- fromJVal args
return $ Query what fields qfilter
[ops1] <- fromJVal args
ops2 <- mapM (fromJResult (luxiReqToRaw call) . J.readJSON) ops1
return $ SubmitJob ops2
+ ReqSubmitJobToDrainedQueue -> do
+ [ops1] <- fromJVal args
+ ops2 <- mapM (fromJResult (luxiReqToRaw call) . J.readJSON) ops1
+ return $ SubmitJobToDrainedQueue ops2
ReqSubmitManyJobs -> do
[ops1] <- fromJVal args
ops2 <- mapM (fromJResult (luxiReqToRaw call) . J.readJSON) ops1
return $ QueryConfigValues fields
ReqQueryTags -> do
(kind, name) <- fromJVal args
- item <- tagObjectFrom kind name
- return $ QueryTags item
+ return $ QueryTags kind name
ReqCancelJob -> do
[jid] <- fromJVal args
return $ CancelJob jid