Revision 4f05fd3b lib/opcodes.py
b/lib/opcodes.py | ||
---|---|---|
107 | 107 |
|
108 | 108 |
""" |
109 | 109 |
OP_ID = "OP_ABSTRACT" |
110 |
__slots__ = [] |
|
110 |
__slots__ = BaseOpCode.__slots__ + []
|
|
111 | 111 |
|
112 | 112 |
def __getstate__(self): |
113 | 113 |
"""Specialized getstate for opcodes. |
... | ... | |
181 | 181 |
|
182 | 182 |
""" |
183 | 183 |
OP_ID = "OP_CLUSTER_DESTROY" |
184 |
__slots__ = [] |
|
184 |
__slots__ = OpCode.__slots__ + []
|
|
185 | 185 |
|
186 | 186 |
|
187 | 187 |
class OpQueryClusterInfo(OpCode): |
188 | 188 |
"""Query cluster information.""" |
189 | 189 |
OP_ID = "OP_CLUSTER_QUERY" |
190 |
__slots__ = [] |
|
190 |
__slots__ = OpCode.__slots__ + []
|
|
191 | 191 |
|
192 | 192 |
|
193 | 193 |
class OpVerifyCluster(OpCode): |
... | ... | |
201 | 201 |
|
202 | 202 |
""" |
203 | 203 |
OP_ID = "OP_CLUSTER_VERIFY" |
204 |
__slots__ = ["skip_checks"] |
|
204 |
__slots__ = OpCode.__slots__ + ["skip_checks"]
|
|
205 | 205 |
|
206 | 206 |
|
207 | 207 |
class OpVerifyDisks(OpCode): |
... | ... | |
226 | 226 |
|
227 | 227 |
""" |
228 | 228 |
OP_ID = "OP_CLUSTER_VERIFY_DISKS" |
229 |
__slots__ = [] |
|
229 |
__slots__ = OpCode.__slots__ + []
|
|
230 | 230 |
|
231 | 231 |
|
232 | 232 |
class OpQueryConfigValues(OpCode): |
233 | 233 |
"""Query cluster configuration values.""" |
234 | 234 |
OP_ID = "OP_CLUSTER_CONFIG_QUERY" |
235 |
__slots__ = ["output_fields"] |
|
235 |
__slots__ = OpCode.__slots__ + ["output_fields"]
|
|
236 | 236 |
|
237 | 237 |
|
238 | 238 |
class OpRenameCluster(OpCode): |
... | ... | |
246 | 246 |
""" |
247 | 247 |
OP_ID = "OP_CLUSTER_RENAME" |
248 | 248 |
OP_DSC_FIELD = "name" |
249 |
__slots__ = ["name"] |
|
249 |
__slots__ = OpCode.__slots__ + ["name"]
|
|
250 | 250 |
|
251 | 251 |
|
252 | 252 |
class OpSetClusterParams(OpCode): |
... | ... | |
257 | 257 |
|
258 | 258 |
""" |
259 | 259 |
OP_ID = "OP_CLUSTER_SET_PARAMS" |
260 |
__slots__ = [ |
|
260 |
__slots__ = OpCode.__slots__ + [
|
|
261 | 261 |
"vg_name", |
262 | 262 |
"enabled_hypervisors", |
263 | 263 |
"hvparams", |
... | ... | |
272 | 272 |
|
273 | 273 |
""" |
274 | 274 |
OP_ID = "OP_CLUSTER_REDIST_CONF" |
275 |
__slots__ = [ |
|
275 |
__slots__ = OpCode.__slots__ + [
|
|
276 | 276 |
] |
277 | 277 |
|
278 | 278 |
# node opcodes |
... | ... | |
287 | 287 |
""" |
288 | 288 |
OP_ID = "OP_NODE_REMOVE" |
289 | 289 |
OP_DSC_FIELD = "node_name" |
290 |
__slots__ = ["node_name"] |
|
290 |
__slots__ = OpCode.__slots__ + ["node_name"]
|
|
291 | 291 |
|
292 | 292 |
|
293 | 293 |
class OpAddNode(OpCode): |
... | ... | |
314 | 314 |
""" |
315 | 315 |
OP_ID = "OP_NODE_ADD" |
316 | 316 |
OP_DSC_FIELD = "node_name" |
317 |
__slots__ = ["node_name", "primary_ip", "secondary_ip", "readd"] |
|
317 |
__slots__ = OpCode.__slots__ + [ |
|
318 |
"node_name", "primary_ip", "secondary_ip", "readd", |
|
319 |
] |
|
318 | 320 |
|
319 | 321 |
|
320 | 322 |
class OpQueryNodes(OpCode): |
321 | 323 |
"""Compute the list of nodes.""" |
322 | 324 |
OP_ID = "OP_NODE_QUERY" |
323 |
__slots__ = ["output_fields", "names", "use_locking"] |
|
325 |
__slots__ = OpCode.__slots__ + ["output_fields", "names", "use_locking"]
|
|
324 | 326 |
|
325 | 327 |
|
326 | 328 |
class OpQueryNodeVolumes(OpCode): |
327 | 329 |
"""Get list of volumes on node.""" |
328 | 330 |
OP_ID = "OP_NODE_QUERYVOLS" |
329 |
__slots__ = ["nodes", "output_fields"] |
|
331 |
__slots__ = OpCode.__slots__ + ["nodes", "output_fields"]
|
|
330 | 332 |
|
331 | 333 |
|
332 | 334 |
class OpSetNodeParams(OpCode): |
333 | 335 |
"""Change the parameters of a node.""" |
334 | 336 |
OP_ID = "OP_NODE_SET_PARAMS" |
335 | 337 |
OP_DSC_FIELD = "node_name" |
336 |
__slots__ = [ |
|
338 |
__slots__ = OpCode.__slots__ + [
|
|
337 | 339 |
"node_name", |
338 | 340 |
"force", |
339 | 341 |
"master_candidate", |
... | ... | |
346 | 348 |
"""Tries to powercycle a node.""" |
347 | 349 |
OP_ID = "OP_NODE_POWERCYCLE" |
348 | 350 |
OP_DSC_FIELD = "node_name" |
349 |
__slots__ = [ |
|
351 |
__slots__ = OpCode.__slots__ + [
|
|
350 | 352 |
"node_name", |
351 | 353 |
"force", |
352 | 354 |
] |
... | ... | |
357 | 359 |
"""Create an instance.""" |
358 | 360 |
OP_ID = "OP_INSTANCE_CREATE" |
359 | 361 |
OP_DSC_FIELD = "instance_name" |
360 |
__slots__ = [ |
|
362 |
__slots__ = OpCode.__slots__ + [
|
|
361 | 363 |
"instance_name", "os_type", "pnode", |
362 | 364 |
"disk_template", "snode", "mode", |
363 | 365 |
"disks", "nics", |
... | ... | |
366 | 368 |
"file_storage_dir", "file_driver", |
367 | 369 |
"iallocator", |
368 | 370 |
"hypervisor", "hvparams", "beparams", |
371 |
"dry_run", |
|
369 | 372 |
] |
370 | 373 |
|
371 | 374 |
|
... | ... | |
373 | 376 |
"""Reinstall an instance's OS.""" |
374 | 377 |
OP_ID = "OP_INSTANCE_REINSTALL" |
375 | 378 |
OP_DSC_FIELD = "instance_name" |
376 |
__slots__ = ["instance_name", "os_type"] |
|
379 |
__slots__ = OpCode.__slots__ + ["instance_name", "os_type"]
|
|
377 | 380 |
|
378 | 381 |
|
379 | 382 |
class OpRemoveInstance(OpCode): |
380 | 383 |
"""Remove an instance.""" |
381 | 384 |
OP_ID = "OP_INSTANCE_REMOVE" |
382 | 385 |
OP_DSC_FIELD = "instance_name" |
383 |
__slots__ = ["instance_name", "ignore_failures"] |
|
386 |
__slots__ = OpCode.__slots__ + ["instance_name", "ignore_failures"]
|
|
384 | 387 |
|
385 | 388 |
|
386 | 389 |
class OpRenameInstance(OpCode): |
387 | 390 |
"""Rename an instance.""" |
388 | 391 |
OP_ID = "OP_INSTANCE_RENAME" |
389 |
__slots__ = ["instance_name", "ignore_ip", "new_name"] |
|
392 |
__slots__ = OpCode.__slots__ + [ |
|
393 |
"instance_name", "ignore_ip", "new_name", |
|
394 |
] |
|
390 | 395 |
|
391 | 396 |
|
392 | 397 |
class OpStartupInstance(OpCode): |
393 | 398 |
"""Startup an instance.""" |
394 | 399 |
OP_ID = "OP_INSTANCE_STARTUP" |
395 | 400 |
OP_DSC_FIELD = "instance_name" |
396 |
__slots__ = ["instance_name", "force", "hvparams", "beparams"] |
|
401 |
__slots__ = OpCode.__slots__ + [ |
|
402 |
"instance_name", "force", "hvparams", "beparams", |
|
403 |
] |
|
397 | 404 |
|
398 | 405 |
|
399 | 406 |
class OpShutdownInstance(OpCode): |
400 | 407 |
"""Shutdown an instance.""" |
401 | 408 |
OP_ID = "OP_INSTANCE_SHUTDOWN" |
402 | 409 |
OP_DSC_FIELD = "instance_name" |
403 |
__slots__ = ["instance_name"] |
|
410 |
__slots__ = OpCode.__slots__ + ["instance_name"]
|
|
404 | 411 |
|
405 | 412 |
|
406 | 413 |
class OpRebootInstance(OpCode): |
407 | 414 |
"""Reboot an instance.""" |
408 | 415 |
OP_ID = "OP_INSTANCE_REBOOT" |
409 | 416 |
OP_DSC_FIELD = "instance_name" |
410 |
__slots__ = ["instance_name", "reboot_type", "ignore_secondaries" ] |
|
417 |
__slots__ = OpCode.__slots__ + [ |
|
418 |
"instance_name", "reboot_type", "ignore_secondaries", |
|
419 |
] |
|
411 | 420 |
|
412 | 421 |
|
413 | 422 |
class OpReplaceDisks(OpCode): |
414 | 423 |
"""Replace the disks of an instance.""" |
415 | 424 |
OP_ID = "OP_INSTANCE_REPLACE_DISKS" |
416 | 425 |
OP_DSC_FIELD = "instance_name" |
417 |
__slots__ = ["instance_name", "remote_node", "mode", "disks", "iallocator"] |
|
426 |
__slots__ = OpCode.__slots__ + [ |
|
427 |
"instance_name", "remote_node", "mode", "disks", "iallocator", |
|
428 |
] |
|
418 | 429 |
|
419 | 430 |
|
420 | 431 |
class OpFailoverInstance(OpCode): |
421 | 432 |
"""Failover an instance.""" |
422 | 433 |
OP_ID = "OP_INSTANCE_FAILOVER" |
423 | 434 |
OP_DSC_FIELD = "instance_name" |
424 |
__slots__ = ["instance_name", "ignore_consistency"] |
|
435 |
__slots__ = OpCode.__slots__ + ["instance_name", "ignore_consistency"]
|
|
425 | 436 |
|
426 | 437 |
|
427 | 438 |
class OpMigrateInstance(OpCode): |
... | ... | |
435 | 446 |
""" |
436 | 447 |
OP_ID = "OP_INSTANCE_MIGRATE" |
437 | 448 |
OP_DSC_FIELD = "instance_name" |
438 |
__slots__ = ["instance_name", "live", "cleanup"] |
|
449 |
__slots__ = OpCode.__slots__ + ["instance_name", "live", "cleanup"]
|
|
439 | 450 |
|
440 | 451 |
|
441 | 452 |
class OpConnectConsole(OpCode): |
442 | 453 |
"""Connect to an instance's console.""" |
443 | 454 |
OP_ID = "OP_INSTANCE_CONSOLE" |
444 | 455 |
OP_DSC_FIELD = "instance_name" |
445 |
__slots__ = ["instance_name"] |
|
456 |
__slots__ = OpCode.__slots__ + ["instance_name"]
|
|
446 | 457 |
|
447 | 458 |
|
448 | 459 |
class OpActivateInstanceDisks(OpCode): |
449 | 460 |
"""Activate an instance's disks.""" |
450 | 461 |
OP_ID = "OP_INSTANCE_ACTIVATE_DISKS" |
451 | 462 |
OP_DSC_FIELD = "instance_name" |
452 |
__slots__ = ["instance_name"] |
|
463 |
__slots__ = OpCode.__slots__ + ["instance_name"]
|
|
453 | 464 |
|
454 | 465 |
|
455 | 466 |
class OpDeactivateInstanceDisks(OpCode): |
456 | 467 |
"""Deactivate an instance's disks.""" |
457 | 468 |
OP_ID = "OP_INSTANCE_DEACTIVATE_DISKS" |
458 | 469 |
OP_DSC_FIELD = "instance_name" |
459 |
__slots__ = ["instance_name"] |
|
470 |
__slots__ = OpCode.__slots__ + ["instance_name"]
|
|
460 | 471 |
|
461 | 472 |
|
462 | 473 |
class OpQueryInstances(OpCode): |
463 | 474 |
"""Compute the list of instances.""" |
464 | 475 |
OP_ID = "OP_INSTANCE_QUERY" |
465 |
__slots__ = ["output_fields", "names", "use_locking"] |
|
476 |
__slots__ = OpCode.__slots__ + ["output_fields", "names", "use_locking"]
|
|
466 | 477 |
|
467 | 478 |
|
468 | 479 |
class OpQueryInstanceData(OpCode): |
469 | 480 |
"""Compute the run-time status of instances.""" |
470 | 481 |
OP_ID = "OP_INSTANCE_QUERY_DATA" |
471 |
__slots__ = ["instances", "static"] |
|
482 |
__slots__ = OpCode.__slots__ + ["instances", "static"]
|
|
472 | 483 |
|
473 | 484 |
|
474 | 485 |
class OpSetInstanceParams(OpCode): |
475 | 486 |
"""Change the parameters of an instance.""" |
476 | 487 |
OP_ID = "OP_INSTANCE_SET_PARAMS" |
477 | 488 |
OP_DSC_FIELD = "instance_name" |
478 |
__slots__ = [ |
|
489 |
__slots__ = OpCode.__slots__ + [
|
|
479 | 490 |
"instance_name", |
480 | 491 |
"hvparams", "beparams", "force", |
481 | 492 |
"nics", "disks", |
... | ... | |
486 | 497 |
"""Grow a disk of an instance.""" |
487 | 498 |
OP_ID = "OP_INSTANCE_GROW_DISK" |
488 | 499 |
OP_DSC_FIELD = "instance_name" |
489 |
__slots__ = ["instance_name", "disk", "amount", "wait_for_sync"] |
|
500 |
__slots__ = OpCode.__slots__ + [ |
|
501 |
"instance_name", "disk", "amount", "wait_for_sync", |
|
502 |
] |
|
490 | 503 |
|
491 | 504 |
|
492 | 505 |
# OS opcodes |
493 | 506 |
class OpDiagnoseOS(OpCode): |
494 | 507 |
"""Compute the list of guest operating systems.""" |
495 | 508 |
OP_ID = "OP_OS_DIAGNOSE" |
496 |
__slots__ = ["output_fields", "names"] |
|
509 |
__slots__ = OpCode.__slots__ + ["output_fields", "names"]
|
|
497 | 510 |
|
498 | 511 |
|
499 | 512 |
# Exports opcodes |
500 | 513 |
class OpQueryExports(OpCode): |
501 | 514 |
"""Compute the list of exported images.""" |
502 | 515 |
OP_ID = "OP_BACKUP_QUERY" |
503 |
__slots__ = ["nodes", "use_locking"] |
|
516 |
__slots__ = OpCode.__slots__ + ["nodes", "use_locking"]
|
|
504 | 517 |
|
505 | 518 |
|
506 | 519 |
class OpExportInstance(OpCode): |
507 | 520 |
"""Export an instance.""" |
508 | 521 |
OP_ID = "OP_BACKUP_EXPORT" |
509 | 522 |
OP_DSC_FIELD = "instance_name" |
510 |
__slots__ = ["instance_name", "target_node", "shutdown"] |
|
523 |
__slots__ = OpCode.__slots__ + ["instance_name", "target_node", "shutdown"]
|
|
511 | 524 |
|
512 | 525 |
|
513 | 526 |
class OpRemoveExport(OpCode): |
514 | 527 |
"""Remove an instance's export.""" |
515 | 528 |
OP_ID = "OP_BACKUP_REMOVE" |
516 | 529 |
OP_DSC_FIELD = "instance_name" |
517 |
__slots__ = ["instance_name"] |
|
530 |
__slots__ = OpCode.__slots__ + ["instance_name"]
|
|
518 | 531 |
|
519 | 532 |
|
520 | 533 |
# Tags opcodes |
... | ... | |
522 | 535 |
"""Returns the tags of the given object.""" |
523 | 536 |
OP_ID = "OP_TAGS_GET" |
524 | 537 |
OP_DSC_FIELD = "name" |
525 |
__slots__ = ["kind", "name"] |
|
538 |
__slots__ = OpCode.__slots__ + ["kind", "name"]
|
|
526 | 539 |
|
527 | 540 |
|
528 | 541 |
class OpSearchTags(OpCode): |
529 | 542 |
"""Searches the tags in the cluster for a given pattern.""" |
530 | 543 |
OP_ID = "OP_TAGS_SEARCH" |
531 | 544 |
OP_DSC_FIELD = "pattern" |
532 |
__slots__ = ["pattern"] |
|
545 |
__slots__ = OpCode.__slots__ + ["pattern"]
|
|
533 | 546 |
|
534 | 547 |
|
535 | 548 |
class OpAddTags(OpCode): |
536 | 549 |
"""Add a list of tags on a given object.""" |
537 | 550 |
OP_ID = "OP_TAGS_SET" |
538 |
__slots__ = ["kind", "name", "tags"] |
|
551 |
__slots__ = OpCode.__slots__ + ["kind", "name", "tags"]
|
|
539 | 552 |
|
540 | 553 |
|
541 | 554 |
class OpDelTags(OpCode): |
542 | 555 |
"""Remove a list of tags from a given object.""" |
543 | 556 |
OP_ID = "OP_TAGS_DEL" |
544 |
__slots__ = ["kind", "name", "tags"] |
|
557 |
__slots__ = OpCode.__slots__ + ["kind", "name", "tags"]
|
|
545 | 558 |
|
546 | 559 |
|
547 | 560 |
# Test opcodes |
... | ... | |
568 | 581 |
""" |
569 | 582 |
OP_ID = "OP_TEST_DELAY" |
570 | 583 |
OP_DSC_FIELD = "duration" |
571 |
__slots__ = ["duration", "on_master", "on_nodes"] |
|
584 |
__slots__ = OpCode.__slots__ + ["duration", "on_master", "on_nodes"]
|
|
572 | 585 |
|
573 | 586 |
|
574 | 587 |
class OpTestAllocator(OpCode): |
... | ... | |
584 | 597 |
""" |
585 | 598 |
OP_ID = "OP_TEST_ALLOCATOR" |
586 | 599 |
OP_DSC_FIELD = "allocator" |
587 |
__slots__ = [ |
|
600 |
__slots__ = OpCode.__slots__ + [
|
|
588 | 601 |
"direction", "mode", "allocator", "name", |
589 | 602 |
"mem_size", "disks", "disk_template", |
590 | 603 |
"os", "tags", "nics", "vcpus", "hypervisor", |
Also available in: Unified diff