Revision 92678b3c htools/Ganeti/Luxi.hs
b/htools/Ganeti/Luxi.hs | ||
---|---|---|
27 | 27 |
|
28 | 28 |
module Ganeti.Luxi |
29 | 29 |
( LuxiOp(..) |
30 |
, QrViaLuxi(..) |
|
30 | 31 |
, Client |
31 | 32 |
, getClient |
32 | 33 |
, closeClient |
... | ... | |
46 | 47 |
import Ganeti.HTools.Utils |
47 | 48 |
import Ganeti.HTools.Types |
48 | 49 |
|
50 |
import Ganeti.Constants |
|
49 | 51 |
import Ganeti.Jobs (JobStatus) |
50 | 52 |
import Ganeti.OpCodes (OpCode) |
51 | 53 |
import Ganeti.THH |
... | ... | |
62 | 64 |
|
63 | 65 |
-- * Generic protocol functionality |
64 | 66 |
|
67 |
$(declareSADT "QrViaLuxi" |
|
68 |
[ ("QRLock", 'qrLock) |
|
69 |
, ("QRInstance", 'qrInstance) |
|
70 |
, ("QRNode", 'qrNode) |
|
71 |
, ("QRGroup", 'qrGroup) |
|
72 |
, ("QROs", 'qrOs) |
|
73 |
]) |
|
74 |
$(makeJSONInstance ''QrViaLuxi) |
|
75 |
|
|
65 | 76 |
-- | Currently supported Luxi operations and JSON serialization. |
66 | 77 |
$(genLuxiOp "LuxiOp" |
67 |
[ ("QueryNodes", |
|
78 |
[("Query" , |
|
79 |
[ ("what", [t| QrViaLuxi |], [| id |]) |
|
80 |
, ("fields", [t| [String] |], [| id |]) |
|
81 |
, ("filter", [t| Maybe (String, [[String]]) |], [| id |]) |
|
82 |
], SDict) |
|
83 |
, ("QueryNodes", |
|
68 | 84 |
[ ("names", [t| [String] |], [| id |]) |
69 | 85 |
, ("fields", [t| [String] |], [| id |]) |
70 | 86 |
, ("lock", [t| Bool |], [| id |]) |
71 |
]) |
|
87 |
], SList)
|
|
72 | 88 |
, ("QueryGroups", |
73 | 89 |
[ ("names", [t| [String] |], [| id |]) |
74 | 90 |
, ("fields", [t| [String] |], [| id |]) |
75 | 91 |
, ("lock", [t| Bool |], [| id |]) |
76 |
]) |
|
92 |
], SList)
|
|
77 | 93 |
, ("QueryInstances", |
78 | 94 |
[ ("names", [t| [String] |], [| id |]) |
79 | 95 |
, ("fields", [t| [String] |], [| id |]) |
80 | 96 |
, ("lock", [t| Bool |], [| id |]) |
81 |
]) |
|
97 |
], SList)
|
|
82 | 98 |
, ("QueryJobs", |
83 | 99 |
[ ("ids", [t| [Int] |], [| map show |]) |
84 | 100 |
, ("fields", [t| [String] |], [| id |]) |
85 |
]) |
|
101 |
], SList)
|
|
86 | 102 |
, ("QueryExports", |
87 | 103 |
[ ("nodes", [t| [String] |], [| id |]) |
88 | 104 |
, ("lock", [t| Bool |], [| id |]) |
89 |
]) |
|
105 |
], SList)
|
|
90 | 106 |
, ("QueryConfigValues", |
91 |
[ ("fields", [t| [String] |], [| id |]) ]) |
|
92 |
, ("QueryClusterInfo", []) |
|
107 |
[ ("fields", [t| [String] |], [| id |]) ], |
|
108 |
SList) |
|
109 |
, ("QueryClusterInfo", [], SList) |
|
93 | 110 |
, ("QueryTags", |
94 | 111 |
[ ("kind", [t| String |], [| id |]) |
95 | 112 |
, ("name", [t| String |], [| id |]) |
96 |
]) |
|
113 |
], SList)
|
|
97 | 114 |
, ("SubmitJob", |
98 |
[ ("job", [t| [OpCode] |], [| id |]) ]) |
|
115 |
[ ("job", [t| [OpCode] |], [| id |]) ], |
|
116 |
SList) |
|
99 | 117 |
, ("SubmitManyJobs", |
100 |
[ ("ops", [t| [[OpCode]] |], [| id |]) ]) |
|
118 |
[ ("ops", [t| [[OpCode]] |], [| id |]) ], |
|
119 |
SList) |
|
101 | 120 |
, ("WaitForJobChange", |
102 | 121 |
[ ("job", [t| Int |], [| id |]) |
103 | 122 |
, ("fields", [t| [String]|], [| id |]) |
104 | 123 |
, ("prev_job", [t| JSValue |], [| id |]) |
105 | 124 |
, ("prev_log", [t| JSValue |], [| id |]) |
106 | 125 |
, ("tmout", [t| Int |], [| id |]) |
107 |
]) |
|
126 |
], SList)
|
|
108 | 127 |
, ("ArchiveJob", |
109 |
[ ("job", [t| Int |], [| show |]) ]) |
|
128 |
[ ("job", [t| Int |], [| show |]) ], |
|
129 |
SList) |
|
110 | 130 |
, ("AutoArchiveJobs", |
111 | 131 |
[ ("age", [t| Int |], [| id |]) |
112 | 132 |
, ("tmout", [t| Int |], [| id |]) |
113 |
]) |
|
133 |
], SList)
|
|
114 | 134 |
, ("CancelJob", |
115 |
[("job", [t| Int |], [| show |]) ]) |
|
135 |
[("job", [t| Int |], [| show |]) ], |
|
136 |
SList) |
|
116 | 137 |
, ("SetDrainFlag", |
117 |
[ ("flag", [t| Bool |], [| id |]) ]) |
|
138 |
[ ("flag", [t| Bool |], [| id |]) ], |
|
139 |
SList) |
|
118 | 140 |
, ("SetWatcherPause", |
119 |
[ ("duration", [t| Double |], [| (: []) |]) ]) |
|
141 |
[ ("duration", [t| Double |], [| (: []) |]) ], |
|
142 |
SList) |
|
120 | 143 |
]) |
121 | 144 |
|
122 | 145 |
-- | The serialisation of LuxiOps into strings in messages. |
Also available in: Unified diff