root / src / Ganeti / OpCodes.hs @ 791e87b8
History | View | Annotate | Download (17.7 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 | 551b44e2 | Iustin Pop | Copyright (C) 2009, 2010, 2011, 2012, 2013 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 | ad1c1e41 | Iustin Pop | , opSummary |
42 | 4a826364 | Iustin Pop | , CommonOpParams(..) |
43 | 4a826364 | Iustin Pop | , defOpParams |
44 | 4a826364 | Iustin Pop | , MetaOpCode(..) |
45 | 4a826364 | Iustin Pop | , wrapOpCode |
46 | 4a826364 | Iustin Pop | , setOpComment |
47 | 551b44e2 | Iustin Pop | , setOpPriority |
48 | ebf38064 | Iustin Pop | ) where |
49 | 702a4ee0 | Iustin Pop | |
50 | ad1c1e41 | Iustin Pop | import Data.Maybe (fromMaybe) |
51 | d860352f | Michele Tartara | import Text.JSON (readJSON, JSON, JSValue, makeObj) |
52 | 4a826364 | Iustin Pop | import qualified Text.JSON |
53 | 702a4ee0 | Iustin Pop | |
54 | 12c19659 | Iustin Pop | import Ganeti.THH |
55 | e9aaa3c6 | Iustin Pop | |
56 | 92f51573 | Iustin Pop | import Ganeti.OpParams |
57 | ad1c1e41 | Iustin Pop | import Ganeti.Types (OpSubmitPriority(..), fromNonEmpty) |
58 | ad1c1e41 | Iustin Pop | import Ganeti.Query.Language (queryTypeOpToRaw) |
59 | 4a1dc2bf | Iustin Pop | |
60 | 525bfb36 | Iustin Pop | -- | OpCode representation. |
61 | 525bfb36 | Iustin Pop | -- |
62 | 3bebda52 | Dato Simó | -- We only implement a subset of Ganeti opcodes: those which are actually used |
63 | 3bebda52 | Dato Simó | -- in the htools codebase. |
64 | 12c19659 | Iustin Pop | $(genOpCode "OpCode" |
65 | ebf38064 | Iustin Pop | [ ("OpTestDelay", |
66 | 7d421386 | Iustin Pop | [ pDelayDuration |
67 | 7d421386 | Iustin Pop | , pDelayOnMaster |
68 | 7d421386 | Iustin Pop | , pDelayOnNodes |
69 | 1c3231aa | Thomas Thrainer | , pDelayOnNodeUuids |
70 | a451dae2 | Iustin Pop | , pDelayRepeat |
71 | ebf38064 | Iustin Pop | ]) |
72 | ebf38064 | Iustin Pop | , ("OpInstanceReplaceDisks", |
73 | 92f51573 | Iustin Pop | [ pInstanceName |
74 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
75 | 3d7e87b8 | Iustin Pop | , pEarlyRelease |
76 | 3d7e87b8 | Iustin Pop | , pIgnoreIpolicy |
77 | 7d421386 | Iustin Pop | , pReplaceDisksMode |
78 | 7d421386 | Iustin Pop | , pReplaceDisksList |
79 | 3d7e87b8 | Iustin Pop | , pRemoteNode |
80 | 1c3231aa | Thomas Thrainer | , pRemoteNodeUuid |
81 | c7d249d0 | Iustin Pop | , pIallocator |
82 | ebf38064 | Iustin Pop | ]) |
83 | ebf38064 | Iustin Pop | , ("OpInstanceFailover", |
84 | 92f51573 | Iustin Pop | [ pInstanceName |
85 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
86 | 3d7e87b8 | Iustin Pop | , pShutdownTimeout |
87 | 7d421386 | Iustin Pop | , pIgnoreConsistency |
88 | c7d249d0 | Iustin Pop | , pMigrationTargetNode |
89 | 1c3231aa | Thomas Thrainer | , pMigrationTargetNodeUuid |
90 | 3d7e87b8 | Iustin Pop | , pIgnoreIpolicy |
91 | 3d7e87b8 | Iustin Pop | , pIallocator |
92 | aa7a5c90 | Michele Tartara | , pMigrationCleanup |
93 | ebf38064 | Iustin Pop | ]) |
94 | ebf38064 | Iustin Pop | , ("OpInstanceMigrate", |
95 | 92f51573 | Iustin Pop | [ pInstanceName |
96 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
97 | 3d7e87b8 | Iustin Pop | , pMigrationMode |
98 | f9556d33 | Iustin Pop | , pMigrationLive |
99 | 3d7e87b8 | Iustin Pop | , pMigrationTargetNode |
100 | 1c3231aa | Thomas Thrainer | , pMigrationTargetNodeUuid |
101 | 3d7e87b8 | Iustin Pop | , pAllowRuntimeChgs |
102 | 3d7e87b8 | Iustin Pop | , pIgnoreIpolicy |
103 | 7d421386 | Iustin Pop | , pMigrationCleanup |
104 | 3d7e87b8 | Iustin Pop | , pIallocator |
105 | 7d421386 | Iustin Pop | , pAllowFailover |
106 | ebf38064 | Iustin Pop | ]) |
107 | a451dae2 | Iustin Pop | , ("OpTagsGet", |
108 | a451dae2 | Iustin Pop | [ pTagsObject |
109 | a451dae2 | Iustin Pop | , pUseLocking |
110 | a451dae2 | Iustin Pop | ]) |
111 | a451dae2 | Iustin Pop | , ("OpTagsSearch", |
112 | a451dae2 | Iustin Pop | [ pTagSearchPattern ]) |
113 | 3bebda52 | Dato Simó | , ("OpTagsSet", |
114 | 92f51573 | Iustin Pop | [ pTagsObject |
115 | 92f51573 | Iustin Pop | , pTagsList |
116 | 3bebda52 | Dato Simó | ]) |
117 | 3bebda52 | Dato Simó | , ("OpTagsDel", |
118 | 92f51573 | Iustin Pop | [ pTagsObject |
119 | 92f51573 | Iustin Pop | , pTagsList |
120 | 3bebda52 | Dato Simó | ]) |
121 | c66f09f5 | Iustin Pop | , ("OpClusterPostInit", []) |
122 | c66f09f5 | Iustin Pop | , ("OpClusterDestroy", []) |
123 | c66f09f5 | Iustin Pop | , ("OpClusterQuery", []) |
124 | c66f09f5 | Iustin Pop | , ("OpClusterVerify", |
125 | c66f09f5 | Iustin Pop | [ pDebugSimulateErrors |
126 | c66f09f5 | Iustin Pop | , pErrorCodes |
127 | c66f09f5 | Iustin Pop | , pSkipChecks |
128 | c66f09f5 | Iustin Pop | , pIgnoreErrors |
129 | c66f09f5 | Iustin Pop | , pVerbose |
130 | c66f09f5 | Iustin Pop | , pOptGroupName |
131 | c66f09f5 | Iustin Pop | ]) |
132 | c66f09f5 | Iustin Pop | , ("OpClusterVerifyConfig", |
133 | c66f09f5 | Iustin Pop | [ pDebugSimulateErrors |
134 | c66f09f5 | Iustin Pop | , pErrorCodes |
135 | c66f09f5 | Iustin Pop | , pIgnoreErrors |
136 | c66f09f5 | Iustin Pop | , pVerbose |
137 | c66f09f5 | Iustin Pop | ]) |
138 | c66f09f5 | Iustin Pop | , ("OpClusterVerifyGroup", |
139 | c66f09f5 | Iustin Pop | [ pGroupName |
140 | c66f09f5 | Iustin Pop | , pDebugSimulateErrors |
141 | c66f09f5 | Iustin Pop | , pErrorCodes |
142 | c66f09f5 | Iustin Pop | , pSkipChecks |
143 | c66f09f5 | Iustin Pop | , pIgnoreErrors |
144 | c66f09f5 | Iustin Pop | , pVerbose |
145 | c66f09f5 | Iustin Pop | ]) |
146 | c66f09f5 | Iustin Pop | , ("OpClusterVerifyDisks", []) |
147 | c66f09f5 | Iustin Pop | , ("OpGroupVerifyDisks", |
148 | c66f09f5 | Iustin Pop | [ pGroupName |
149 | c66f09f5 | Iustin Pop | ]) |
150 | c66f09f5 | Iustin Pop | , ("OpClusterRepairDiskSizes", |
151 | c66f09f5 | Iustin Pop | [ pInstances |
152 | c66f09f5 | Iustin Pop | ]) |
153 | c66f09f5 | Iustin Pop | , ("OpClusterConfigQuery", |
154 | c66f09f5 | Iustin Pop | [ pOutputFields |
155 | c66f09f5 | Iustin Pop | ]) |
156 | c66f09f5 | Iustin Pop | , ("OpClusterRename", |
157 | c66f09f5 | Iustin Pop | [ pName |
158 | c66f09f5 | Iustin Pop | ]) |
159 | c66f09f5 | Iustin Pop | , ("OpClusterSetParams", |
160 | e5c92cfb | Klaus Aehlig | [ pForce |
161 | e5c92cfb | Klaus Aehlig | , pHvState |
162 | c66f09f5 | Iustin Pop | , pDiskState |
163 | c66f09f5 | Iustin Pop | , pVgName |
164 | c66f09f5 | Iustin Pop | , pEnabledHypervisors |
165 | c66f09f5 | Iustin Pop | , pClusterHvParams |
166 | c66f09f5 | Iustin Pop | , pClusterBeParams |
167 | c66f09f5 | Iustin Pop | , pOsHvp |
168 | 6d558717 | Iustin Pop | , pClusterOsParams |
169 | c66f09f5 | Iustin Pop | , pDiskParams |
170 | c66f09f5 | Iustin Pop | , pCandidatePoolSize |
171 | c66f09f5 | Iustin Pop | , pUidPool |
172 | c66f09f5 | Iustin Pop | , pAddUids |
173 | c66f09f5 | Iustin Pop | , pRemoveUids |
174 | c66f09f5 | Iustin Pop | , pMaintainNodeHealth |
175 | c66f09f5 | Iustin Pop | , pPreallocWipeDisks |
176 | c66f09f5 | Iustin Pop | , pNicParams |
177 | c66f09f5 | Iustin Pop | , pNdParams |
178 | c66f09f5 | Iustin Pop | , pIpolicy |
179 | c66f09f5 | Iustin Pop | , pDrbdHelper |
180 | c66f09f5 | Iustin Pop | , pDefaultIAllocator |
181 | c66f09f5 | Iustin Pop | , pMasterNetdev |
182 | 67fc4de7 | Iustin Pop | , pMasterNetmask |
183 | c66f09f5 | Iustin Pop | , pReservedLvs |
184 | c66f09f5 | Iustin Pop | , pHiddenOs |
185 | c66f09f5 | Iustin Pop | , pBlacklistedOs |
186 | c66f09f5 | Iustin Pop | , pUseExternalMipScript |
187 | 66af5ec5 | Helga Velroyen | , pEnabledDiskTemplates |
188 | 75f2ff7d | Michele Tartara | , pModifyEtcHosts |
189 | 3039e2dc | Helga Velroyen | , pGlobalFileStorageDir |
190 | 4e6cfd11 | Helga Velroyen | , pGlobalSharedFileStorageDir |
191 | c66f09f5 | Iustin Pop | ]) |
192 | c66f09f5 | Iustin Pop | , ("OpClusterRedistConf", []) |
193 | c66f09f5 | Iustin Pop | , ("OpClusterActivateMasterIp", []) |
194 | c66f09f5 | Iustin Pop | , ("OpClusterDeactivateMasterIp", []) |
195 | c66f09f5 | Iustin Pop | , ("OpQuery", |
196 | c66f09f5 | Iustin Pop | [ pQueryWhat |
197 | c66f09f5 | Iustin Pop | , pUseLocking |
198 | c66f09f5 | Iustin Pop | , pQueryFields |
199 | c66f09f5 | Iustin Pop | , pQueryFilter |
200 | c66f09f5 | Iustin Pop | ]) |
201 | c66f09f5 | Iustin Pop | , ("OpQueryFields", |
202 | c66f09f5 | Iustin Pop | [ pQueryWhat |
203 | c66f09f5 | Iustin Pop | , pQueryFields |
204 | c66f09f5 | Iustin Pop | ]) |
205 | c66f09f5 | Iustin Pop | , ("OpOobCommand", |
206 | c66f09f5 | Iustin Pop | [ pNodeNames |
207 | 1c3231aa | Thomas Thrainer | , pNodeUuids |
208 | c66f09f5 | Iustin Pop | , pOobCommand |
209 | c66f09f5 | Iustin Pop | , pOobTimeout |
210 | c66f09f5 | Iustin Pop | , pIgnoreStatus |
211 | c66f09f5 | Iustin Pop | , pPowerDelay |
212 | c66f09f5 | Iustin Pop | ]) |
213 | 1c3231aa | Thomas Thrainer | , ("OpNodeRemove", |
214 | 1c3231aa | Thomas Thrainer | [ pNodeName |
215 | 1c3231aa | Thomas Thrainer | , pNodeUuid |
216 | 1c3231aa | Thomas Thrainer | ]) |
217 | c66f09f5 | Iustin Pop | , ("OpNodeAdd", |
218 | c66f09f5 | Iustin Pop | [ pNodeName |
219 | c66f09f5 | Iustin Pop | , pHvState |
220 | c66f09f5 | Iustin Pop | , pDiskState |
221 | c66f09f5 | Iustin Pop | , pPrimaryIp |
222 | c66f09f5 | Iustin Pop | , pSecondaryIp |
223 | c66f09f5 | Iustin Pop | , pReadd |
224 | c66f09f5 | Iustin Pop | , pNodeGroup |
225 | c66f09f5 | Iustin Pop | , pMasterCapable |
226 | c66f09f5 | Iustin Pop | , pVmCapable |
227 | c66f09f5 | Iustin Pop | , pNdParams |
228 | c66f09f5 | Iustin Pop | ]) |
229 | 3131adc7 | Iustin Pop | , ("OpNodeQuery", dOldQuery) |
230 | c66f09f5 | Iustin Pop | , ("OpNodeQueryvols", |
231 | c66f09f5 | Iustin Pop | [ pOutputFields |
232 | c66f09f5 | Iustin Pop | , pNodes |
233 | c66f09f5 | Iustin Pop | ]) |
234 | c66f09f5 | Iustin Pop | , ("OpNodeQueryStorage", |
235 | c66f09f5 | Iustin Pop | [ pOutputFields |
236 | c66f09f5 | Iustin Pop | , pStorageType |
237 | c66f09f5 | Iustin Pop | , pNodes |
238 | c66f09f5 | Iustin Pop | , pStorageName |
239 | c66f09f5 | Iustin Pop | ]) |
240 | c66f09f5 | Iustin Pop | , ("OpNodeModifyStorage", |
241 | c66f09f5 | Iustin Pop | [ pNodeName |
242 | 1c3231aa | Thomas Thrainer | , pNodeUuid |
243 | c66f09f5 | Iustin Pop | , pStorageType |
244 | c66f09f5 | Iustin Pop | , pStorageName |
245 | c66f09f5 | Iustin Pop | , pStorageChanges |
246 | c66f09f5 | Iustin Pop | ]) |
247 | c66f09f5 | Iustin Pop | , ("OpRepairNodeStorage", |
248 | c66f09f5 | Iustin Pop | [ pNodeName |
249 | 1c3231aa | Thomas Thrainer | , pNodeUuid |
250 | c66f09f5 | Iustin Pop | , pStorageType |
251 | c66f09f5 | Iustin Pop | , pStorageName |
252 | c66f09f5 | Iustin Pop | , pIgnoreConsistency |
253 | c66f09f5 | Iustin Pop | ]) |
254 | c66f09f5 | Iustin Pop | , ("OpNodeSetParams", |
255 | c66f09f5 | Iustin Pop | [ pNodeName |
256 | 1c3231aa | Thomas Thrainer | , pNodeUuid |
257 | c66f09f5 | Iustin Pop | , pForce |
258 | c66f09f5 | Iustin Pop | , pHvState |
259 | c66f09f5 | Iustin Pop | , pDiskState |
260 | c66f09f5 | Iustin Pop | , pMasterCandidate |
261 | c66f09f5 | Iustin Pop | , pOffline |
262 | c66f09f5 | Iustin Pop | , pDrained |
263 | c66f09f5 | Iustin Pop | , pAutoPromote |
264 | c66f09f5 | Iustin Pop | , pMasterCapable |
265 | c66f09f5 | Iustin Pop | , pVmCapable |
266 | c66f09f5 | Iustin Pop | , pSecondaryIp |
267 | c66f09f5 | Iustin Pop | , pNdParams |
268 | 67fc4de7 | Iustin Pop | , pPowered |
269 | c66f09f5 | Iustin Pop | ]) |
270 | c66f09f5 | Iustin Pop | , ("OpNodePowercycle", |
271 | c66f09f5 | Iustin Pop | [ pNodeName |
272 | 1c3231aa | Thomas Thrainer | , pNodeUuid |
273 | c66f09f5 | Iustin Pop | , pForce |
274 | c66f09f5 | Iustin Pop | ]) |
275 | c66f09f5 | Iustin Pop | , ("OpNodeMigrate", |
276 | c66f09f5 | Iustin Pop | [ pNodeName |
277 | 1c3231aa | Thomas Thrainer | , pNodeUuid |
278 | c66f09f5 | Iustin Pop | , pMigrationMode |
279 | c66f09f5 | Iustin Pop | , pMigrationLive |
280 | c66f09f5 | Iustin Pop | , pMigrationTargetNode |
281 | 1c3231aa | Thomas Thrainer | , pMigrationTargetNodeUuid |
282 | c66f09f5 | Iustin Pop | , pAllowRuntimeChgs |
283 | c66f09f5 | Iustin Pop | , pIgnoreIpolicy |
284 | c66f09f5 | Iustin Pop | , pIallocator |
285 | c66f09f5 | Iustin Pop | ]) |
286 | c66f09f5 | Iustin Pop | , ("OpNodeEvacuate", |
287 | c66f09f5 | Iustin Pop | [ pEarlyRelease |
288 | c66f09f5 | Iustin Pop | , pNodeName |
289 | 1c3231aa | Thomas Thrainer | , pNodeUuid |
290 | c66f09f5 | Iustin Pop | , pRemoteNode |
291 | 1c3231aa | Thomas Thrainer | , pRemoteNodeUuid |
292 | c66f09f5 | Iustin Pop | , pIallocator |
293 | c66f09f5 | Iustin Pop | , pEvacMode |
294 | c66f09f5 | Iustin Pop | ]) |
295 | 6d558717 | Iustin Pop | , ("OpInstanceCreate", |
296 | 6d558717 | Iustin Pop | [ pInstanceName |
297 | 6d558717 | Iustin Pop | , pForceVariant |
298 | 6d558717 | Iustin Pop | , pWaitForSync |
299 | 6d558717 | Iustin Pop | , pNameCheck |
300 | 6d558717 | Iustin Pop | , pIgnoreIpolicy |
301 | 6d558717 | Iustin Pop | , pInstBeParams |
302 | 6d558717 | Iustin Pop | , pInstDisks |
303 | 6d558717 | Iustin Pop | , pDiskTemplate |
304 | 6d558717 | Iustin Pop | , pFileDriver |
305 | 6d558717 | Iustin Pop | , pFileStorageDir |
306 | 6d558717 | Iustin Pop | , pInstHvParams |
307 | 6d558717 | Iustin Pop | , pHypervisor |
308 | 6d558717 | Iustin Pop | , pIallocator |
309 | 6d558717 | Iustin Pop | , pResetDefaults |
310 | 6d558717 | Iustin Pop | , pIpCheck |
311 | 6d558717 | Iustin Pop | , pIpConflictsCheck |
312 | 6d558717 | Iustin Pop | , pInstCreateMode |
313 | 6d558717 | Iustin Pop | , pInstNics |
314 | 6d558717 | Iustin Pop | , pNoInstall |
315 | 6d558717 | Iustin Pop | , pInstOsParams |
316 | 6d558717 | Iustin Pop | , pInstOs |
317 | 6d558717 | Iustin Pop | , pPrimaryNode |
318 | 1c3231aa | Thomas Thrainer | , pPrimaryNodeUuid |
319 | 6d558717 | Iustin Pop | , pSecondaryNode |
320 | 1c3231aa | Thomas Thrainer | , pSecondaryNodeUuid |
321 | 6d558717 | Iustin Pop | , pSourceHandshake |
322 | 6d558717 | Iustin Pop | , pSourceInstance |
323 | 6d558717 | Iustin Pop | , pSourceShutdownTimeout |
324 | 6d558717 | Iustin Pop | , pSourceX509Ca |
325 | 6d558717 | Iustin Pop | , pSrcNode |
326 | 1c3231aa | Thomas Thrainer | , pSrcNodeUuid |
327 | 6d558717 | Iustin Pop | , pSrcPath |
328 | 6d558717 | Iustin Pop | , pStartInstance |
329 | 1f1188c3 | Michael Hanselmann | , pOpportunisticLocking |
330 | 6d558717 | Iustin Pop | , pInstTags |
331 | 6d558717 | Iustin Pop | ]) |
332 | c2d3219b | Iustin Pop | , ("OpInstanceMultiAlloc", |
333 | c2d3219b | Iustin Pop | [ pIallocator |
334 | c2d3219b | Iustin Pop | , pMultiAllocInstances |
335 | c298ed02 | Michael Hanselmann | , pOpportunisticLocking |
336 | c2d3219b | Iustin Pop | ]) |
337 | c2d3219b | Iustin Pop | , ("OpInstanceReinstall", |
338 | c2d3219b | Iustin Pop | [ pInstanceName |
339 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
340 | c2d3219b | Iustin Pop | , pForceVariant |
341 | c2d3219b | Iustin Pop | , pInstOs |
342 | c2d3219b | Iustin Pop | , pTempOsParams |
343 | c2d3219b | Iustin Pop | ]) |
344 | c2d3219b | Iustin Pop | , ("OpInstanceRemove", |
345 | c2d3219b | Iustin Pop | [ pInstanceName |
346 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
347 | c2d3219b | Iustin Pop | , pShutdownTimeout |
348 | c2d3219b | Iustin Pop | , pIgnoreFailures |
349 | c2d3219b | Iustin Pop | ]) |
350 | c2d3219b | Iustin Pop | , ("OpInstanceRename", |
351 | c2d3219b | Iustin Pop | [ pInstanceName |
352 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
353 | c2d3219b | Iustin Pop | , pNewName |
354 | c2d3219b | Iustin Pop | , pNameCheck |
355 | c2d3219b | Iustin Pop | , pIpCheck |
356 | c2d3219b | Iustin Pop | ]) |
357 | c2d3219b | Iustin Pop | , ("OpInstanceStartup", |
358 | c2d3219b | Iustin Pop | [ pInstanceName |
359 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
360 | c2d3219b | Iustin Pop | , pForce |
361 | c2d3219b | Iustin Pop | , pIgnoreOfflineNodes |
362 | c2d3219b | Iustin Pop | , pTempHvParams |
363 | c2d3219b | Iustin Pop | , pTempBeParams |
364 | c2d3219b | Iustin Pop | , pNoRemember |
365 | c2d3219b | Iustin Pop | , pStartupPaused |
366 | c2d3219b | Iustin Pop | ]) |
367 | c2d3219b | Iustin Pop | , ("OpInstanceShutdown", |
368 | c2d3219b | Iustin Pop | [ pInstanceName |
369 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
370 | 0d57ce24 | Guido Trotter | , pForce |
371 | c2d3219b | Iustin Pop | , pIgnoreOfflineNodes |
372 | c2d3219b | Iustin Pop | , pShutdownTimeout' |
373 | c2d3219b | Iustin Pop | , pNoRemember |
374 | c2d3219b | Iustin Pop | ]) |
375 | c2d3219b | Iustin Pop | , ("OpInstanceReboot", |
376 | c2d3219b | Iustin Pop | [ pInstanceName |
377 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
378 | c2d3219b | Iustin Pop | , pShutdownTimeout |
379 | c2d3219b | Iustin Pop | , pIgnoreSecondaries |
380 | c2d3219b | Iustin Pop | , pRebootType |
381 | c2d3219b | Iustin Pop | ]) |
382 | c2d3219b | Iustin Pop | , ("OpInstanceMove", |
383 | c2d3219b | Iustin Pop | [ pInstanceName |
384 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
385 | c2d3219b | Iustin Pop | , pShutdownTimeout |
386 | c2d3219b | Iustin Pop | , pIgnoreIpolicy |
387 | c2d3219b | Iustin Pop | , pMoveTargetNode |
388 | 1c3231aa | Thomas Thrainer | , pMoveTargetNodeUuid |
389 | c2d3219b | Iustin Pop | , pIgnoreConsistency |
390 | c2d3219b | Iustin Pop | ]) |
391 | c2d3219b | Iustin Pop | , ("OpInstanceConsole", |
392 | da4a52a3 | Thomas Thrainer | [ pInstanceName |
393 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
394 | da4a52a3 | Thomas Thrainer | ]) |
395 | c2d3219b | Iustin Pop | , ("OpInstanceActivateDisks", |
396 | c2d3219b | Iustin Pop | [ pInstanceName |
397 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
398 | c2d3219b | Iustin Pop | , pIgnoreDiskSize |
399 | c2d3219b | Iustin Pop | , pWaitForSyncFalse |
400 | c2d3219b | Iustin Pop | ]) |
401 | c2d3219b | Iustin Pop | , ("OpInstanceDeactivateDisks", |
402 | c2d3219b | Iustin Pop | [ pInstanceName |
403 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
404 | c2d3219b | Iustin Pop | , pForce |
405 | c2d3219b | Iustin Pop | ]) |
406 | c2d3219b | Iustin Pop | , ("OpInstanceRecreateDisks", |
407 | c2d3219b | Iustin Pop | [ pInstanceName |
408 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
409 | c2d3219b | Iustin Pop | , pRecreateDisksInfo |
410 | c2d3219b | Iustin Pop | , pNodes |
411 | 1c3231aa | Thomas Thrainer | , pNodeUuids |
412 | c2d3219b | Iustin Pop | , pIallocator |
413 | c2d3219b | Iustin Pop | ]) |
414 | 3131adc7 | Iustin Pop | , ("OpInstanceQuery", dOldQuery) |
415 | c2d3219b | Iustin Pop | , ("OpInstanceQueryData", |
416 | c2d3219b | Iustin Pop | [ pUseLocking |
417 | c2d3219b | Iustin Pop | , pInstances |
418 | c2d3219b | Iustin Pop | , pStatic |
419 | c2d3219b | Iustin Pop | ]) |
420 | c2d3219b | Iustin Pop | , ("OpInstanceSetParams", |
421 | c2d3219b | Iustin Pop | [ pInstanceName |
422 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
423 | c2d3219b | Iustin Pop | , pForce |
424 | c2d3219b | Iustin Pop | , pForceVariant |
425 | c2d3219b | Iustin Pop | , pIgnoreIpolicy |
426 | c2d3219b | Iustin Pop | , pInstParamsNicChanges |
427 | c2d3219b | Iustin Pop | , pInstParamsDiskChanges |
428 | c2d3219b | Iustin Pop | , pInstBeParams |
429 | c2d3219b | Iustin Pop | , pRuntimeMem |
430 | c2d3219b | Iustin Pop | , pInstHvParams |
431 | 88127c47 | Iustin Pop | , pOptDiskTemplate |
432 | d2204b1a | Klaus Aehlig | , pPrimaryNode |
433 | 1c3231aa | Thomas Thrainer | , pPrimaryNodeUuid |
434 | c2d3219b | Iustin Pop | , pRemoteNode |
435 | 1c3231aa | Thomas Thrainer | , pRemoteNodeUuid |
436 | c2d3219b | Iustin Pop | , pOsNameChange |
437 | c2d3219b | Iustin Pop | , pInstOsParams |
438 | c2d3219b | Iustin Pop | , pWaitForSync |
439 | c2d3219b | Iustin Pop | , pOffline |
440 | c2d3219b | Iustin Pop | , pIpConflictsCheck |
441 | c2d3219b | Iustin Pop | ]) |
442 | c2d3219b | Iustin Pop | , ("OpInstanceGrowDisk", |
443 | c2d3219b | Iustin Pop | [ pInstanceName |
444 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
445 | c2d3219b | Iustin Pop | , pWaitForSync |
446 | c2d3219b | Iustin Pop | , pDiskIndex |
447 | c2d3219b | Iustin Pop | , pDiskChgAmount |
448 | c2d3219b | Iustin Pop | , pDiskChgAbsolute |
449 | c2d3219b | Iustin Pop | ]) |
450 | c2d3219b | Iustin Pop | , ("OpInstanceChangeGroup", |
451 | c2d3219b | Iustin Pop | [ pInstanceName |
452 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
453 | c2d3219b | Iustin Pop | , pEarlyRelease |
454 | c2d3219b | Iustin Pop | , pIallocator |
455 | c2d3219b | Iustin Pop | , pTargetGroups |
456 | c2d3219b | Iustin Pop | ]) |
457 | 398e9066 | Iustin Pop | , ("OpGroupAdd", |
458 | 398e9066 | Iustin Pop | [ pGroupName |
459 | 398e9066 | Iustin Pop | , pNodeGroupAllocPolicy |
460 | 398e9066 | Iustin Pop | , pGroupNodeParams |
461 | 398e9066 | Iustin Pop | , pDiskParams |
462 | 398e9066 | Iustin Pop | , pHvState |
463 | 398e9066 | Iustin Pop | , pDiskState |
464 | 398e9066 | Iustin Pop | , pIpolicy |
465 | 398e9066 | Iustin Pop | ]) |
466 | 398e9066 | Iustin Pop | , ("OpGroupAssignNodes", |
467 | 398e9066 | Iustin Pop | [ pGroupName |
468 | 398e9066 | Iustin Pop | , pForce |
469 | 398e9066 | Iustin Pop | , pRequiredNodes |
470 | 1c3231aa | Thomas Thrainer | , pRequiredNodeUuids |
471 | 398e9066 | Iustin Pop | ]) |
472 | 3131adc7 | Iustin Pop | , ("OpGroupQuery", dOldQueryNoLocking) |
473 | 398e9066 | Iustin Pop | , ("OpGroupSetParams", |
474 | 398e9066 | Iustin Pop | [ pGroupName |
475 | 398e9066 | Iustin Pop | , pNodeGroupAllocPolicy |
476 | 398e9066 | Iustin Pop | , pGroupNodeParams |
477 | 398e9066 | Iustin Pop | , pDiskParams |
478 | 398e9066 | Iustin Pop | , pHvState |
479 | 398e9066 | Iustin Pop | , pDiskState |
480 | 398e9066 | Iustin Pop | , pIpolicy |
481 | 398e9066 | Iustin Pop | ]) |
482 | 398e9066 | Iustin Pop | , ("OpGroupRemove", |
483 | 398e9066 | Iustin Pop | [ pGroupName ]) |
484 | 398e9066 | Iustin Pop | , ("OpGroupRename", |
485 | 398e9066 | Iustin Pop | [ pGroupName |
486 | 398e9066 | Iustin Pop | , pNewName |
487 | 398e9066 | Iustin Pop | ]) |
488 | 398e9066 | Iustin Pop | , ("OpGroupEvacuate", |
489 | 398e9066 | Iustin Pop | [ pGroupName |
490 | 398e9066 | Iustin Pop | , pEarlyRelease |
491 | 398e9066 | Iustin Pop | , pIallocator |
492 | 398e9066 | Iustin Pop | , pTargetGroups |
493 | 398e9066 | Iustin Pop | ]) |
494 | 398e9066 | Iustin Pop | , ("OpOsDiagnose", |
495 | 398e9066 | Iustin Pop | [ pOutputFields |
496 | 398e9066 | Iustin Pop | , pNames ]) |
497 | b954f097 | Constantinos Venetsanopoulos | , ("OpExtStorageDiagnose", |
498 | b954f097 | Constantinos Venetsanopoulos | [ pOutputFields |
499 | b954f097 | Constantinos Venetsanopoulos | , pNames ]) |
500 | 398e9066 | Iustin Pop | , ("OpBackupQuery", |
501 | 398e9066 | Iustin Pop | [ pUseLocking |
502 | 398e9066 | Iustin Pop | , pNodes |
503 | 398e9066 | Iustin Pop | ]) |
504 | 398e9066 | Iustin Pop | , ("OpBackupPrepare", |
505 | 398e9066 | Iustin Pop | [ pInstanceName |
506 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
507 | 398e9066 | Iustin Pop | , pExportMode |
508 | 398e9066 | Iustin Pop | ]) |
509 | 398e9066 | Iustin Pop | , ("OpBackupExport", |
510 | 398e9066 | Iustin Pop | [ pInstanceName |
511 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
512 | 398e9066 | Iustin Pop | , pShutdownTimeout |
513 | 398e9066 | Iustin Pop | , pExportTargetNode |
514 | 1c3231aa | Thomas Thrainer | , pExportTargetNodeUuid |
515 | 67fc4de7 | Iustin Pop | , pShutdownInstance |
516 | 398e9066 | Iustin Pop | , pRemoveInstance |
517 | 398e9066 | Iustin Pop | , pIgnoreRemoveFailures |
518 | 398e9066 | Iustin Pop | , pExportMode |
519 | 398e9066 | Iustin Pop | , pX509KeyName |
520 | 398e9066 | Iustin Pop | , pX509DestCA |
521 | 398e9066 | Iustin Pop | ]) |
522 | 398e9066 | Iustin Pop | , ("OpBackupRemove", |
523 | da4a52a3 | Thomas Thrainer | [ pInstanceName |
524 | da4a52a3 | Thomas Thrainer | , pInstanceUuid |
525 | da4a52a3 | Thomas Thrainer | ]) |
526 | a3f02317 | Iustin Pop | , ("OpTestAllocator", |
527 | a3f02317 | Iustin Pop | [ pIAllocatorDirection |
528 | a3f02317 | Iustin Pop | , pIAllocatorMode |
529 | a3f02317 | Iustin Pop | , pIAllocatorReqName |
530 | a3f02317 | Iustin Pop | , pIAllocatorNics |
531 | a3f02317 | Iustin Pop | , pIAllocatorDisks |
532 | a3f02317 | Iustin Pop | , pHypervisor |
533 | a3f02317 | Iustin Pop | , pIallocator |
534 | a3f02317 | Iustin Pop | , pInstTags |
535 | a3f02317 | Iustin Pop | , pIAllocatorMemory |
536 | a3f02317 | Iustin Pop | , pIAllocatorVCpus |
537 | a3f02317 | Iustin Pop | , pIAllocatorOs |
538 | a3f02317 | Iustin Pop | , pDiskTemplate |
539 | a3f02317 | Iustin Pop | , pIAllocatorInstances |
540 | a3f02317 | Iustin Pop | , pIAllocatorEvacMode |
541 | a3f02317 | Iustin Pop | , pTargetGroups |
542 | a3f02317 | Iustin Pop | , pIAllocatorSpindleUse |
543 | a3f02317 | Iustin Pop | , pIAllocatorCount |
544 | a3f02317 | Iustin Pop | ]) |
545 | a3f02317 | Iustin Pop | , ("OpTestJqueue", |
546 | a3f02317 | Iustin Pop | [ pJQueueNotifyWaitLock |
547 | a3f02317 | Iustin Pop | , pJQueueNotifyExec |
548 | a3f02317 | Iustin Pop | , pJQueueLogMessages |
549 | a3f02317 | Iustin Pop | , pJQueueFail |
550 | a3f02317 | Iustin Pop | ]) |
551 | a3f02317 | Iustin Pop | , ("OpTestDummy", |
552 | a3f02317 | Iustin Pop | [ pTestDummyResult |
553 | a3f02317 | Iustin Pop | , pTestDummyMessages |
554 | a3f02317 | Iustin Pop | , pTestDummyFail |
555 | a3f02317 | Iustin Pop | , pTestDummySubmitJobs |
556 | a3f02317 | Iustin Pop | ]) |
557 | 8d239fa4 | Iustin Pop | , ("OpNetworkAdd", |
558 | 8d239fa4 | Iustin Pop | [ pNetworkName |
559 | 8d239fa4 | Iustin Pop | , pNetworkAddress4 |
560 | 8d239fa4 | Iustin Pop | , pNetworkGateway4 |
561 | 8d239fa4 | Iustin Pop | , pNetworkAddress6 |
562 | 8d239fa4 | Iustin Pop | , pNetworkGateway6 |
563 | 8d239fa4 | Iustin Pop | , pNetworkMacPrefix |
564 | 8d239fa4 | Iustin Pop | , pNetworkAddRsvdIps |
565 | 1dbceab9 | Iustin Pop | , pIpConflictsCheck |
566 | 8d239fa4 | Iustin Pop | , pInstTags |
567 | 8d239fa4 | Iustin Pop | ]) |
568 | 8d239fa4 | Iustin Pop | , ("OpNetworkRemove", |
569 | 8d239fa4 | Iustin Pop | [ pNetworkName |
570 | 8d239fa4 | Iustin Pop | , pForce |
571 | 8d239fa4 | Iustin Pop | ]) |
572 | 8d239fa4 | Iustin Pop | , ("OpNetworkSetParams", |
573 | 8d239fa4 | Iustin Pop | [ pNetworkName |
574 | 8d239fa4 | Iustin Pop | , pNetworkGateway4 |
575 | 8d239fa4 | Iustin Pop | , pNetworkAddress6 |
576 | 8d239fa4 | Iustin Pop | , pNetworkGateway6 |
577 | 8d239fa4 | Iustin Pop | , pNetworkMacPrefix |
578 | 8d239fa4 | Iustin Pop | , pNetworkAddRsvdIps |
579 | 8d239fa4 | Iustin Pop | , pNetworkRemoveRsvdIps |
580 | 8d239fa4 | Iustin Pop | ]) |
581 | 8d239fa4 | Iustin Pop | , ("OpNetworkConnect", |
582 | 8d239fa4 | Iustin Pop | [ pGroupName |
583 | 8d239fa4 | Iustin Pop | , pNetworkName |
584 | 8d239fa4 | Iustin Pop | , pNetworkMode |
585 | 8d239fa4 | Iustin Pop | , pNetworkLink |
586 | 8d239fa4 | Iustin Pop | , pIpConflictsCheck |
587 | 8d239fa4 | Iustin Pop | ]) |
588 | 8d239fa4 | Iustin Pop | , ("OpNetworkDisconnect", |
589 | 8d239fa4 | Iustin Pop | [ pGroupName |
590 | 8d239fa4 | Iustin Pop | , pNetworkName |
591 | 8d239fa4 | Iustin Pop | ]) |
592 | 8d459129 | Michael Hanselmann | , ("OpNetworkQuery", dOldQuery) |
593 | 1cd563e2 | Iustin Pop | , ("OpRestrictedCommand", |
594 | 1cd563e2 | Iustin Pop | [ pUseLocking |
595 | 1cd563e2 | Iustin Pop | , pRequiredNodes |
596 | 1c3231aa | Thomas Thrainer | , pRequiredNodeUuids |
597 | 1cd563e2 | Iustin Pop | , pRestrictedCommand |
598 | 1cd563e2 | Iustin Pop | ]) |
599 | ebf38064 | Iustin Pop | ]) |
600 | 12c19659 | Iustin Pop | |
601 | a583ec5d | Iustin Pop | -- | Returns the OP_ID for a given opcode value. |
602 | 12c19659 | Iustin Pop | $(genOpID ''OpCode "opID") |
603 | 702a4ee0 | Iustin Pop | |
604 | a583ec5d | Iustin Pop | -- | A list of all defined/supported opcode IDs. |
605 | a583ec5d | Iustin Pop | $(genAllOpIDs ''OpCode "allOpIDs") |
606 | a583ec5d | Iustin Pop | |
607 | 702a4ee0 | Iustin Pop | instance JSON OpCode where |
608 | ebf38064 | Iustin Pop | readJSON = loadOpCode |
609 | ebf38064 | Iustin Pop | showJSON = saveOpCode |
610 | 4a826364 | Iustin Pop | |
611 | ad1c1e41 | Iustin Pop | -- | Generates the summary value for an opcode. |
612 | ad1c1e41 | Iustin Pop | opSummaryVal :: OpCode -> Maybe String |
613 | ad1c1e41 | Iustin Pop | opSummaryVal OpClusterVerifyGroup { opGroupName = s } = Just (fromNonEmpty s) |
614 | ad1c1e41 | Iustin Pop | opSummaryVal OpGroupVerifyDisks { opGroupName = s } = Just (fromNonEmpty s) |
615 | ad1c1e41 | Iustin Pop | opSummaryVal OpClusterRename { opName = s } = Just (fromNonEmpty s) |
616 | ad1c1e41 | Iustin Pop | opSummaryVal OpQuery { opWhat = s } = Just (queryTypeOpToRaw s) |
617 | ad1c1e41 | Iustin Pop | opSummaryVal OpQueryFields { opWhat = s } = Just (queryTypeOpToRaw s) |
618 | ad1c1e41 | Iustin Pop | opSummaryVal OpNodeRemove { opNodeName = s } = Just (fromNonEmpty s) |
619 | ad1c1e41 | Iustin Pop | opSummaryVal OpNodeAdd { opNodeName = s } = Just (fromNonEmpty s) |
620 | ad1c1e41 | Iustin Pop | opSummaryVal OpNodeModifyStorage { opNodeName = s } = Just (fromNonEmpty s) |
621 | ad1c1e41 | Iustin Pop | opSummaryVal OpRepairNodeStorage { opNodeName = s } = Just (fromNonEmpty s) |
622 | ad1c1e41 | Iustin Pop | opSummaryVal OpNodeSetParams { opNodeName = s } = Just (fromNonEmpty s) |
623 | ad1c1e41 | Iustin Pop | opSummaryVal OpNodePowercycle { opNodeName = s } = Just (fromNonEmpty s) |
624 | ad1c1e41 | Iustin Pop | opSummaryVal OpNodeMigrate { opNodeName = s } = Just (fromNonEmpty s) |
625 | ad1c1e41 | Iustin Pop | opSummaryVal OpNodeEvacuate { opNodeName = s } = Just (fromNonEmpty s) |
626 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceCreate { opInstanceName = s } = Just s |
627 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceReinstall { opInstanceName = s } = Just s |
628 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceRemove { opInstanceName = s } = Just s |
629 | ad1c1e41 | Iustin Pop | -- FIXME: instance rename should show both names; currently it shows none |
630 | ad1c1e41 | Iustin Pop | -- opSummaryVal OpInstanceRename { opInstanceName = s } = Just s |
631 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceStartup { opInstanceName = s } = Just s |
632 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceShutdown { opInstanceName = s } = Just s |
633 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceReboot { opInstanceName = s } = Just s |
634 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceReplaceDisks { opInstanceName = s } = Just s |
635 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceFailover { opInstanceName = s } = Just s |
636 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceMigrate { opInstanceName = s } = Just s |
637 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceMove { opInstanceName = s } = Just s |
638 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceConsole { opInstanceName = s } = Just s |
639 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceActivateDisks { opInstanceName = s } = Just s |
640 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceDeactivateDisks { opInstanceName = s } = Just s |
641 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceRecreateDisks { opInstanceName = s } = Just s |
642 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceSetParams { opInstanceName = s } = Just s |
643 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceGrowDisk { opInstanceName = s } = Just s |
644 | ad1c1e41 | Iustin Pop | opSummaryVal OpInstanceChangeGroup { opInstanceName = s } = Just s |
645 | ad1c1e41 | Iustin Pop | opSummaryVal OpGroupAdd { opGroupName = s } = Just (fromNonEmpty s) |
646 | ad1c1e41 | Iustin Pop | opSummaryVal OpGroupAssignNodes { opGroupName = s } = Just (fromNonEmpty s) |
647 | ad1c1e41 | Iustin Pop | opSummaryVal OpGroupSetParams { opGroupName = s } = Just (fromNonEmpty s) |
648 | ad1c1e41 | Iustin Pop | opSummaryVal OpGroupRemove { opGroupName = s } = Just (fromNonEmpty s) |
649 | ad1c1e41 | Iustin Pop | opSummaryVal OpGroupEvacuate { opGroupName = s } = Just (fromNonEmpty s) |
650 | ad1c1e41 | Iustin Pop | opSummaryVal OpBackupPrepare { opInstanceName = s } = Just s |
651 | ad1c1e41 | Iustin Pop | opSummaryVal OpBackupExport { opInstanceName = s } = Just s |
652 | ad1c1e41 | Iustin Pop | opSummaryVal OpBackupRemove { opInstanceName = s } = Just s |
653 | ad1c1e41 | Iustin Pop | opSummaryVal OpTagsGet { opKind = k } = |
654 | ad1c1e41 | Iustin Pop | Just . fromMaybe "None" $ tagNameOf k |
655 | ad1c1e41 | Iustin Pop | opSummaryVal OpTagsSearch { opTagSearchPattern = s } = Just (fromNonEmpty s) |
656 | ad1c1e41 | Iustin Pop | opSummaryVal OpTestDelay { opDelayDuration = d } = Just (show d) |
657 | ad1c1e41 | Iustin Pop | opSummaryVal OpTestAllocator { opIallocator = s } = |
658 | ad1c1e41 | Iustin Pop | -- FIXME: Python doesn't handle None fields well, so we have behave the same |
659 | ad1c1e41 | Iustin Pop | Just $ maybe "None" fromNonEmpty s |
660 | ad1c1e41 | Iustin Pop | opSummaryVal OpNetworkAdd { opNetworkName = s} = Just (fromNonEmpty s) |
661 | ad1c1e41 | Iustin Pop | opSummaryVal OpNetworkRemove { opNetworkName = s} = Just (fromNonEmpty s) |
662 | ad1c1e41 | Iustin Pop | opSummaryVal OpNetworkSetParams { opNetworkName = s} = Just (fromNonEmpty s) |
663 | ad1c1e41 | Iustin Pop | opSummaryVal OpNetworkConnect { opNetworkName = s} = Just (fromNonEmpty s) |
664 | ad1c1e41 | Iustin Pop | opSummaryVal OpNetworkDisconnect { opNetworkName = s} = Just (fromNonEmpty s) |
665 | ad1c1e41 | Iustin Pop | opSummaryVal _ = Nothing |
666 | ad1c1e41 | Iustin Pop | |
667 | ad1c1e41 | Iustin Pop | -- | Computes the summary of the opcode. |
668 | ad1c1e41 | Iustin Pop | opSummary :: OpCode -> String |
669 | ad1c1e41 | Iustin Pop | opSummary op = |
670 | ad1c1e41 | Iustin Pop | case opSummaryVal op of |
671 | ad1c1e41 | Iustin Pop | Nothing -> op_suffix |
672 | ad1c1e41 | Iustin Pop | Just s -> op_suffix ++ "(" ++ s ++ ")" |
673 | ad1c1e41 | Iustin Pop | where op_suffix = drop 3 $ opID op |
674 | ad1c1e41 | Iustin Pop | |
675 | 4a826364 | Iustin Pop | -- | Generic\/common opcode parameters. |
676 | 4a826364 | Iustin Pop | $(buildObject "CommonOpParams" "op" |
677 | 4a826364 | Iustin Pop | [ pDryRun |
678 | 4a826364 | Iustin Pop | , pDebugLevel |
679 | 4a826364 | Iustin Pop | , pOpPriority |
680 | 4a826364 | Iustin Pop | , pDependencies |
681 | 4a826364 | Iustin Pop | , pComment |
682 | 516a0e94 | Michele Tartara | , pReason |
683 | 4a826364 | Iustin Pop | ]) |
684 | 4a826364 | Iustin Pop | |
685 | 4a826364 | Iustin Pop | -- | Default common parameter values. |
686 | 4a826364 | Iustin Pop | defOpParams :: CommonOpParams |
687 | 4a826364 | Iustin Pop | defOpParams = |
688 | 4a826364 | Iustin Pop | CommonOpParams { opDryRun = Nothing |
689 | 4a826364 | Iustin Pop | , opDebugLevel = Nothing |
690 | 4a826364 | Iustin Pop | , opPriority = OpPrioNormal |
691 | 4a826364 | Iustin Pop | , opDepends = Nothing |
692 | 4a826364 | Iustin Pop | , opComment = Nothing |
693 | 516a0e94 | Michele Tartara | , opReason = [] |
694 | 4a826364 | Iustin Pop | } |
695 | 4a826364 | Iustin Pop | |
696 | 4a826364 | Iustin Pop | -- | The top-level opcode type. |
697 | ad1c1e41 | Iustin Pop | data MetaOpCode = MetaOpCode { metaParams :: CommonOpParams |
698 | ad1c1e41 | Iustin Pop | , metaOpCode :: OpCode |
699 | ad1c1e41 | Iustin Pop | } deriving (Show, Eq) |
700 | 4a826364 | Iustin Pop | |
701 | 4a826364 | Iustin Pop | -- | JSON serialisation for 'MetaOpCode'. |
702 | 4a826364 | Iustin Pop | showMeta :: MetaOpCode -> JSValue |
703 | 4a826364 | Iustin Pop | showMeta (MetaOpCode params op) = |
704 | 4a826364 | Iustin Pop | let objparams = toDictCommonOpParams params |
705 | 4a826364 | Iustin Pop | objop = toDictOpCode op |
706 | 4a826364 | Iustin Pop | in makeObj (objparams ++ objop) |
707 | 4a826364 | Iustin Pop | |
708 | 4a826364 | Iustin Pop | -- | JSON deserialisation for 'MetaOpCode' |
709 | 4a826364 | Iustin Pop | readMeta :: JSValue -> Text.JSON.Result MetaOpCode |
710 | 4a826364 | Iustin Pop | readMeta v = do |
711 | 4a826364 | Iustin Pop | meta <- readJSON v |
712 | 4a826364 | Iustin Pop | op <- readJSON v |
713 | 4a826364 | Iustin Pop | return $ MetaOpCode meta op |
714 | 4a826364 | Iustin Pop | |
715 | 4a826364 | Iustin Pop | instance JSON MetaOpCode where |
716 | 4a826364 | Iustin Pop | showJSON = showMeta |
717 | 4a826364 | Iustin Pop | readJSON = readMeta |
718 | 4a826364 | Iustin Pop | |
719 | 4a826364 | Iustin Pop | -- | Wraps an 'OpCode' with the default parameters to build a |
720 | 4a826364 | Iustin Pop | -- 'MetaOpCode'. |
721 | 4a826364 | Iustin Pop | wrapOpCode :: OpCode -> MetaOpCode |
722 | 4a826364 | Iustin Pop | wrapOpCode = MetaOpCode defOpParams |
723 | 4a826364 | Iustin Pop | |
724 | 4a826364 | Iustin Pop | -- | Sets the comment on a meta opcode. |
725 | 4a826364 | Iustin Pop | setOpComment :: String -> MetaOpCode -> MetaOpCode |
726 | 4a826364 | Iustin Pop | setOpComment comment (MetaOpCode common op) = |
727 | 4a826364 | Iustin Pop | MetaOpCode (common { opComment = Just comment}) op |
728 | 551b44e2 | Iustin Pop | |
729 | 551b44e2 | Iustin Pop | -- | Sets the priority on a meta opcode. |
730 | 551b44e2 | Iustin Pop | setOpPriority :: OpSubmitPriority -> MetaOpCode -> MetaOpCode |
731 | 551b44e2 | Iustin Pop | setOpPriority prio (MetaOpCode common op) = |
732 | 551b44e2 | Iustin Pop | MetaOpCode (common { opPriority = prio }) op |