Coverage for virtualization/choices.py: 100%
26 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 18:35 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 18:35 +0000
1from django.utils.translation import gettext_lazy as _
3from utilities.choices import Choice, ChoiceSet
5#
6# Clusters
7#
10class ClusterStatusChoices(ChoiceSet):
11 key = 'Cluster.status'
13 STATUS_PLANNED = 'planned'
14 STATUS_STAGING = 'staging'
15 STATUS_ACTIVE = 'active'
16 STATUS_DECOMMISSIONING = 'decommissioning'
17 STATUS_OFFLINE = 'offline'
19 CHOICES = [
20 Choice(
21 STATUS_PLANNED, _('Planned'), color='cyan',
22 description=_('Designated for future use but not yet in service')
23 ),
24 Choice(
25 STATUS_STAGING, _('Staging'), color='blue',
26 description=_('Being prepared for production use')
27 ),
28 Choice(
29 STATUS_ACTIVE, _('Active'), color='green',
30 description=_('Fully operational and in service')
31 ),
32 Choice(
33 STATUS_DECOMMISSIONING, _('Decommissioning'), color='yellow',
34 description=_('Being removed from service')
35 ),
36 Choice(
37 STATUS_OFFLINE, _('Offline'), color='red',
38 description=_('Not currently in service')
39 ),
40 ]
43#
44# VirtualMachines
45#
47class VirtualMachineStatusChoices(ChoiceSet):
48 key = 'VirtualMachine.status'
50 STATUS_OFFLINE = 'offline'
51 STATUS_ACTIVE = 'active'
52 STATUS_PLANNED = 'planned'
53 STATUS_STAGED = 'staged'
54 STATUS_FAILED = 'failed'
55 STATUS_DECOMMISSIONING = 'decommissioning'
56 STATUS_PAUSED = 'paused'
58 CHOICES = [
59 Choice(
60 STATUS_OFFLINE, _('Offline'), color='gray',
61 description=_('Powered off or not currently running')
62 ),
63 Choice(
64 STATUS_ACTIVE, _('Active'), color='green',
65 description=_('Powered on and operational')
66 ),
67 Choice(
68 STATUS_PLANNED, _('Planned'), color='cyan',
69 description=_('Designated for future use but not yet provisioned')
70 ),
71 Choice(
72 STATUS_STAGED, _('Staged'), color='blue',
73 description=_('Provisioned but not yet in service')
74 ),
75 Choice(
76 STATUS_FAILED, _('Failed'), color='red',
77 description=_('In an error state or otherwise not functioning')
78 ),
79 Choice(
80 STATUS_DECOMMISSIONING, _('Decommissioning'), color='yellow',
81 description=_('Being removed from service')
82 ),
83 Choice(
84 STATUS_PAUSED, _('Paused'), color='orange',
85 description=_('Suspended with its state retained in memory')
86 ),
87 ]
90class VirtualMachineStartOnBootChoices(ChoiceSet):
91 key = 'VirtualMachine.start_on_boot'
93 STATUS_ON = 'on'
94 STATUS_OFF = 'off'
95 STATUS_LAST_STATE = 'laststate'
97 CHOICES = [
98 Choice(
99 STATUS_ON, _('On'), color='green',
100 description=_('Automatically start when the host boots')
101 ),
102 Choice(
103 STATUS_OFF, _('Off'), color='gray',
104 description=_('Do not start automatically when the host boots')
105 ),
106 Choice(
107 STATUS_LAST_STATE, _('Last State'), color='cyan',
108 description=_('Restore the power state the machine had before the host shut down')
109 ),
110 ]