1
# Copyright 2012 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
"""Enumerations meaningful to the provisioning server."""
6
from __future__ import (
18
'IPMI_DRIVER_CHOICES',
26
# We specifically declare this here so that a node not knowing its own
27
# powertype won't fail to enlist. However, we don't want it in the list
28
# of power types since setting a node's power type to "I don't know"
29
# from another type doens't make any sense.
30
UNKNOWN_POWER_TYPE = ''
33
def get_power_types():
34
"""Return the choice of mechanism to control a node's power.
36
:return: Dictionary mapping power type to its description.
39
"virsh": "virsh (virtual systems)",
40
"ether_wake": "Wake-on-LAN",
41
"fence_cdu": "Sentry Switch CDU",
43
"moonshot": "iLO4 Moonshot Chassis",
44
"sm15k": "SeaMicro 15000",
49
# FIXME: This enum is deprecated but left in place until the last
50
# vestiges of its use are removed (some JS uses it still).
52
"""Choice of mechanism to control a node's power."""
54
# The null value. Set this to indicate that the value should be
55
# taken from the configured default.
56
# Django doesn't deal well with null strings, so we're forced to use
57
# the empty string instead. Hopefully this will be replaced with
61
# Use virsh (for virtual machines).
65
WAKE_ON_LAN = 'ether_wake'
67
# Sentry Switch CDU's.
70
# IPMI (Intelligent Platform Management Interface).
76
# The SeaMicro SM15000.
77
# http://www.seamicro.com/sites/default/files/SM15000_Datasheet.pdf
80
# Intel Active Management Technology
84
# Django 'Choices' format structure for its field selection mechanism.
85
POWER_TYPE_CHOICES = [
86
(k, v) for (k, v) in get_power_types().items() if k != '']
95
IPMI_DRIVER_CHOICES = [
96
[IPMI_DRIVER.DEFAULT, "Auto-detect"],
97
[IPMI_DRIVER.LAN, "LAN [IPMI 1.5]"],
98
[IPMI_DRIVER.LAN_2_0, "LAN_2_0 [IPMI 2.0]"],
103
"""ARP Hardware Type codes."""