|
1 |
{-| Implementation of Ganeti Lock field queries
|
|
2 |
|
|
3 |
The actual computation of the field values is done by forwarding
|
|
4 |
the request; so only have a minimal field definition here.
|
|
5 |
|
|
6 |
-}
|
|
7 |
|
|
8 |
{-
|
|
9 |
|
|
10 |
Copyright (C) 2014 Google Inc.
|
|
11 |
|
|
12 |
This program is free software; you can redistribute it and/or modify
|
|
13 |
it under the terms of the GNU General Public License as published by
|
|
14 |
the Free Software Foundation; either version 2 of the License, or
|
|
15 |
(at your option) any later version.
|
|
16 |
|
|
17 |
This program is distributed in the hope that it will be useful, but
|
|
18 |
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
20 |
General Public License for more details.
|
|
21 |
|
|
22 |
You should have received a copy of the GNU General Public License
|
|
23 |
along with this program; if not, write to the Free Software
|
|
24 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
25 |
02110-1301, USA.
|
|
26 |
|
|
27 |
-}
|
|
28 |
|
|
29 |
module Ganeti.Query.Locks
|
|
30 |
( fieldsMap
|
|
31 |
) where
|
|
32 |
|
|
33 |
import qualified Data.Map as Map
|
|
34 |
|
|
35 |
import Ganeti.Query.Common
|
|
36 |
import Ganeti.Query.Language
|
|
37 |
import Ganeti.Query.Types
|
|
38 |
|
|
39 |
-- | List of all lock fields.
|
|
40 |
lockFields :: FieldList String ()
|
|
41 |
lockFields =
|
|
42 |
[ (FieldDefinition "name" "Name" QFTOther "Lock name",
|
|
43 |
FieldSimple rsNormal, QffNormal)
|
|
44 |
, (FieldDefinition "mode" "Mode" QFTOther "Mode in which the lock is\
|
|
45 |
\ currently acquired\
|
|
46 |
\ (exclusive or shared)",
|
|
47 |
FieldSimple rsNormal, QffNormal)
|
|
48 |
, (FieldDefinition "owner" "Owner" QFTOther "Current lock owner(s)",
|
|
49 |
FieldSimple rsNormal, QffNormal)
|
|
50 |
, (FieldDefinition "pending" "Pending" QFTOther "Jobs waiting for the lock",
|
|
51 |
FieldSimple rsNormal, QffNormal)
|
|
52 |
]
|
|
53 |
|
|
54 |
-- | The lock fields map.
|
|
55 |
fieldsMap :: FieldMap String ()
|
|
56 |
fieldsMap =
|
|
57 |
Map.fromList $ map (\v@(f, _, _) -> (fdefName f, v)) lockFields
|