/usr/lib/python3/dist-packages/maasserver/enum.py is in python3-django-maas 2.4.0~beta2-6865-gec43e47e6-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 | # Copyright 2012-2018 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Enumerations meaningful to the maasserver application."""
__all__ = [
'CACHE_MODE_TYPE',
'CACHE_MODE_TYPE_CHOICES',
'COMPONENT',
'DEVICE_IP_ASSIGNMENT_TYPE',
'FILESYSTEM_GROUP_TYPE',
'FILESYSTEM_GROUP_TYPE_CHOICES',
'FILESYSTEM_TYPE',
'FILESYSTEM_TYPE_CHOICES',
'INTERFACE_TYPE',
'INTERFACE_TYPE_CHOICES',
'INTERFACE_TYPE_CHOICES_DICT',
'IPADDRESS_TYPE',
'NODE_PERMISSION',
'NODE_STATUS',
'NODE_STATUS_CHOICES',
'NODE_STATUS_CHOICES_DICT',
'PARTITION_TABLE_TYPE',
'PARTITION_TABLE_TYPE_CHOICES',
'PRESEED_TYPE',
'RDNS_MODE',
'RDNS_MODE_CHOICES',
'RDNS_MODE_CHOICES_DICT',
'USERDATA_TYPE',
'KEYS_PROTOCOL_TYPE',
'KEYS_PROTOCOL_TYPE_CHOICES',
]
from collections import OrderedDict
# *** IMPORTANT ***
# Note to all ye who enter here: comments beginning with #: are special
# to Sphinx. They are extracted and form part of the documentation of
# the field they directly precede.
class COMPONENT:
"""Major moving parts of the application that may have failure states."""
PSERV = 'provisioning server'
IMPORT_PXE_FILES = 'maas-import-pxe-files script'
RACK_CONTROLLERS = 'clusters'
REGION_IMAGE_IMPORT = 'Image importer'
class NODE_STATUS:
"""The vocabulary of a `Node`'s possible statuses."""
#: A node starts out as NEW (DEFAULT is an alias for NEW).
DEFAULT = 0
#: The node has been created and has a system ID assigned to it.
NEW = 0
#: Testing and other commissioning steps are taking place.
COMMISSIONING = 1
#: The commissioning step failed.
FAILED_COMMISSIONING = 2
#: The node can't be contacted.
MISSING = 3
#: The node is in the general pool ready to be deployed.
READY = 4
#: The node is ready for named deployment.
RESERVED = 5
#: The node has booted into the operating system of its owner's choice
#: and is ready for use.
DEPLOYED = 6
#: The node has been removed from service manually until an admin
#: overrides the retirement.
RETIRED = 7
#: The node is broken: a step in the node lifecyle failed.
#: More details can be found in the node's event log.
BROKEN = 8
#: The node is being installed.
DEPLOYING = 9
#: The node has been allocated to a user and is ready for deployment.
ALLOCATED = 10
#: The deployment of the node failed.
FAILED_DEPLOYMENT = 11
#: The node is powering down after a release request.
RELEASING = 12
#: The releasing of the node failed.
FAILED_RELEASING = 13
#: The node is erasing its disks.
DISK_ERASING = 14
#: The node failed to erase its disks.
FAILED_DISK_ERASING = 15
#: The node is in rescue mode.
RESCUE_MODE = 16
#: The node is entering rescue mode.
ENTERING_RESCUE_MODE = 17
#: The node failed to enter rescue mode.
FAILED_ENTERING_RESCUE_MODE = 18
#: The node is exiting rescue mode.
EXITING_RESCUE_MODE = 19
#: The node failed to exit rescue mode.
FAILED_EXITING_RESCUE_MODE = 20
#: Running tests on Node
TESTING = 21
#: Testing has failed
FAILED_TESTING = 22
# Django choices for NODE_STATUS: sequence of tuples (key, UI
# representation).
NODE_STATUS_CHOICES = (
(NODE_STATUS.NEW, "New"),
(NODE_STATUS.COMMISSIONING, "Commissioning"),
(NODE_STATUS.FAILED_COMMISSIONING, "Failed commissioning"),
(NODE_STATUS.MISSING, "Missing"),
(NODE_STATUS.READY, "Ready"),
(NODE_STATUS.RESERVED, "Reserved"),
(NODE_STATUS.ALLOCATED, "Allocated"),
(NODE_STATUS.DEPLOYING, "Deploying"),
(NODE_STATUS.DEPLOYED, "Deployed"),
(NODE_STATUS.RETIRED, "Retired"),
(NODE_STATUS.BROKEN, "Broken"),
(NODE_STATUS.FAILED_DEPLOYMENT, "Failed deployment"),
(NODE_STATUS.RELEASING, "Releasing"),
(NODE_STATUS.FAILED_RELEASING, "Releasing failed"),
(NODE_STATUS.DISK_ERASING, "Disk erasing"),
(NODE_STATUS.FAILED_DISK_ERASING, "Failed disk erasing"),
(NODE_STATUS.RESCUE_MODE, "Rescue mode"),
(NODE_STATUS.ENTERING_RESCUE_MODE, "Entering rescue mode"),
(NODE_STATUS.FAILED_ENTERING_RESCUE_MODE, "Failed to enter rescue mode"),
(NODE_STATUS.EXITING_RESCUE_MODE, "Exiting rescue mode"),
(NODE_STATUS.FAILED_EXITING_RESCUE_MODE, "Failed to exit rescue mode"),
(NODE_STATUS.TESTING, "Testing"),
(NODE_STATUS.FAILED_TESTING, "Failed testing"),
)
NODE_STATUS_CHOICES_DICT = OrderedDict(NODE_STATUS_CHOICES)
# NODE_STATUS when the node is owned by an owner and it is not commissioning.
ALLOCATED_NODE_STATUSES = frozenset([
NODE_STATUS.ALLOCATED,
NODE_STATUS.DEPLOYING,
NODE_STATUS.DEPLOYED,
NODE_STATUS.FAILED_DEPLOYMENT,
NODE_STATUS.RELEASING,
NODE_STATUS.FAILED_RELEASING,
NODE_STATUS.DISK_ERASING,
NODE_STATUS.FAILED_DISK_ERASING,
NODE_STATUS.RESCUE_MODE,
NODE_STATUS.ENTERING_RESCUE_MODE,
NODE_STATUS.FAILED_ENTERING_RESCUE_MODE,
NODE_STATUS.EXITING_RESCUE_MODE,
NODE_STATUS.FAILED_EXITING_RESCUE_MODE,
NODE_STATUS.TESTING,
NODE_STATUS.FAILED_TESTING,
])
class NODE_TYPE:
""" Valid node types."""
DEFAULT = 0
MACHINE = 0
DEVICE = 1
RACK_CONTROLLER = 2
REGION_CONTROLLER = 3
REGION_AND_RACK_CONTROLLER = 4
# This is copied in static/js/angular/controllers/subnet_details.js. If you
# update any choices you also need to update the controller.
NODE_TYPE_CHOICES = (
(NODE_TYPE.MACHINE, "Machine"),
(NODE_TYPE.DEVICE, "Device"),
(NODE_TYPE.RACK_CONTROLLER, "Rack controller"),
(NODE_TYPE.REGION_CONTROLLER, "Region controller"),
(NODE_TYPE.REGION_AND_RACK_CONTROLLER, "Region and rack controller"),
)
class BMC_TYPE:
""" Valid BMC types."""
DEFAULT = 0
BMC = 0
POD = 1
BMC_TYPE_CHOICES = (
(BMC_TYPE.BMC, "BMC"),
(BMC_TYPE.POD, "POD"),
)
class NODE_CREATION_TYPE:
"""Creation types a machine can have in a node."""
#: Pre-existing, machine already exists in Pod when MAAS discovered it.
PRE_EXISTING = 1
#: Manual, machine was manually composed through MAAS.
MANUAL = 2
#: Dynamic, machine was composed during allocation and should be decomposed
# upon release of the machine.
DYNAMIC = 3
class NODE_PERMISSION:
"""Permissions relating to nodes."""
VIEW = 'view_node'
EDIT = 'edit_node'
LOCK = 'lock_node'
ADMIN = 'admin_node'
class DEVICE_IP_ASSIGNMENT_TYPE:
"""The vocabulary of a `Device`'s possible IP assignment type. This value
is calculated by looking at the overall model for a `Device`. This is not
set directly on the model."""
#: Device is outside of MAAS control.
EXTERNAL = "external"
#: Device receives ip address from the appropriate dynamic range.
DYNAMIC = "dynamic"
#: Device has ip address assigned from some appropriate subnet.
STATIC = "static"
class PRESEED_TYPE:
"""Types of preseed documents that can be generated."""
COMMISSIONING = 'commissioning'
ENLIST = 'enlist'
CURTIN = 'curtin'
class USERDATA_TYPE:
"""Types of user-data documents that can be generated."""
ENLIST = 'enlist_userdata'
CURTIN = 'curtin_userdata'
class RDNS_MODE:
"""The vocabulary of a `Subnet`'s possible reverse DNS modes."""
# By default, we do what we've always done: assume we rule the DNS world.
DEFAULT = 2
#: Do not generate reverse DNS for this Subnet.
DISABLED = 0
#: Generate reverse DNS only for the CIDR.
ENABLED = 1
#: Generate RFC2317 glue if needed (Subnet is too small for its own zone.)
RFC2317 = 2
# Django choices for RDNS_MODE: sequence of tuples (key, UI representation.)
RDNS_MODE_CHOICES = (
(RDNS_MODE.DISABLED, "Disabled"),
(RDNS_MODE.ENABLED, "Enabled"),
(RDNS_MODE.RFC2317, "Enabled, with rfc2317 glue zone."),
)
RDNS_MODE_CHOICES_DICT = OrderedDict(RDNS_MODE_CHOICES)
class IPADDRESS_FAMILY:
"""The vocabulary of possible IP family for `StaticIPAddress`."""
IPv4 = 4
IPv6 = 6
class IPADDRESS_TYPE:
"""The vocabulary of possible types of `StaticIPAddress`."""
# Note: when this enum is changed, the custom SQL query
# in StaticIPAddressManager.get_hostname_ip_mapping() must also
# be changed.
# Automatically assigned IP address for a node or device out of the
# connected clusters managed range. MUST NOT be assigned to a Interface
# with a STICKY address of the same address family.
AUTO = 0
# User-specified static IP address for a node or device.
# Permanent until removed by the user, or the node or device is deleted.
STICKY = 1
# User-specified static IP address.
# Specifying a MAC address is optional. If the MAC address is not present,
# it is created in the database (thus creating a MAC address not linked
# to a node or a device).
# USER_RESERVED IP addresses that correspond to a MAC address,
# and reside within a cluster interface range, will be added to the DHCP
# leases file.
USER_RESERVED = 4
# Assigned to tell the interface that it should DHCP from a managed
# clusters dynamic range or from an external DHCP server.
DHCP = 5
# IP address was discovered on the interface during commissioning and/or
# lease parsing. Only commissioning or lease parsing creates these IP
# addresses.
DISCOVERED = 6
# This is copied in static/js/angular/controllers/subnet_details.js. If you
# update any choices you also need to update the controller.
IPADDRESS_TYPE_CHOICES = (
(IPADDRESS_TYPE.AUTO, "Automatic"),
(IPADDRESS_TYPE.STICKY, "Static"),
(IPADDRESS_TYPE.USER_RESERVED, "User reserved"),
(IPADDRESS_TYPE.DHCP, "DHCP"),
(IPADDRESS_TYPE.DISCOVERED, "Observed"),
)
IPADDRESS_TYPE_CHOICES_DICT = OrderedDict(IPADDRESS_TYPE_CHOICES)
class IPRANGE_TYPE:
"""The vocabulary of possible types of `IPRange` objects."""
# Dynamic IP Range.
DYNAMIC = 'dynamic'
# Reserved for exclusive use by MAAS (and possibly a particular user).
RESERVED = 'reserved'
IPRANGE_TYPE_CHOICES = (
(IPRANGE_TYPE.DYNAMIC, "Dynamic IP Range"),
(IPRANGE_TYPE.RESERVED, "Reserved IP Range"),
)
class POWER_STATE:
# Node is on
ON = 'on'
# Node is off
OFF = 'off'
# Node is power state is unknown
UNKNOWN = 'unknown'
# Error getting the nodes power state
ERROR = 'error'
POWER_STATE_CHOICES = (
(POWER_STATE.ON, "On"),
(POWER_STATE.OFF, "Off"),
(POWER_STATE.UNKNOWN, "Unknown"),
(POWER_STATE.ERROR, "Error"),
)
class BOOT_RESOURCE_TYPE:
"""The vocabulary of possible types for `BootResource`."""
# Downloaded from `BootSources`.
SYNCED = 0
# Generate by MAAS.
GENERATED = 1
# Uploaded by User.
UPLOADED = 2
# Django choices for BOOT_RESOURCE_TYPE: sequence of tuples (key, UI
# representation).
BOOT_RESOURCE_TYPE_CHOICES = (
(BOOT_RESOURCE_TYPE.SYNCED, "Synced"),
(BOOT_RESOURCE_TYPE.GENERATED, "Generated"),
(BOOT_RESOURCE_TYPE.UPLOADED, "Uploaded"),
)
BOOT_RESOURCE_TYPE_CHOICES_DICT = OrderedDict(BOOT_RESOURCE_TYPE_CHOICES)
class BOOT_RESOURCE_FILE_TYPE:
"""The vocabulary of possible file types for `BootResource`."""
#: Tarball of root image.
ROOT_TGZ = 'root-tgz'
#: Tarball of dd image.
ROOT_DD = 'root-dd'
ROOT_DDTAR = 'root-dd.tar'
#: Raw dd image
ROOT_DDRAW = 'root-dd.raw'
#: Compressed dd image types
ROOT_DDBZ2 = 'root-dd.bz2'
ROOT_DDGZ = 'root-dd.gz'
ROOT_DDXZ = 'root-dd.xz'
#: Compressed tarballs of dd images
ROOT_DDTBZ = 'root-dd.tar.bz2'
ROOT_DDTXZ = 'root-dd.tar.xz'
#: For backwards compatibility, DDTGZ files are named root-dd
ROOT_DDTGZ = 'root-dd'
# Following are not allowed on user upload. Only used for syncing
# from another simplestreams source. (Most likely images.maas.io)
#: Root Image (gets converted to root-image root-tgz, on the rack)
ROOT_IMAGE = 'root-image.gz'
#: Root image in SquashFS form, does not need to be converted
SQUASHFS_IMAGE = 'squashfs'
#: Boot Kernel
BOOT_KERNEL = 'boot-kernel'
#: Boot Initrd
BOOT_INITRD = 'boot-initrd'
#: Boot DTB
BOOT_DTB = 'boot-dtb'
#: An uncompressed bootloader (PXELinux, GRUB, etc)
BOOTLOADER = 'bootloader'
#: tar.xz of files which need to be extracted so the files are usable
# by MAAS
ARCHIVE_TAR_XZ = 'archive.tar.xz'
# Django choices for BOOT_RESOURCE_FILE_TYPE: sequence of tuples (key, UI
# representation).
BOOT_RESOURCE_FILE_TYPE_CHOICES = (
(BOOT_RESOURCE_FILE_TYPE.ROOT_TGZ, "Root Image (tar.gz)"),
(BOOT_RESOURCE_FILE_TYPE.ROOT_DD, "Root Compressed DD (dd -> tar.gz)"),
(BOOT_RESOURCE_FILE_TYPE.ROOT_DDTGZ, "Root Compressed DD (dd -> tar.gz)"),
(BOOT_RESOURCE_FILE_TYPE.ROOT_DDTAR,
"Root Tarfile with DD (dd -> root-dd.tar)"),
(BOOT_RESOURCE_FILE_TYPE.ROOT_DDRAW,
"Raw root DD image(dd -> root-dd.raw)"),
(BOOT_RESOURCE_FILE_TYPE.ROOT_DDTBZ,
"Root Compressed DD (dd -> root-dd.tar.bz2)"),
(BOOT_RESOURCE_FILE_TYPE.ROOT_DDTXZ,
"Root Compressed DD (dd -> root-dd.tar.xz)"),
(BOOT_RESOURCE_FILE_TYPE.ROOT_DDBZ2, "Root Compressed DD (root-dd.bz2)"),
(BOOT_RESOURCE_FILE_TYPE.ROOT_DDGZ, "Root Compressed DD (root-dd.gz)"),
(BOOT_RESOURCE_FILE_TYPE.ROOT_DDXZ, "Root Compressed DD (root-dd.xz)"),
(BOOT_RESOURCE_FILE_TYPE.ROOT_IMAGE, "Compressed Root Image"),
(BOOT_RESOURCE_FILE_TYPE.SQUASHFS_IMAGE, "SquashFS Root Image"),
(BOOT_RESOURCE_FILE_TYPE.BOOT_KERNEL, "Linux ISCSI Kernel"),
(BOOT_RESOURCE_FILE_TYPE.BOOT_INITRD, "Initial ISCSI Ramdisk"),
(BOOT_RESOURCE_FILE_TYPE.BOOT_DTB, "ISCSI Device Tree Blob"),
(BOOT_RESOURCE_FILE_TYPE.BOOTLOADER, "Bootloader"),
(BOOT_RESOURCE_FILE_TYPE.ARCHIVE_TAR_XZ, "Archives.tar.xz set of files"),
)
class PARTITION_TABLE_TYPE:
"""The vocabulary of possible partition types for `PartitionTable`."""
#: GUID partition table.
GPT = 'GPT'
#: Master boot record..
MBR = 'MBR'
# Django choices for PARTITION_TABLE_TYPE: sequence of tuples (key, UI
# representation).
PARTITION_TABLE_TYPE_CHOICES = (
(PARTITION_TABLE_TYPE.MBR, "Master boot record"),
(PARTITION_TABLE_TYPE.GPT, "GUID parition table"),
)
class FILESYSTEM_TYPE:
"""The vocabulary of possible partition types for `Filesystem`."""
#: Second extended filesystem.
EXT2 = 'ext2'
#: Fourth extended filesystem.
EXT4 = 'ext4'
#: XFS
XFS = 'xfs'
#: FAT32
FAT32 = 'fat32'
#: VFAT
VFAT = 'vfat'
#: LVM Physical Volume.
LVM_PV = 'lvm-pv'
#: RAID.
RAID = 'raid'
#: RAID spare.
RAID_SPARE = 'raid-spare'
#: Bcache cache.
BCACHE_CACHE = 'bcache-cache'
#: Bcache backing.
BCACHE_BACKING = 'bcache-backing'
#: Swap
SWAP = 'swap'
#: RAMFS. Note that tmpfs provides a superset of ramfs's features and can
# be safer.
RAMFS = "ramfs"
#: TMPFS
TMPFS = "tmpfs"
#: BTRFS
BTRFS = "btrfs"
#: ZFS
ZFSROOT = "zfsroot"
# Django choices for FILESYSTEM_TYPE: sequence of tuples (key, UI
# representation).
FILESYSTEM_TYPE_CHOICES = (
(FILESYSTEM_TYPE.EXT2, "ext2"),
(FILESYSTEM_TYPE.EXT4, "ext4"),
# XFS, FAT32, and VFAT are typically written all-caps. However, the UI/UX
# team want them displayed lower-case to fit with the style guidelines.
(FILESYSTEM_TYPE.XFS, "xfs"),
(FILESYSTEM_TYPE.FAT32, "fat32"),
(FILESYSTEM_TYPE.VFAT, "vfat"),
(FILESYSTEM_TYPE.LVM_PV, "lvm"),
(FILESYSTEM_TYPE.RAID, "raid"),
(FILESYSTEM_TYPE.RAID_SPARE, "raid-spare"),
(FILESYSTEM_TYPE.BCACHE_CACHE, "bcache-cache"),
(FILESYSTEM_TYPE.BCACHE_BACKING, "bcache-backing"),
(FILESYSTEM_TYPE.SWAP, "swap"),
(FILESYSTEM_TYPE.RAMFS, "ramfs"),
(FILESYSTEM_TYPE.TMPFS, "tmpfs"),
(FILESYSTEM_TYPE.BTRFS, "btrfs"),
(FILESYSTEM_TYPE.ZFSROOT, "zfsroot"),
)
# Django choices for FILESYSTEM_TYPE: sequence of tuples (key, UI
# representation). When a user does a format operation only these values
# are allowed. The other values are reserved for internal use.
FILESYSTEM_FORMAT_TYPE_CHOICES = (
(FILESYSTEM_TYPE.EXT2, "ext2"),
(FILESYSTEM_TYPE.EXT4, "ext4"),
# XFS, FAT32, and VFAT are typically written all-caps. However, the UI/UX
# team want them displayed lower-case to fit with the style guidelines.
(FILESYSTEM_TYPE.XFS, "xfs"),
(FILESYSTEM_TYPE.FAT32, "fat32"),
(FILESYSTEM_TYPE.VFAT, "vfat"),
(FILESYSTEM_TYPE.SWAP, "swap"),
(FILESYSTEM_TYPE.RAMFS, "ramfs"),
(FILESYSTEM_TYPE.TMPFS, "tmpfs"),
(FILESYSTEM_TYPE.BTRFS, "btrfs"),
(FILESYSTEM_TYPE.ZFSROOT, "zfsroot"),
)
FILESYSTEM_FORMAT_TYPE_CHOICES_DICT = OrderedDict(
FILESYSTEM_FORMAT_TYPE_CHOICES)
class FILESYSTEM_GROUP_TYPE:
"""The vocabulary of possible partition types for `FilesystemGroup`."""
#: LVM volume group.
LVM_VG = 'lvm-vg'
#: RAID level 0
RAID_0 = 'raid-0'
#: RAID level 1
RAID_1 = 'raid-1'
#: RAID level 5
RAID_5 = 'raid-5'
#: RAID level 6
RAID_6 = 'raid-6'
#: RAID level 10
RAID_10 = 'raid-10'
#: Bcache
BCACHE = 'bcache'
FILESYSTEM_GROUP_RAID_TYPES = [
FILESYSTEM_GROUP_TYPE.RAID_0,
FILESYSTEM_GROUP_TYPE.RAID_1,
FILESYSTEM_GROUP_TYPE.RAID_5,
FILESYSTEM_GROUP_TYPE.RAID_6,
FILESYSTEM_GROUP_TYPE.RAID_10,
]
# Django choices for FILESYSTEM_GROUP_RAID_TYPES: sequence of tuples (key, UI
# representation).
FILESYSTEM_GROUP_RAID_TYPE_CHOICES = (
(FILESYSTEM_GROUP_TYPE.RAID_0, "RAID 0"),
(FILESYSTEM_GROUP_TYPE.RAID_1, "RAID 1"),
(FILESYSTEM_GROUP_TYPE.RAID_5, "RAID 5"),
(FILESYSTEM_GROUP_TYPE.RAID_6, "RAID 6"),
(FILESYSTEM_GROUP_TYPE.RAID_10, "RAID 10"),
)
# Django choices for FILESYSTEM_GROUP_TYPE: sequence of tuples (key, UI
# representation).
FILESYSTEM_GROUP_TYPE_CHOICES = FILESYSTEM_GROUP_RAID_TYPE_CHOICES + (
(FILESYSTEM_GROUP_TYPE.LVM_VG, "LVM VG"),
(FILESYSTEM_GROUP_TYPE.BCACHE, "Bcache"),
)
class CACHE_MODE_TYPE:
"""The vocabulary of possible types of cache."""
WRITEBACK = 'writeback'
WRITETHROUGH = 'writethrough'
WRITEAROUND = 'writearound'
# Django choices for CACHE_MODE_TYPE: sequence of tuples (key, UI
# representation).
CACHE_MODE_TYPE_CHOICES = (
(CACHE_MODE_TYPE.WRITEBACK, 'Writeback'),
(CACHE_MODE_TYPE.WRITETHROUGH, 'Writethrough'),
(CACHE_MODE_TYPE.WRITEAROUND, 'Writearound'),
)
class INTERFACE_TYPE:
"""The vocabulary of possible types for `Interface`."""
# Note: when these constants are changed, the custom SQL query
# in StaticIPAddressManager.get_hostname_ip_mapping() must also
# be changed.
PHYSICAL = 'physical'
BOND = 'bond'
BRIDGE = 'bridge'
VLAN = 'vlan'
ALIAS = 'alias'
# Interface that is created when it is not linked to a node.
UNKNOWN = 'unknown'
INTERFACE_TYPE_CHOICES = (
(INTERFACE_TYPE.PHYSICAL, "Physical interface"),
(INTERFACE_TYPE.BOND, "Bond"),
(INTERFACE_TYPE.BRIDGE, "Bridge"),
(INTERFACE_TYPE.VLAN, "VLAN interface"),
(INTERFACE_TYPE.ALIAS, "Alias"),
(INTERFACE_TYPE.UNKNOWN, "Unknown"),
)
INTERFACE_TYPE_CHOICES_DICT = OrderedDict(INTERFACE_TYPE_CHOICES)
class INTERFACE_LINK_TYPE:
"""The vocabulary of possible types to link a `Subnet` to a `Interface`."""
AUTO = 'auto'
DHCP = 'dhcp'
STATIC = 'static'
LINK_UP = 'link_up'
INTERFACE_LINK_TYPE_CHOICES = (
(INTERFACE_LINK_TYPE.AUTO, "Auto IP"),
(INTERFACE_LINK_TYPE.DHCP, "DHCP"),
(INTERFACE_LINK_TYPE.STATIC, "Static IP"),
(INTERFACE_LINK_TYPE.LINK_UP, "Link up"),
)
class BOND_MODE:
BALANCE_RR = "balance-rr"
ACTIVE_BACKUP = "active-backup"
BALANCE_XOR = "balance-xor"
BROADCAST = "broadcast"
LINK_AGGREGATION = "802.3ad"
BALANCE_TLB = "balance-tlb"
BALANCE_ALB = "balance-alb"
BOND_MODE_CHOICES = (
(BOND_MODE.BALANCE_RR, BOND_MODE.BALANCE_RR),
(BOND_MODE.ACTIVE_BACKUP, BOND_MODE.ACTIVE_BACKUP),
(BOND_MODE.BALANCE_XOR, BOND_MODE.BALANCE_XOR),
(BOND_MODE.BROADCAST, BOND_MODE.BROADCAST),
(BOND_MODE.LINK_AGGREGATION, BOND_MODE.LINK_AGGREGATION),
(BOND_MODE.BALANCE_TLB, BOND_MODE.BALANCE_TLB),
(BOND_MODE.BALANCE_ALB, BOND_MODE.BALANCE_ALB),
)
class BOND_LACP_RATE:
SLOW = "slow"
FAST = "fast"
BOND_LACP_RATE_CHOICES = (
(BOND_LACP_RATE.FAST, BOND_LACP_RATE.FAST),
(BOND_LACP_RATE.SLOW, BOND_LACP_RATE.SLOW),
)
class BOND_XMIT_HASH_POLICY:
LAYER2 = "layer2"
LAYER2_3 = "layer2+3"
LAYER3_4 = "layer3+4"
ENCAP2_3 = "encap2+3"
ENCAP3_4 = "encap3+4"
BOND_XMIT_HASH_POLICY_CHOICES = (
(BOND_XMIT_HASH_POLICY.LAYER2, BOND_XMIT_HASH_POLICY.LAYER2),
(BOND_XMIT_HASH_POLICY.LAYER2_3, BOND_XMIT_HASH_POLICY.LAYER2_3),
(BOND_XMIT_HASH_POLICY.LAYER3_4, BOND_XMIT_HASH_POLICY.LAYER3_4),
(BOND_XMIT_HASH_POLICY.ENCAP2_3, BOND_XMIT_HASH_POLICY.ENCAP2_3),
(BOND_XMIT_HASH_POLICY.ENCAP3_4, BOND_XMIT_HASH_POLICY.ENCAP3_4),
)
class SERVICE_STATUS:
"""Service statuses"""
#: Status of the service is not known.
UNKNOWN = 'unknown'
#: Service is running and operational.
RUNNING = 'running'
#: Service is running but is in a degraded state.
DEGRADED = 'degraded'
#: Service is dead. (Should be on but is off).
DEAD = 'dead'
#: Service is off. (Should be off and is off).
OFF = 'off'
#: Service is on.
ON = 'on'
SERVICE_STATUS_CHOICES = (
(SERVICE_STATUS.UNKNOWN, "Unknown"),
(SERVICE_STATUS.RUNNING, "Running"),
(SERVICE_STATUS.DEGRADED, "Degraded"),
(SERVICE_STATUS.DEAD, "Dead"),
(SERVICE_STATUS.OFF, "Off"),
)
class KEYS_PROTOCOL_TYPE:
"""The vocabulary of possible protocol types for `KeySource`."""
#: Launchpad
LP = 'lp'
#: Github
GH = 'gh'
KEYS_PROTOCOL_TYPE_CHOICES = (
(KEYS_PROTOCOL_TYPE.LP, "launchpad"),
(KEYS_PROTOCOL_TYPE.GH, "github"),
)
class NODE_METADATA:
# Record metadata using a variant of SNMP OID names. See:
# http://www.ietf.org/rfc/rfc2737.txt
# (eg. turn entPhysicalModelName into "physical-model-name").
PHYSICAL_HARDWARE_REV = "physical-hardware-rev"
PHYSICAL_MFG_NAME = "physical-mfg-name"
PHYSICAL_MODEL_NAME = "physical-model-name"
PHYSICAL_NAME = "physical-name"
PHYSICAL_SERIAL_NUM = "physical-serial-num"
VENDOR_NAME = "vendor-name"
class ENDPOINT:
API = 0
UI = 1
ENDPOINT_CHOICES = (
(ENDPOINT.API, "API"),
(ENDPOINT.UI, "WebUI"),
)
|