root / htools / Ganeti / OpCodes.hs @ 57fb6fcb
History | View | Annotate | Download (12.5 kB)
1 | e9aaa3c6 | Iustin Pop | {-# LANGUAGE TemplateHaskell #-} |
---|---|---|---|
2 | e9aaa3c6 | Iustin Pop | |
3 | 702a4ee0 | Iustin Pop | {-| Implementation of the opcodes. |
4 | 702a4ee0 | Iustin Pop | |
5 | 702a4ee0 | Iustin Pop | -} |
6 | 702a4ee0 | Iustin Pop | |
7 | 702a4ee0 | Iustin Pop | {- |
8 | 702a4ee0 | Iustin Pop | |
9 | a583ec5d | Iustin Pop | Copyright (C) 2009, 2010, 2011, 2012 Google Inc. |
10 | 702a4ee0 | Iustin Pop | |
11 | 702a4ee0 | Iustin Pop | This program is free software; you can redistribute it and/or modify |
12 | 702a4ee0 | Iustin Pop | it under the terms of the GNU General Public License as published by |
13 | 702a4ee0 | Iustin Pop | the Free Software Foundation; either version 2 of the License, or |
14 | 702a4ee0 | Iustin Pop | (at your option) any later version. |
15 | 702a4ee0 | Iustin Pop | |
16 | 702a4ee0 | Iustin Pop | This program is distributed in the hope that it will be useful, but |
17 | 702a4ee0 | Iustin Pop | WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | 702a4ee0 | Iustin Pop | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19 | 702a4ee0 | Iustin Pop | General Public License for more details. |
20 | 702a4ee0 | Iustin Pop | |
21 | 702a4ee0 | Iustin Pop | You should have received a copy of the GNU General Public License |
22 | 702a4ee0 | Iustin Pop | along with this program; if not, write to the Free Software |
23 | 702a4ee0 | Iustin Pop | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
24 | 702a4ee0 | Iustin Pop | 02110-1301, USA. |
25 | 702a4ee0 | Iustin Pop | |
26 | 702a4ee0 | Iustin Pop | -} |
27 | 702a4ee0 | Iustin Pop | |
28 | 702a4ee0 | Iustin Pop | module Ganeti.OpCodes |
29 | ebf38064 | Iustin Pop | ( OpCode(..) |
30 | 367c4241 | Dato Simó | , TagObject(..) |
31 | d8e7c45e | Iustin Pop | , tagObjectFrom |
32 | d8e7c45e | Iustin Pop | , encodeTagObject |
33 | d8e7c45e | Iustin Pop | , decodeTagObject |
34 | ebf38064 | Iustin Pop | , ReplaceDisksMode(..) |
35 | 4a1dc2bf | Iustin Pop | , DiskIndex |
36 | 4a1dc2bf | Iustin Pop | , mkDiskIndex |
37 | 4a1dc2bf | Iustin Pop | , unDiskIndex |
38 | ebf38064 | Iustin Pop | , opID |
39 | a583ec5d | Iustin Pop | , allOpIDs |
40 | 3929e782 | Iustin Pop | , allOpFields |
41 | 4a826364 | Iustin Pop | , CommonOpParams(..) |
42 | 4a826364 | Iustin Pop | , defOpParams |
43 | 4a826364 | Iustin Pop | , MetaOpCode(..) |
44 | 4a826364 | Iustin Pop | , wrapOpCode |
45 | 4a826364 | Iustin Pop | , setOpComment |
46 | ebf38064 | Iustin Pop | ) where |
47 | 702a4ee0 | Iustin Pop | |
48 | 4a826364 | Iustin Pop | import Text.JSON (readJSON, showJSON, JSON, JSValue, makeObj) |
49 | 4a826364 | Iustin Pop | import qualified Text.JSON |
50 | 702a4ee0 | Iustin Pop | |
51 | 12c19659 | Iustin Pop | import Ganeti.THH |
52 | e9aaa3c6 | Iustin Pop | |
53 | 92f51573 | Iustin Pop | import Ganeti.OpParams |
54 | 4a826364 | Iustin Pop | import Ganeti.Types (OpSubmitPriority(..)) |
55 | 4a1dc2bf | Iustin Pop | |
56 | 525bfb36 | Iustin Pop | -- | OpCode representation. |
57 | 525bfb36 | Iustin Pop | -- |
58 | 3bebda52 | Dato Simó | -- We only implement a subset of Ganeti opcodes: those which are actually used |
59 | 3bebda52 | Dato Simó | -- in the htools codebase. |
60 | 12c19659 | Iustin Pop | $(genOpCode "OpCode" |
61 | ebf38064 | Iustin Pop | [ ("OpTestDelay", |
62 | 7d421386 | Iustin Pop | [ pDelayDuration |
63 | 7d421386 | Iustin Pop | , pDelayOnMaster |
64 | 7d421386 | Iustin Pop | , pDelayOnNodes |
65 | a451dae2 | Iustin Pop | , pDelayRepeat |
66 | ebf38064 | Iustin Pop | ]) |
67 | ebf38064 | Iustin Pop | , ("OpInstanceReplaceDisks", |
68 | 92f51573 | Iustin Pop | [ pInstanceName |
69 | 3d7e87b8 | Iustin Pop | , pEarlyRelease |
70 | 3d7e87b8 | Iustin Pop | , pIgnoreIpolicy |
71 | 7d421386 | Iustin Pop | , pReplaceDisksMode |
72 | 7d421386 | Iustin Pop | , pReplaceDisksList |
73 | 3d7e87b8 | Iustin Pop | , pRemoteNode |
74 | c7d249d0 | Iustin Pop | , pIallocator |
75 | ebf38064 | Iustin Pop | ]) |
76 | ebf38064 | Iustin Pop | , ("OpInstanceFailover", |
77 | 92f51573 | Iustin Pop | [ pInstanceName |
78 | 3d7e87b8 | Iustin Pop | , pShutdownTimeout |
79 | 7d421386 | Iustin Pop | , pIgnoreConsistency |
80 | c7d249d0 | Iustin Pop | , pMigrationTargetNode |
81 | 3d7e87b8 | Iustin Pop | , pIgnoreIpolicy |
82 | 3d7e87b8 | Iustin Pop | , pIallocator |
83 | ebf38064 | Iustin Pop | ]) |
84 | ebf38064 | Iustin Pop | , ("OpInstanceMigrate", |
85 | 92f51573 | Iustin Pop | [ pInstanceName |
86 | 3d7e87b8 | Iustin Pop | , pMigrationMode |
87 | f9556d33 | Iustin Pop | , pMigrationLive |
88 | 3d7e87b8 | Iustin Pop | , pMigrationTargetNode |
89 | 3d7e87b8 | Iustin Pop | , pAllowRuntimeChgs |
90 | 3d7e87b8 | Iustin Pop | , pIgnoreIpolicy |
91 | 7d421386 | Iustin Pop | , pMigrationCleanup |
92 | 3d7e87b8 | Iustin Pop | , pIallocator |
93 | 7d421386 | Iustin Pop | , pAllowFailover |
94 | ebf38064 | Iustin Pop | ]) |
95 | a451dae2 | Iustin Pop | , ("OpTagsGet", |
96 | a451dae2 | Iustin Pop | [ pTagsObject |
97 | a451dae2 | Iustin Pop | , pUseLocking |
98 | a451dae2 | Iustin Pop | ]) |
99 | a451dae2 | Iustin Pop | , ("OpTagsSearch", |
100 | a451dae2 | Iustin Pop | [ pTagSearchPattern ]) |
101 | 3bebda52 | Dato Simó | , ("OpTagsSet", |
102 | 92f51573 | Iustin Pop | [ pTagsObject |
103 | 92f51573 | Iustin Pop | , pTagsList |
104 | 3bebda52 | Dato Simó | ]) |
105 | 3bebda52 | Dato Simó | , ("OpTagsDel", |
106 | 92f51573 | Iustin Pop | [ pTagsObject |
107 | 92f51573 | Iustin Pop | , pTagsList |
108 | 3bebda52 | Dato Simó | ]) |
109 | c66f09f5 | Iustin Pop | , ("OpClusterPostInit", []) |
110 | c66f09f5 | Iustin Pop | , ("OpClusterDestroy", []) |
111 | c66f09f5 | Iustin Pop | , ("OpClusterQuery", []) |
112 | c66f09f5 | Iustin Pop | , ("OpClusterVerify", |
113 | c66f09f5 | Iustin Pop | [ pDebugSimulateErrors |
114 | c66f09f5 | Iustin Pop | , pErrorCodes |
115 | c66f09f5 | Iustin Pop | , pSkipChecks |
116 | c66f09f5 | Iustin Pop | , pIgnoreErrors |
117 | c66f09f5 | Iustin Pop | , pVerbose |
118 | c66f09f5 | Iustin Pop | , pOptGroupName |
119 | c66f09f5 | Iustin Pop | ]) |
120 | c66f09f5 | Iustin Pop | , ("OpClusterVerifyConfig", |
121 | c66f09f5 | Iustin Pop | [ pDebugSimulateErrors |
122 | c66f09f5 | Iustin Pop | , pErrorCodes |
123 | c66f09f5 | Iustin Pop | , pIgnoreErrors |
124 | c66f09f5 | Iustin Pop | , pVerbose |
125 | c66f09f5 | Iustin Pop | ]) |
126 | c66f09f5 | Iustin Pop | , ("OpClusterVerifyGroup", |
127 | c66f09f5 | Iustin Pop | [ pGroupName |
128 | c66f09f5 | Iustin Pop | , pDebugSimulateErrors |
129 | c66f09f5 | Iustin Pop | , pErrorCodes |
130 | c66f09f5 | Iustin Pop | , pSkipChecks |
131 | c66f09f5 | Iustin Pop | , pIgnoreErrors |
132 | c66f09f5 | Iustin Pop | , pVerbose |
133 | c66f09f5 | Iustin Pop | ]) |
134 | c66f09f5 | Iustin Pop | , ("OpClusterVerifyDisks", []) |
135 | c66f09f5 | Iustin Pop | , ("OpGroupVerifyDisks", |
136 | c66f09f5 | Iustin Pop | [ pGroupName |
137 | c66f09f5 | Iustin Pop | ]) |
138 | c66f09f5 | Iustin Pop | , ("OpClusterRepairDiskSizes", |
139 | c66f09f5 | Iustin Pop | [ pInstances |
140 | c66f09f5 | Iustin Pop | ]) |
141 | c66f09f5 | Iustin Pop | , ("OpClusterConfigQuery", |
142 | c66f09f5 | Iustin Pop | [ pOutputFields |
143 | c66f09f5 | Iustin Pop | ]) |
144 | c66f09f5 | Iustin Pop | , ("OpClusterRename", |
145 | c66f09f5 | Iustin Pop | [ pName |
146 | c66f09f5 | Iustin Pop | ]) |
147 | c66f09f5 | Iustin Pop | , ("OpClusterSetParams", |
148 | c66f09f5 | Iustin Pop | [ pHvState |
149 | c66f09f5 | Iustin Pop | , pDiskState |
150 | c66f09f5 | Iustin Pop | , pVgName |
151 | c66f09f5 | Iustin Pop | , pEnabledHypervisors |
152 | c66f09f5 | Iustin Pop | , pClusterHvParams |
153 | c66f09f5 | Iustin Pop | , pClusterBeParams |
154 | c66f09f5 | Iustin Pop | , pOsHvp |
155 | 6d558717 | Iustin Pop | , pClusterOsParams |
156 | c66f09f5 | Iustin Pop | , pDiskParams |
157 | c66f09f5 | Iustin Pop | , pCandidatePoolSize |
158 | c66f09f5 | Iustin Pop | , pUidPool |
159 | c66f09f5 | Iustin Pop | , pAddUids |
160 | c66f09f5 | Iustin Pop | , pRemoveUids |
161 | c66f09f5 | Iustin Pop | , pMaintainNodeHealth |
162 | c66f09f5 | Iustin Pop | , pPreallocWipeDisks |
163 | c66f09f5 | Iustin Pop | , pNicParams |
164 | c66f09f5 | Iustin Pop | , pNdParams |
165 | c66f09f5 | Iustin Pop | , pIpolicy |
166 | c66f09f5 | Iustin Pop | , pDrbdHelper |
167 | c66f09f5 | Iustin Pop | , pDefaultIAllocator |
168 | c66f09f5 | Iustin Pop | , pMasterNetdev |
169 | 67fc4de7 | Iustin Pop | , pMasterNetmask |
170 | c66f09f5 | Iustin Pop | , pReservedLvs |
171 | c66f09f5 | Iustin Pop | , pHiddenOs |
172 | c66f09f5 | Iustin Pop | , pBlacklistedOs |
173 | c66f09f5 | Iustin Pop | , pUseExternalMipScript |
174 | c66f09f5 | Iustin Pop | ]) |
175 | c66f09f5 | Iustin Pop | , ("OpClusterRedistConf", []) |
176 | c66f09f5 | Iustin Pop | , ("OpClusterActivateMasterIp", []) |
177 | c66f09f5 | Iustin Pop | , ("OpClusterDeactivateMasterIp", []) |
178 | c66f09f5 | Iustin Pop | , ("OpQuery", |
179 | c66f09f5 | Iustin Pop | [ pQueryWhat |
180 | c66f09f5 | Iustin Pop | , pUseLocking |
181 | c66f09f5 | Iustin Pop | , pQueryFields |
182 | c66f09f5 | Iustin Pop | , pQueryFilter |
183 | c66f09f5 | Iustin Pop | ]) |
184 | c66f09f5 | Iustin Pop | , ("OpQueryFields", |
185 | c66f09f5 | Iustin Pop | [ pQueryWhat |
186 | c66f09f5 | Iustin Pop | , pQueryFields |
187 | c66f09f5 | Iustin Pop | ]) |
188 | c66f09f5 | Iustin Pop | , ("OpOobCommand", |
189 | c66f09f5 | Iustin Pop | [ pNodeNames |
190 | c66f09f5 | Iustin Pop | , pOobCommand |
191 | c66f09f5 | Iustin Pop | , pOobTimeout |
192 | c66f09f5 | Iustin Pop | , pIgnoreStatus |
193 | c66f09f5 | Iustin Pop | , pPowerDelay |
194 | c66f09f5 | Iustin Pop | ]) |
195 | c66f09f5 | Iustin Pop | , ("OpNodeRemove", [ pNodeName ]) |
196 | c66f09f5 | Iustin Pop | , ("OpNodeAdd", |
197 | c66f09f5 | Iustin Pop | [ pNodeName |
198 | c66f09f5 | Iustin Pop | , pHvState |
199 | c66f09f5 | Iustin Pop | , pDiskState |
200 | c66f09f5 | Iustin Pop | , pPrimaryIp |
201 | c66f09f5 | Iustin Pop | , pSecondaryIp |
202 | c66f09f5 | Iustin Pop | , pReadd |
203 | c66f09f5 | Iustin Pop | , pNodeGroup |
204 | c66f09f5 | Iustin Pop | , pMasterCapable |
205 | c66f09f5 | Iustin Pop | , pVmCapable |
206 | c66f09f5 | Iustin Pop | , pNdParams |
207 | c66f09f5 | Iustin Pop | ]) |
208 | 3131adc7 | Iustin Pop | , ("OpNodeQuery", dOldQuery) |
209 | c66f09f5 | Iustin Pop | , ("OpNodeQueryvols", |
210 | c66f09f5 | Iustin Pop | [ pOutputFields |
211 | c66f09f5 | Iustin Pop | , pNodes |
212 | c66f09f5 | Iustin Pop | ]) |
213 | c66f09f5 | Iustin Pop | , ("OpNodeQueryStorage", |
214 | c66f09f5 | Iustin Pop | [ pOutputFields |
215 | c66f09f5 | Iustin Pop | , pStorageType |
216 | c66f09f5 | Iustin Pop | , pNodes |
217 | c66f09f5 | Iustin Pop | , pStorageName |
218 | c66f09f5 | Iustin Pop | ]) |
219 | c66f09f5 | Iustin Pop | , ("OpNodeModifyStorage", |
220 | c66f09f5 | Iustin Pop | [ pNodeName |
221 | c66f09f5 | Iustin Pop | , pStorageType |
222 | c66f09f5 | Iustin Pop | , pStorageName |
223 | c66f09f5 | Iustin Pop | , pStorageChanges |
224 | c66f09f5 | Iustin Pop | ]) |
225 | c66f09f5 | Iustin Pop | , ("OpRepairNodeStorage", |
226 | c66f09f5 | Iustin Pop | [ pNodeName |
227 | c66f09f5 | Iustin Pop | , pStorageType |
228 | c66f09f5 | Iustin Pop | , pStorageName |
229 | c66f09f5 | Iustin Pop | , pIgnoreConsistency |
230 | c66f09f5 | Iustin Pop | ]) |
231 | c66f09f5 | Iustin Pop | , ("OpNodeSetParams", |
232 | c66f09f5 | Iustin Pop | [ pNodeName |
233 | c66f09f5 | Iustin Pop | , pForce |
234 | c66f09f5 | Iustin Pop | , pHvState |
235 | c66f09f5 | Iustin Pop | , pDiskState |
236 | c66f09f5 | Iustin Pop | , pMasterCandidate |
237 | c66f09f5 | Iustin Pop | , pOffline |
238 | c66f09f5 | Iustin Pop | , pDrained |
239 | c66f09f5 | Iustin Pop | , pAutoPromote |
240 | c66f09f5 | Iustin Pop | , pMasterCapable |
241 | c66f09f5 | Iustin Pop | , pVmCapable |
242 | c66f09f5 | Iustin Pop | , pSecondaryIp |
243 | c66f09f5 | Iustin Pop | , pNdParams |
244 | 67fc4de7 | Iustin Pop | , pPowered |
245 | c66f09f5 | Iustin Pop | ]) |
246 | c66f09f5 | Iustin Pop | , ("OpNodePowercycle", |
247 | c66f09f5 | Iustin Pop | [ pNodeName |
248 | c66f09f5 | Iustin Pop | , pForce |
249 | c66f09f5 | Iustin Pop | ]) |
250 | c66f09f5 | Iustin Pop | , ("OpNodeMigrate", |
251 | c66f09f5 | Iustin Pop | [ pNodeName |
252 | c66f09f5 | Iustin Pop | , pMigrationMode |
253 | c66f09f5 | Iustin Pop | , pMigrationLive |
254 | c66f09f5 | Iustin Pop | , pMigrationTargetNode |
255 | c66f09f5 | Iustin Pop | , pAllowRuntimeChgs |
256 | c66f09f5 | Iustin Pop | , pIgnoreIpolicy |
257 | c66f09f5 | Iustin Pop | , pIallocator |
258 | c66f09f5 | Iustin Pop | ]) |
259 | c66f09f5 | Iustin Pop | , ("OpNodeEvacuate", |
260 | c66f09f5 | Iustin Pop | [ pEarlyRelease |
261 | c66f09f5 | Iustin Pop | , pNodeName |
262 | c66f09f5 | Iustin Pop | , pRemoteNode |
263 | c66f09f5 | Iustin Pop | , pIallocator |
264 | c66f09f5 | Iustin Pop | , pEvacMode |
265 | c66f09f5 | Iustin Pop | ]) |
266 | 6d558717 | Iustin Pop | , ("OpInstanceCreate", |
267 | 6d558717 | Iustin Pop | [ pInstanceName |
268 | 6d558717 | Iustin Pop | , pForceVariant |
269 | 6d558717 | Iustin Pop | , pWaitForSync |
270 | 6d558717 | Iustin Pop | , pNameCheck |
271 | 6d558717 | Iustin Pop | , pIgnoreIpolicy |
272 | 6d558717 | Iustin Pop | , pInstBeParams |
273 | 6d558717 | Iustin Pop | , pInstDisks |
274 | 6d558717 | Iustin Pop | , pDiskTemplate |
275 | 6d558717 | Iustin Pop | , pFileDriver |
276 | 6d558717 | Iustin Pop | , pFileStorageDir |
277 | 6d558717 | Iustin Pop | , pInstHvParams |
278 | 6d558717 | Iustin Pop | , pHypervisor |
279 | 6d558717 | Iustin Pop | , pIallocator |
280 | 6d558717 | Iustin Pop | , pResetDefaults |
281 | 6d558717 | Iustin Pop | , pIpCheck |
282 | 6d558717 | Iustin Pop | , pIpConflictsCheck |
283 | 6d558717 | Iustin Pop | , pInstCreateMode |
284 | 6d558717 | Iustin Pop | , pInstNics |
285 | 6d558717 | Iustin Pop | , pNoInstall |
286 | 6d558717 | Iustin Pop | , pInstOsParams |
287 | 6d558717 | Iustin Pop | , pInstOs |
288 | 6d558717 | Iustin Pop | , pPrimaryNode |
289 | 6d558717 | Iustin Pop | , pSecondaryNode |
290 | 6d558717 | Iustin Pop | , pSourceHandshake |
291 | 6d558717 | Iustin Pop | , pSourceInstance |
292 | 6d558717 | Iustin Pop | , pSourceShutdownTimeout |
293 | 6d558717 | Iustin Pop | , pSourceX509Ca |
294 | 6d558717 | Iustin Pop | , pSrcNode |
295 | 6d558717 | Iustin Pop | , pSrcPath |
296 | 6d558717 | Iustin Pop | , pStartInstance |
297 | 1f1188c3 | Michael Hanselmann | , pOpportunisticLocking |
298 | 6d558717 | Iustin Pop | , pInstTags |
299 | 6d558717 | Iustin Pop | ]) |
300 | c2d3219b | Iustin Pop | , ("OpInstanceMultiAlloc", |
301 | c2d3219b | Iustin Pop | [ pIallocator |
302 | c2d3219b | Iustin Pop | , pMultiAllocInstances |
303 | c298ed02 | Michael Hanselmann | , pOpportunisticLocking |
304 | c2d3219b | Iustin Pop | ]) |
305 | c2d3219b | Iustin Pop | , ("OpInstanceReinstall", |
306 | c2d3219b | Iustin Pop | [ pInstanceName |
307 | c2d3219b | Iustin Pop | , pForceVariant |
308 | c2d3219b | Iustin Pop | , pInstOs |
309 | c2d3219b | Iustin Pop | , pTempOsParams |
310 | c2d3219b | Iustin Pop | ]) |
311 | c2d3219b | Iustin Pop | , ("OpInstanceRemove", |
312 | c2d3219b | Iustin Pop | [ pInstanceName |
313 | c2d3219b | Iustin Pop | , pShutdownTimeout |
314 | c2d3219b | Iustin Pop | , pIgnoreFailures |
315 | c2d3219b | Iustin Pop | ]) |
316 | c2d3219b | Iustin Pop | , ("OpInstanceRename", |
317 | c2d3219b | Iustin Pop | [ pInstanceName |
318 | c2d3219b | Iustin Pop | , pNewName |
319 | c2d3219b | Iustin Pop | , pNameCheck |
320 | c2d3219b | Iustin Pop | , pIpCheck |
321 | c2d3219b | Iustin Pop | ]) |
322 | c2d3219b | Iustin Pop | , ("OpInstanceStartup", |
323 | c2d3219b | Iustin Pop | [ pInstanceName |
324 | c2d3219b | Iustin Pop | , pForce |
325 | c2d3219b | Iustin Pop | , pIgnoreOfflineNodes |
326 | c2d3219b | Iustin Pop | , pTempHvParams |
327 | c2d3219b | Iustin Pop | , pTempBeParams |
328 | c2d3219b | Iustin Pop | , pNoRemember |
329 | c2d3219b | Iustin Pop | , pStartupPaused |
330 | c2d3219b | Iustin Pop | ]) |
331 | c2d3219b | Iustin Pop | , ("OpInstanceShutdown", |
332 | c2d3219b | Iustin Pop | [ pInstanceName |
333 | c2d3219b | Iustin Pop | , pIgnoreOfflineNodes |
334 | c2d3219b | Iustin Pop | , pShutdownTimeout' |
335 | c2d3219b | Iustin Pop | , pNoRemember |
336 | c2d3219b | Iustin Pop | ]) |
337 | c2d3219b | Iustin Pop | , ("OpInstanceReboot", |
338 | c2d3219b | Iustin Pop | [ pInstanceName |
339 | c2d3219b | Iustin Pop | , pShutdownTimeout |
340 | c2d3219b | Iustin Pop | , pIgnoreSecondaries |
341 | c2d3219b | Iustin Pop | , pRebootType |
342 | c2d3219b | Iustin Pop | ]) |
343 | c2d3219b | Iustin Pop | , ("OpInstanceMove", |
344 | c2d3219b | Iustin Pop | [ pInstanceName |
345 | c2d3219b | Iustin Pop | , pShutdownTimeout |
346 | c2d3219b | Iustin Pop | , pIgnoreIpolicy |
347 | c2d3219b | Iustin Pop | , pMoveTargetNode |
348 | c2d3219b | Iustin Pop | , pIgnoreConsistency |
349 | c2d3219b | Iustin Pop | ]) |
350 | c2d3219b | Iustin Pop | , ("OpInstanceConsole", |
351 | c2d3219b | Iustin Pop | [ pInstanceName ]) |
352 | c2d3219b | Iustin Pop | , ("OpInstanceActivateDisks", |
353 | c2d3219b | Iustin Pop | [ pInstanceName |
354 | c2d3219b | Iustin Pop | , pIgnoreDiskSize |
355 | c2d3219b | Iustin Pop | , pWaitForSyncFalse |
356 | c2d3219b | Iustin Pop | ]) |
357 | c2d3219b | Iustin Pop | , ("OpInstanceDeactivateDisks", |
358 | c2d3219b | Iustin Pop | [ pInstanceName |
359 | c2d3219b | Iustin Pop | , pForce |
360 | c2d3219b | Iustin Pop | ]) |
361 | c2d3219b | Iustin Pop | , ("OpInstanceRecreateDisks", |
362 | c2d3219b | Iustin Pop | [ pInstanceName |
363 | c2d3219b | Iustin Pop | , pRecreateDisksInfo |
364 | c2d3219b | Iustin Pop | , pNodes |
365 | c2d3219b | Iustin Pop | , pIallocator |
366 | c2d3219b | Iustin Pop | ]) |
367 | 3131adc7 | Iustin Pop | , ("OpInstanceQuery", dOldQuery) |
368 | c2d3219b | Iustin Pop | , ("OpInstanceQueryData", |
369 | c2d3219b | Iustin Pop | [ pUseLocking |
370 | c2d3219b | Iustin Pop | , pInstances |
371 | c2d3219b | Iustin Pop | , pStatic |
372 | c2d3219b | Iustin Pop | ]) |
373 | c2d3219b | Iustin Pop | , ("OpInstanceSetParams", |
374 | c2d3219b | Iustin Pop | [ pInstanceName |
375 | c2d3219b | Iustin Pop | , pForce |
376 | c2d3219b | Iustin Pop | , pForceVariant |
377 | c2d3219b | Iustin Pop | , pIgnoreIpolicy |
378 | c2d3219b | Iustin Pop | , pInstParamsNicChanges |
379 | c2d3219b | Iustin Pop | , pInstParamsDiskChanges |
380 | c2d3219b | Iustin Pop | , pInstBeParams |
381 | c2d3219b | Iustin Pop | , pRuntimeMem |
382 | c2d3219b | Iustin Pop | , pInstHvParams |
383 | c2d3219b | Iustin Pop | , pDiskTemplate |
384 | c2d3219b | Iustin Pop | , pRemoteNode |
385 | c2d3219b | Iustin Pop | , pOsNameChange |
386 | c2d3219b | Iustin Pop | , pInstOsParams |
387 | c2d3219b | Iustin Pop | , pWaitForSync |
388 | c2d3219b | Iustin Pop | , pOffline |
389 | c2d3219b | Iustin Pop | , pIpConflictsCheck |
390 | c2d3219b | Iustin Pop | ]) |
391 | c2d3219b | Iustin Pop | , ("OpInstanceGrowDisk", |
392 | c2d3219b | Iustin Pop | [ pInstanceName |
393 | c2d3219b | Iustin Pop | , pWaitForSync |
394 | c2d3219b | Iustin Pop | , pDiskIndex |
395 | c2d3219b | Iustin Pop | , pDiskChgAmount |
396 | c2d3219b | Iustin Pop | , pDiskChgAbsolute |
397 | c2d3219b | Iustin Pop | ]) |
398 | c2d3219b | Iustin Pop | , ("OpInstanceChangeGroup", |
399 | c2d3219b | Iustin Pop | [ pInstanceName |
400 | c2d3219b | Iustin Pop | , pEarlyRelease |
401 | c2d3219b | Iustin Pop | , pIallocator |
402 | c2d3219b | Iustin Pop | , pTargetGroups |
403 | c2d3219b | Iustin Pop | ]) |
404 | 398e9066 | Iustin Pop | , ("OpGroupAdd", |
405 | 398e9066 | Iustin Pop | [ pGroupName |
406 | 398e9066 | Iustin Pop | , pNodeGroupAllocPolicy |
407 | 398e9066 | Iustin Pop | , pGroupNodeParams |
408 | 398e9066 | Iustin Pop | , pDiskParams |
409 | 398e9066 | Iustin Pop | , pHvState |
410 | 398e9066 | Iustin Pop | , pDiskState |
411 | 398e9066 | Iustin Pop | , pIpolicy |
412 | 398e9066 | Iustin Pop | ]) |
413 | 398e9066 | Iustin Pop | , ("OpGroupAssignNodes", |
414 | 398e9066 | Iustin Pop | [ pGroupName |
415 | 398e9066 | Iustin Pop | , pForce |
416 | 398e9066 | Iustin Pop | , pRequiredNodes |
417 | 398e9066 | Iustin Pop | ]) |
418 | 3131adc7 | Iustin Pop | , ("OpGroupQuery", dOldQueryNoLocking) |
419 | 398e9066 | Iustin Pop | , ("OpGroupSetParams", |
420 | 398e9066 | Iustin Pop | [ pGroupName |
421 | 398e9066 | Iustin Pop | , pNodeGroupAllocPolicy |
422 | 398e9066 | Iustin Pop | , pGroupNodeParams |
423 | 398e9066 | Iustin Pop | , pDiskParams |
424 | 398e9066 | Iustin Pop | , pHvState |
425 | 398e9066 | Iustin Pop | , pDiskState |
426 | 398e9066 | Iustin Pop | , pIpolicy |
427 | 398e9066 | Iustin Pop | ]) |
428 | 398e9066 | Iustin Pop | , ("OpGroupRemove", |
429 | 398e9066 | Iustin Pop | [ pGroupName ]) |
430 | 398e9066 | Iustin Pop | , ("OpGroupRename", |
431 | 398e9066 | Iustin Pop | [ pGroupName |
432 | 398e9066 | Iustin Pop | , pNewName |
433 | 398e9066 | Iustin Pop | ]) |
434 | 398e9066 | Iustin Pop | , ("OpGroupEvacuate", |
435 | 398e9066 | Iustin Pop | [ pGroupName |
436 | 398e9066 | Iustin Pop | , pEarlyRelease |
437 | 398e9066 | Iustin Pop | , pIallocator |
438 | 398e9066 | Iustin Pop | , pTargetGroups |
439 | 398e9066 | Iustin Pop | ]) |
440 | 398e9066 | Iustin Pop | , ("OpOsDiagnose", |
441 | 398e9066 | Iustin Pop | [ pOutputFields |
442 | 398e9066 | Iustin Pop | , pNames ]) |
443 | 398e9066 | Iustin Pop | , ("OpBackupQuery", |
444 | 398e9066 | Iustin Pop | [ pUseLocking |
445 | 398e9066 | Iustin Pop | , pNodes |
446 | 398e9066 | Iustin Pop | ]) |
447 | 398e9066 | Iustin Pop | , ("OpBackupPrepare", |
448 | 398e9066 | Iustin Pop | [ pInstanceName |
449 | 398e9066 | Iustin Pop | , pExportMode |
450 | 398e9066 | Iustin Pop | ]) |
451 | 398e9066 | Iustin Pop | , ("OpBackupExport", |
452 | 398e9066 | Iustin Pop | [ pInstanceName |
453 | 398e9066 | Iustin Pop | , pShutdownTimeout |
454 | 398e9066 | Iustin Pop | , pExportTargetNode |
455 | 67fc4de7 | Iustin Pop | , pShutdownInstance |
456 | 398e9066 | Iustin Pop | , pRemoveInstance |
457 | 398e9066 | Iustin Pop | , pIgnoreRemoveFailures |
458 | 398e9066 | Iustin Pop | , pExportMode |
459 | 398e9066 | Iustin Pop | , pX509KeyName |
460 | 398e9066 | Iustin Pop | , pX509DestCA |
461 | 398e9066 | Iustin Pop | ]) |
462 | 398e9066 | Iustin Pop | , ("OpBackupRemove", |
463 | 398e9066 | Iustin Pop | [ pInstanceName ]) |
464 | a3f02317 | Iustin Pop | , ("OpTestAllocator", |
465 | a3f02317 | Iustin Pop | [ pIAllocatorDirection |
466 | a3f02317 | Iustin Pop | , pIAllocatorMode |
467 | a3f02317 | Iustin Pop | , pIAllocatorReqName |
468 | a3f02317 | Iustin Pop | , pIAllocatorNics |
469 | a3f02317 | Iustin Pop | , pIAllocatorDisks |
470 | a3f02317 | Iustin Pop | , pHypervisor |
471 | a3f02317 | Iustin Pop | , pIallocator |
472 | a3f02317 | Iustin Pop | , pInstTags |
473 | a3f02317 | Iustin Pop | , pIAllocatorMemory |
474 | a3f02317 | Iustin Pop | , pIAllocatorVCpus |
475 | a3f02317 | Iustin Pop | , pIAllocatorOs |
476 | a3f02317 | Iustin Pop | , pDiskTemplate |
477 | a3f02317 | Iustin Pop | , pIAllocatorInstances |
478 | a3f02317 | Iustin Pop | , pIAllocatorEvacMode |
479 | a3f02317 | Iustin Pop | , pTargetGroups |
480 | a3f02317 | Iustin Pop | , pIAllocatorSpindleUse |
481 | a3f02317 | Iustin Pop | , pIAllocatorCount |
482 | a3f02317 | Iustin Pop | ]) |
483 | a3f02317 | Iustin Pop | , ("OpTestJqueue", |
484 | a3f02317 | Iustin Pop | [ pJQueueNotifyWaitLock |
485 | a3f02317 | Iustin Pop | , pJQueueNotifyExec |
486 | a3f02317 | Iustin Pop | , pJQueueLogMessages |
487 | a3f02317 | Iustin Pop | , pJQueueFail |
488 | a3f02317 | Iustin Pop | ]) |
489 | a3f02317 | Iustin Pop | , ("OpTestDummy", |
490 | a3f02317 | Iustin Pop | [ pTestDummyResult |
491 | a3f02317 | Iustin Pop | , pTestDummyMessages |
492 | a3f02317 | Iustin Pop | , pTestDummyFail |
493 | a3f02317 | Iustin Pop | , pTestDummySubmitJobs |
494 | a3f02317 | Iustin Pop | ]) |
495 | 8d239fa4 | Iustin Pop | , ("OpNetworkAdd", |
496 | 8d239fa4 | Iustin Pop | [ pNetworkName |
497 | 8d239fa4 | Iustin Pop | , pNetworkType |
498 | 8d239fa4 | Iustin Pop | , pNetworkAddress4 |
499 | 8d239fa4 | Iustin Pop | , pNetworkGateway4 |
500 | 8d239fa4 | Iustin Pop | , pNetworkAddress6 |
501 | 8d239fa4 | Iustin Pop | , pNetworkGateway6 |
502 | 8d239fa4 | Iustin Pop | , pNetworkMacPrefix |
503 | 8d239fa4 | Iustin Pop | , pNetworkAddRsvdIps |
504 | 1dbceab9 | Iustin Pop | , pIpConflictsCheck |
505 | 8d239fa4 | Iustin Pop | , pInstTags |
506 | 8d239fa4 | Iustin Pop | ]) |
507 | 8d239fa4 | Iustin Pop | , ("OpNetworkRemove", |
508 | 8d239fa4 | Iustin Pop | [ pNetworkName |
509 | 8d239fa4 | Iustin Pop | , pForce |
510 | 8d239fa4 | Iustin Pop | ]) |
511 | 8d239fa4 | Iustin Pop | , ("OpNetworkSetParams", |
512 | 8d239fa4 | Iustin Pop | [ pNetworkName |
513 | 8d239fa4 | Iustin Pop | , pNetworkType |
514 | 8d239fa4 | Iustin Pop | , pNetworkGateway4 |
515 | 8d239fa4 | Iustin Pop | , pNetworkAddress6 |
516 | 8d239fa4 | Iustin Pop | , pNetworkGateway6 |
517 | 8d239fa4 | Iustin Pop | , pNetworkMacPrefix |
518 | 8d239fa4 | Iustin Pop | , pNetworkAddRsvdIps |
519 | 8d239fa4 | Iustin Pop | , pNetworkRemoveRsvdIps |
520 | 8d239fa4 | Iustin Pop | ]) |
521 | 8d239fa4 | Iustin Pop | , ("OpNetworkConnect", |
522 | 8d239fa4 | Iustin Pop | [ pGroupName |
523 | 8d239fa4 | Iustin Pop | , pNetworkName |
524 | 8d239fa4 | Iustin Pop | , pNetworkMode |
525 | 8d239fa4 | Iustin Pop | , pNetworkLink |
526 | 8d239fa4 | Iustin Pop | , pIpConflictsCheck |
527 | 8d239fa4 | Iustin Pop | ]) |
528 | 8d239fa4 | Iustin Pop | , ("OpNetworkDisconnect", |
529 | 8d239fa4 | Iustin Pop | [ pGroupName |
530 | 8d239fa4 | Iustin Pop | , pNetworkName |
531 | 8d239fa4 | Iustin Pop | , pIpConflictsCheck |
532 | 8d239fa4 | Iustin Pop | ]) |
533 | 3131adc7 | Iustin Pop | , ("OpNetworkQuery", dOldQueryNoLocking) |
534 | 1cd563e2 | Iustin Pop | , ("OpRestrictedCommand", |
535 | 1cd563e2 | Iustin Pop | [ pUseLocking |
536 | 1cd563e2 | Iustin Pop | , pRequiredNodes |
537 | 1cd563e2 | Iustin Pop | , pRestrictedCommand |
538 | 1cd563e2 | Iustin Pop | ]) |
539 | ebf38064 | Iustin Pop | ]) |
540 | 12c19659 | Iustin Pop | |
541 | a583ec5d | Iustin Pop | -- | Returns the OP_ID for a given opcode value. |
542 | 12c19659 | Iustin Pop | $(genOpID ''OpCode "opID") |
543 | 702a4ee0 | Iustin Pop | |
544 | a583ec5d | Iustin Pop | -- | A list of all defined/supported opcode IDs. |
545 | a583ec5d | Iustin Pop | $(genAllOpIDs ''OpCode "allOpIDs") |
546 | a583ec5d | Iustin Pop | |
547 | 702a4ee0 | Iustin Pop | instance JSON OpCode where |
548 | ebf38064 | Iustin Pop | readJSON = loadOpCode |
549 | ebf38064 | Iustin Pop | showJSON = saveOpCode |
550 | 4a826364 | Iustin Pop | |
551 | 4a826364 | Iustin Pop | -- | Generic\/common opcode parameters. |
552 | 4a826364 | Iustin Pop | $(buildObject "CommonOpParams" "op" |
553 | 4a826364 | Iustin Pop | [ pDryRun |
554 | 4a826364 | Iustin Pop | , pDebugLevel |
555 | 4a826364 | Iustin Pop | , pOpPriority |
556 | 4a826364 | Iustin Pop | , pDependencies |
557 | 4a826364 | Iustin Pop | , pComment |
558 | 4a826364 | Iustin Pop | ]) |
559 | 4a826364 | Iustin Pop | |
560 | 4a826364 | Iustin Pop | -- | Default common parameter values. |
561 | 4a826364 | Iustin Pop | defOpParams :: CommonOpParams |
562 | 4a826364 | Iustin Pop | defOpParams = |
563 | 4a826364 | Iustin Pop | CommonOpParams { opDryRun = Nothing |
564 | 4a826364 | Iustin Pop | , opDebugLevel = Nothing |
565 | 4a826364 | Iustin Pop | , opPriority = OpPrioNormal |
566 | 4a826364 | Iustin Pop | , opDepends = Nothing |
567 | 4a826364 | Iustin Pop | , opComment = Nothing |
568 | 4a826364 | Iustin Pop | } |
569 | 4a826364 | Iustin Pop | |
570 | 4a826364 | Iustin Pop | -- | The top-level opcode type. |
571 | 4a826364 | Iustin Pop | data MetaOpCode = MetaOpCode CommonOpParams OpCode |
572 | 4a826364 | Iustin Pop | deriving (Show, Eq) |
573 | 4a826364 | Iustin Pop | |
574 | 4a826364 | Iustin Pop | -- | JSON serialisation for 'MetaOpCode'. |
575 | 4a826364 | Iustin Pop | showMeta :: MetaOpCode -> JSValue |
576 | 4a826364 | Iustin Pop | showMeta (MetaOpCode params op) = |
577 | 4a826364 | Iustin Pop | let objparams = toDictCommonOpParams params |
578 | 4a826364 | Iustin Pop | objop = toDictOpCode op |
579 | 4a826364 | Iustin Pop | in makeObj (objparams ++ objop) |
580 | 4a826364 | Iustin Pop | |
581 | 4a826364 | Iustin Pop | -- | JSON deserialisation for 'MetaOpCode' |
582 | 4a826364 | Iustin Pop | readMeta :: JSValue -> Text.JSON.Result MetaOpCode |
583 | 4a826364 | Iustin Pop | readMeta v = do |
584 | 4a826364 | Iustin Pop | meta <- readJSON v |
585 | 4a826364 | Iustin Pop | op <- readJSON v |
586 | 4a826364 | Iustin Pop | return $ MetaOpCode meta op |
587 | 4a826364 | Iustin Pop | |
588 | 4a826364 | Iustin Pop | instance JSON MetaOpCode where |
589 | 4a826364 | Iustin Pop | showJSON = showMeta |
590 | 4a826364 | Iustin Pop | readJSON = readMeta |
591 | 4a826364 | Iustin Pop | |
592 | 4a826364 | Iustin Pop | -- | Wraps an 'OpCode' with the default parameters to build a |
593 | 4a826364 | Iustin Pop | -- 'MetaOpCode'. |
594 | 4a826364 | Iustin Pop | wrapOpCode :: OpCode -> MetaOpCode |
595 | 4a826364 | Iustin Pop | wrapOpCode = MetaOpCode defOpParams |
596 | 4a826364 | Iustin Pop | |
597 | 4a826364 | Iustin Pop | -- | Sets the comment on a meta opcode. |
598 | 4a826364 | Iustin Pop | setOpComment :: String -> MetaOpCode -> MetaOpCode |
599 | 4a826364 | Iustin Pop | setOpComment comment (MetaOpCode common op) = |
600 | 4a826364 | Iustin Pop | MetaOpCode (common { opComment = Just comment}) op |