109 |
109 |
|
110 |
110 |
"""
|
111 |
111 |
OP_ID = "OP_ABSTRACT"
|
112 |
|
__slots__ = BaseOpCode.__slots__ + ["dry_run"]
|
|
112 |
__slots__ = ["dry_run"]
|
113 |
113 |
|
114 |
114 |
def __getstate__(self):
|
115 |
115 |
"""Specialized getstate for opcodes.
|
... | ... | |
178 |
178 |
|
179 |
179 |
"""
|
180 |
180 |
OP_ID = "OP_CLUSTER_POST_INIT"
|
181 |
|
__slots__ = OpCode.__slots__ + []
|
|
181 |
__slots__ = []
|
182 |
182 |
|
183 |
183 |
|
184 |
184 |
class OpDestroyCluster(OpCode):
|
... | ... | |
189 |
189 |
|
190 |
190 |
"""
|
191 |
191 |
OP_ID = "OP_CLUSTER_DESTROY"
|
192 |
|
__slots__ = OpCode.__slots__ + []
|
|
192 |
__slots__ = []
|
193 |
193 |
|
194 |
194 |
|
195 |
195 |
class OpQueryClusterInfo(OpCode):
|
196 |
196 |
"""Query cluster information."""
|
197 |
197 |
OP_ID = "OP_CLUSTER_QUERY"
|
198 |
|
__slots__ = OpCode.__slots__ + []
|
|
198 |
__slots__ = []
|
199 |
199 |
|
200 |
200 |
|
201 |
201 |
class OpVerifyCluster(OpCode):
|
... | ... | |
209 |
209 |
|
210 |
210 |
"""
|
211 |
211 |
OP_ID = "OP_CLUSTER_VERIFY"
|
212 |
|
__slots__ = OpCode.__slots__ + ["skip_checks", "verbose", "error_codes",
|
213 |
|
"debug_simulate_errors"]
|
|
212 |
__slots__ = ["skip_checks", "verbose", "error_codes",
|
|
213 |
"debug_simulate_errors"]
|
214 |
214 |
|
215 |
215 |
|
216 |
216 |
class OpVerifyDisks(OpCode):
|
... | ... | |
235 |
235 |
|
236 |
236 |
"""
|
237 |
237 |
OP_ID = "OP_CLUSTER_VERIFY_DISKS"
|
238 |
|
__slots__ = OpCode.__slots__ + []
|
|
238 |
__slots__ = []
|
239 |
239 |
|
240 |
240 |
|
241 |
241 |
class OpRepairDiskSizes(OpCode):
|
... | ... | |
261 |
261 |
class OpQueryConfigValues(OpCode):
|
262 |
262 |
"""Query cluster configuration values."""
|
263 |
263 |
OP_ID = "OP_CLUSTER_CONFIG_QUERY"
|
264 |
|
__slots__ = OpCode.__slots__ + ["output_fields"]
|
|
264 |
__slots__ = ["output_fields"]
|
265 |
265 |
|
266 |
266 |
|
267 |
267 |
class OpRenameCluster(OpCode):
|
... | ... | |
275 |
275 |
"""
|
276 |
276 |
OP_ID = "OP_CLUSTER_RENAME"
|
277 |
277 |
OP_DSC_FIELD = "name"
|
278 |
|
__slots__ = OpCode.__slots__ + ["name"]
|
|
278 |
__slots__ = ["name"]
|
279 |
279 |
|
280 |
280 |
|
281 |
281 |
class OpSetClusterParams(OpCode):
|
... | ... | |
286 |
286 |
|
287 |
287 |
"""
|
288 |
288 |
OP_ID = "OP_CLUSTER_SET_PARAMS"
|
289 |
|
__slots__ = OpCode.__slots__ + [
|
|
289 |
__slots__ = [
|
290 |
290 |
"vg_name",
|
291 |
291 |
"enabled_hypervisors",
|
292 |
292 |
"hvparams",
|
... | ... | |
301 |
301 |
|
302 |
302 |
"""
|
303 |
303 |
OP_ID = "OP_CLUSTER_REDIST_CONF"
|
304 |
|
__slots__ = OpCode.__slots__ + [
|
305 |
|
]
|
|
304 |
__slots__ = []
|
306 |
305 |
|
307 |
306 |
# node opcodes
|
308 |
307 |
|
... | ... | |
316 |
315 |
"""
|
317 |
316 |
OP_ID = "OP_NODE_REMOVE"
|
318 |
317 |
OP_DSC_FIELD = "node_name"
|
319 |
|
__slots__ = OpCode.__slots__ + ["node_name"]
|
|
318 |
__slots__ = ["node_name"]
|
320 |
319 |
|
321 |
320 |
|
322 |
321 |
class OpAddNode(OpCode):
|
... | ... | |
343 |
342 |
"""
|
344 |
343 |
OP_ID = "OP_NODE_ADD"
|
345 |
344 |
OP_DSC_FIELD = "node_name"
|
346 |
|
__slots__ = OpCode.__slots__ + [
|
347 |
|
"node_name", "primary_ip", "secondary_ip", "readd",
|
348 |
|
]
|
|
345 |
__slots__ = ["node_name", "primary_ip", "secondary_ip", "readd"]
|
349 |
346 |
|
350 |
347 |
|
351 |
348 |
class OpQueryNodes(OpCode):
|
352 |
349 |
"""Compute the list of nodes."""
|
353 |
350 |
OP_ID = "OP_NODE_QUERY"
|
354 |
|
__slots__ = OpCode.__slots__ + ["output_fields", "names", "use_locking"]
|
|
351 |
__slots__ = ["output_fields", "names", "use_locking"]
|
355 |
352 |
|
356 |
353 |
|
357 |
354 |
class OpQueryNodeVolumes(OpCode):
|
358 |
355 |
"""Get list of volumes on node."""
|
359 |
356 |
OP_ID = "OP_NODE_QUERYVOLS"
|
360 |
|
__slots__ = OpCode.__slots__ + ["nodes", "output_fields"]
|
|
357 |
__slots__ = ["nodes", "output_fields"]
|
361 |
358 |
|
362 |
359 |
|
363 |
360 |
class OpQueryNodeStorage(OpCode):
|
364 |
361 |
"""Get information on storage for node(s)."""
|
365 |
362 |
OP_ID = "OP_NODE_QUERY_STORAGE"
|
366 |
|
__slots__ = OpCode.__slots__ + [
|
|
363 |
__slots__ = [
|
367 |
364 |
"nodes",
|
368 |
365 |
"storage_type",
|
369 |
366 |
"name",
|
... | ... | |
374 |
371 |
class OpModifyNodeStorage(OpCode):
|
375 |
372 |
"""Modifies the properies of a storage unit"""
|
376 |
373 |
OP_ID = "OP_NODE_MODIFY_STORAGE"
|
377 |
|
__slots__ = OpCode.__slots__ + [
|
|
374 |
__slots__ = [
|
378 |
375 |
"node_name",
|
379 |
376 |
"storage_type",
|
380 |
377 |
"name",
|
... | ... | |
386 |
383 |
"""Repairs the volume group on a node."""
|
387 |
384 |
OP_ID = "OP_REPAIR_NODE_STORAGE"
|
388 |
385 |
OP_DSC_FIELD = "node_name"
|
389 |
|
__slots__ = OpCode.__slots__ + [
|
|
386 |
__slots__ = [
|
390 |
387 |
"node_name",
|
391 |
388 |
"storage_type",
|
392 |
389 |
"name",
|
... | ... | |
398 |
395 |
"""Change the parameters of a node."""
|
399 |
396 |
OP_ID = "OP_NODE_SET_PARAMS"
|
400 |
397 |
OP_DSC_FIELD = "node_name"
|
401 |
|
__slots__ = OpCode.__slots__ + [
|
|
398 |
__slots__ = [
|
402 |
399 |
"node_name",
|
403 |
400 |
"force",
|
404 |
401 |
"master_candidate",
|
... | ... | |
411 |
408 |
"""Tries to powercycle a node."""
|
412 |
409 |
OP_ID = "OP_NODE_POWERCYCLE"
|
413 |
410 |
OP_DSC_FIELD = "node_name"
|
414 |
|
__slots__ = OpCode.__slots__ + [
|
|
411 |
__slots__ = [
|
415 |
412 |
"node_name",
|
416 |
413 |
"force",
|
417 |
414 |
]
|
... | ... | |
421 |
418 |
"""Relocate secondary instances from a node."""
|
422 |
419 |
OP_ID = "OP_NODE_EVACUATE"
|
423 |
420 |
OP_DSC_FIELD = "node_name"
|
424 |
|
__slots__ = OpCode.__slots__ + [
|
|
421 |
__slots__ = [
|
425 |
422 |
"node_name", "remote_node", "iallocator",
|
426 |
423 |
]
|
427 |
424 |
|
... | ... | |
430 |
427 |
"""Migrate all instances from a node."""
|
431 |
428 |
OP_ID = "OP_NODE_MIGRATE"
|
432 |
429 |
OP_DSC_FIELD = "node_name"
|
433 |
|
__slots__ = OpCode.__slots__ + [
|
|
430 |
__slots__ = [
|
434 |
431 |
"node_name",
|
435 |
432 |
"live",
|
436 |
433 |
]
|
... | ... | |
442 |
439 |
"""Create an instance."""
|
443 |
440 |
OP_ID = "OP_INSTANCE_CREATE"
|
444 |
441 |
OP_DSC_FIELD = "instance_name"
|
445 |
|
__slots__ = OpCode.__slots__ + [
|
|
442 |
__slots__ = [
|
446 |
443 |
"instance_name", "os_type", "force_variant",
|
447 |
444 |
"pnode", "disk_template", "snode", "mode",
|
448 |
445 |
"disks", "nics",
|
... | ... | |
459 |
456 |
"""Reinstall an instance's OS."""
|
460 |
457 |
OP_ID = "OP_INSTANCE_REINSTALL"
|
461 |
458 |
OP_DSC_FIELD = "instance_name"
|
462 |
|
__slots__ = OpCode.__slots__ + ["instance_name", "os_type", "force_variant"]
|
|
459 |
__slots__ = ["instance_name", "os_type", "force_variant"]
|
463 |
460 |
|
464 |
461 |
|
465 |
462 |
class OpRemoveInstance(OpCode):
|
466 |
463 |
"""Remove an instance."""
|
467 |
464 |
OP_ID = "OP_INSTANCE_REMOVE"
|
468 |
465 |
OP_DSC_FIELD = "instance_name"
|
469 |
|
__slots__ = OpCode.__slots__ + [
|
|
466 |
__slots__ = [
|
470 |
467 |
"instance_name",
|
471 |
468 |
"ignore_failures",
|
472 |
469 |
"shutdown_timeout",
|
... | ... | |
476 |
473 |
class OpRenameInstance(OpCode):
|
477 |
474 |
"""Rename an instance."""
|
478 |
475 |
OP_ID = "OP_INSTANCE_RENAME"
|
479 |
|
__slots__ = OpCode.__slots__ + [
|
|
476 |
__slots__ = [
|
480 |
477 |
"instance_name", "ignore_ip", "new_name",
|
481 |
478 |
]
|
482 |
479 |
|
... | ... | |
485 |
482 |
"""Startup an instance."""
|
486 |
483 |
OP_ID = "OP_INSTANCE_STARTUP"
|
487 |
484 |
OP_DSC_FIELD = "instance_name"
|
488 |
|
__slots__ = OpCode.__slots__ + [
|
|
485 |
__slots__ = [
|
489 |
486 |
"instance_name", "force", "hvparams", "beparams",
|
490 |
487 |
]
|
491 |
488 |
|
... | ... | |
494 |
491 |
"""Shutdown an instance."""
|
495 |
492 |
OP_ID = "OP_INSTANCE_SHUTDOWN"
|
496 |
493 |
OP_DSC_FIELD = "instance_name"
|
497 |
|
__slots__ = OpCode.__slots__ + ["instance_name", "timeout"]
|
|
494 |
__slots__ = ["instance_name", "timeout"]
|
498 |
495 |
|
499 |
496 |
|
500 |
497 |
class OpRebootInstance(OpCode):
|
501 |
498 |
"""Reboot an instance."""
|
502 |
499 |
OP_ID = "OP_INSTANCE_REBOOT"
|
503 |
500 |
OP_DSC_FIELD = "instance_name"
|
504 |
|
__slots__ = OpCode.__slots__ + [
|
|
501 |
__slots__ = [
|
505 |
502 |
"instance_name", "reboot_type", "ignore_secondaries", "shutdown_timeout",
|
506 |
503 |
]
|
507 |
504 |
|
... | ... | |
510 |
507 |
"""Replace the disks of an instance."""
|
511 |
508 |
OP_ID = "OP_INSTANCE_REPLACE_DISKS"
|
512 |
509 |
OP_DSC_FIELD = "instance_name"
|
513 |
|
__slots__ = OpCode.__slots__ + [
|
|
510 |
__slots__ = [
|
514 |
511 |
"instance_name", "remote_node", "mode", "disks", "iallocator",
|
515 |
512 |
]
|
516 |
513 |
|
... | ... | |
519 |
516 |
"""Failover an instance."""
|
520 |
517 |
OP_ID = "OP_INSTANCE_FAILOVER"
|
521 |
518 |
OP_DSC_FIELD = "instance_name"
|
522 |
|
__slots__ = OpCode.__slots__ + [
|
|
519 |
__slots__ = [
|
523 |
520 |
"instance_name", "ignore_consistency", "shutdown_timeout",
|
524 |
521 |
]
|
525 |
522 |
|
... | ... | |
535 |
532 |
"""
|
536 |
533 |
OP_ID = "OP_INSTANCE_MIGRATE"
|
537 |
534 |
OP_DSC_FIELD = "instance_name"
|
538 |
|
__slots__ = OpCode.__slots__ + ["instance_name", "live", "cleanup"]
|
|
535 |
__slots__ = ["instance_name", "live", "cleanup"]
|
539 |
536 |
|
540 |
537 |
|
541 |
538 |
class OpMoveInstance(OpCode):
|
... | ... | |
550 |
547 |
"""
|
551 |
548 |
OP_ID = "OP_INSTANCE_MOVE"
|
552 |
549 |
OP_DSC_FIELD = "instance_name"
|
553 |
|
__slots__ = OpCode.__slots__ + [
|
|
550 |
__slots__ = [
|
554 |
551 |
"instance_name", "target_node", "shutdown_timeout",
|
555 |
|
]
|
|
552 |
]
|
556 |
553 |
|
557 |
554 |
|
558 |
555 |
class OpConnectConsole(OpCode):
|
559 |
556 |
"""Connect to an instance's console."""
|
560 |
557 |
OP_ID = "OP_INSTANCE_CONSOLE"
|
561 |
558 |
OP_DSC_FIELD = "instance_name"
|
562 |
|
__slots__ = OpCode.__slots__ + ["instance_name"]
|
|
559 |
__slots__ = ["instance_name"]
|
563 |
560 |
|
564 |
561 |
|
565 |
562 |
class OpActivateInstanceDisks(OpCode):
|
566 |
563 |
"""Activate an instance's disks."""
|
567 |
564 |
OP_ID = "OP_INSTANCE_ACTIVATE_DISKS"
|
568 |
565 |
OP_DSC_FIELD = "instance_name"
|
569 |
|
__slots__ = OpCode.__slots__ + ["instance_name", "ignore_size"]
|
|
566 |
__slots__ = ["instance_name", "ignore_size"]
|
570 |
567 |
|
571 |
568 |
|
572 |
569 |
class OpDeactivateInstanceDisks(OpCode):
|
573 |
570 |
"""Deactivate an instance's disks."""
|
574 |
571 |
OP_ID = "OP_INSTANCE_DEACTIVATE_DISKS"
|
575 |
572 |
OP_DSC_FIELD = "instance_name"
|
576 |
|
__slots__ = OpCode.__slots__ + ["instance_name"]
|
|
573 |
__slots__ = ["instance_name"]
|
577 |
574 |
|
578 |
575 |
|
579 |
576 |
class OpRecreateInstanceDisks(OpCode):
|
580 |
577 |
"""Deactivate an instance's disks."""
|
581 |
578 |
OP_ID = "OP_INSTANCE_RECREATE_DISKS"
|
582 |
579 |
OP_DSC_FIELD = "instance_name"
|
583 |
|
__slots__ = OpCode.__slots__ + ["instance_name", "disks"]
|
|
580 |
__slots__ = ["instance_name", "disks"]
|
584 |
581 |
|
585 |
582 |
|
586 |
583 |
class OpQueryInstances(OpCode):
|
587 |
584 |
"""Compute the list of instances."""
|
588 |
585 |
OP_ID = "OP_INSTANCE_QUERY"
|
589 |
|
__slots__ = OpCode.__slots__ + ["output_fields", "names", "use_locking"]
|
|
586 |
__slots__ = ["output_fields", "names", "use_locking"]
|
590 |
587 |
|
591 |
588 |
|
592 |
589 |
class OpQueryInstanceData(OpCode):
|
593 |
590 |
"""Compute the run-time status of instances."""
|
594 |
591 |
OP_ID = "OP_INSTANCE_QUERY_DATA"
|
595 |
|
__slots__ = OpCode.__slots__ + ["instances", "static"]
|
|
592 |
__slots__ = ["instances", "static"]
|
596 |
593 |
|
597 |
594 |
|
598 |
595 |
class OpSetInstanceParams(OpCode):
|
599 |
596 |
"""Change the parameters of an instance."""
|
600 |
597 |
OP_ID = "OP_INSTANCE_SET_PARAMS"
|
601 |
598 |
OP_DSC_FIELD = "instance_name"
|
602 |
|
__slots__ = OpCode.__slots__ + [
|
|
599 |
__slots__ = [
|
603 |
600 |
"instance_name",
|
604 |
601 |
"hvparams", "beparams", "force",
|
605 |
602 |
"nics", "disks",
|
... | ... | |
610 |
607 |
"""Grow a disk of an instance."""
|
611 |
608 |
OP_ID = "OP_INSTANCE_GROW_DISK"
|
612 |
609 |
OP_DSC_FIELD = "instance_name"
|
613 |
|
__slots__ = OpCode.__slots__ + [
|
|
610 |
__slots__ = [
|
614 |
611 |
"instance_name", "disk", "amount", "wait_for_sync",
|
615 |
612 |
]
|
616 |
613 |
|
... | ... | |
619 |
616 |
class OpDiagnoseOS(OpCode):
|
620 |
617 |
"""Compute the list of guest operating systems."""
|
621 |
618 |
OP_ID = "OP_OS_DIAGNOSE"
|
622 |
|
__slots__ = OpCode.__slots__ + ["output_fields", "names"]
|
|
619 |
__slots__ = ["output_fields", "names"]
|
623 |
620 |
|
624 |
621 |
|
625 |
622 |
# Exports opcodes
|
626 |
623 |
class OpQueryExports(OpCode):
|
627 |
624 |
"""Compute the list of exported images."""
|
628 |
625 |
OP_ID = "OP_BACKUP_QUERY"
|
629 |
|
__slots__ = OpCode.__slots__ + ["nodes", "use_locking"]
|
|
626 |
__slots__ = ["nodes", "use_locking"]
|
630 |
627 |
|
631 |
628 |
|
632 |
629 |
class OpExportInstance(OpCode):
|
633 |
630 |
"""Export an instance."""
|
634 |
631 |
OP_ID = "OP_BACKUP_EXPORT"
|
635 |
632 |
OP_DSC_FIELD = "instance_name"
|
636 |
|
__slots__ = OpCode.__slots__ + [
|
|
633 |
__slots__ = [
|
637 |
634 |
"instance_name", "target_node", "shutdown", "shutdown_timeout",
|
638 |
635 |
]
|
639 |
636 |
|
... | ... | |
642 |
639 |
"""Remove an instance's export."""
|
643 |
640 |
OP_ID = "OP_BACKUP_REMOVE"
|
644 |
641 |
OP_DSC_FIELD = "instance_name"
|
645 |
|
__slots__ = OpCode.__slots__ + ["instance_name"]
|
|
642 |
__slots__ = ["instance_name"]
|
646 |
643 |
|
647 |
644 |
|
648 |
645 |
# Tags opcodes
|
... | ... | |
650 |
647 |
"""Returns the tags of the given object."""
|
651 |
648 |
OP_ID = "OP_TAGS_GET"
|
652 |
649 |
OP_DSC_FIELD = "name"
|
653 |
|
__slots__ = OpCode.__slots__ + ["kind", "name"]
|
|
650 |
__slots__ = ["kind", "name"]
|
654 |
651 |
|
655 |
652 |
|
656 |
653 |
class OpSearchTags(OpCode):
|
657 |
654 |
"""Searches the tags in the cluster for a given pattern."""
|
658 |
655 |
OP_ID = "OP_TAGS_SEARCH"
|
659 |
656 |
OP_DSC_FIELD = "pattern"
|
660 |
|
__slots__ = OpCode.__slots__ + ["pattern"]
|
|
657 |
__slots__ = ["pattern"]
|
661 |
658 |
|
662 |
659 |
|
663 |
660 |
class OpAddTags(OpCode):
|
664 |
661 |
"""Add a list of tags on a given object."""
|
665 |
662 |
OP_ID = "OP_TAGS_SET"
|
666 |
|
__slots__ = OpCode.__slots__ + ["kind", "name", "tags"]
|
|
663 |
__slots__ = ["kind", "name", "tags"]
|
667 |
664 |
|
668 |
665 |
|
669 |
666 |
class OpDelTags(OpCode):
|
670 |
667 |
"""Remove a list of tags from a given object."""
|
671 |
668 |
OP_ID = "OP_TAGS_DEL"
|
672 |
|
__slots__ = OpCode.__slots__ + ["kind", "name", "tags"]
|
|
669 |
__slots__ = ["kind", "name", "tags"]
|
673 |
670 |
|
674 |
671 |
|
675 |
672 |
# Test opcodes
|
... | ... | |
696 |
693 |
"""
|
697 |
694 |
OP_ID = "OP_TEST_DELAY"
|
698 |
695 |
OP_DSC_FIELD = "duration"
|
699 |
|
__slots__ = OpCode.__slots__ + ["duration", "on_master", "on_nodes"]
|
|
696 |
__slots__ = ["duration", "on_master", "on_nodes"]
|
700 |
697 |
|
701 |
698 |
|
702 |
699 |
class OpTestAllocator(OpCode):
|
... | ... | |
712 |
709 |
"""
|
713 |
710 |
OP_ID = "OP_TEST_ALLOCATOR"
|
714 |
711 |
OP_DSC_FIELD = "allocator"
|
715 |
|
__slots__ = OpCode.__slots__ + [
|
|
712 |
__slots__ = [
|
716 |
713 |
"direction", "mode", "allocator", "name",
|
717 |
714 |
"mem_size", "disks", "disk_template",
|
718 |
715 |
"os", "tags", "nics", "vcpus", "hypervisor",
|