Skip to content

Commit 26ffa95

Browse files
committed
Fixes #4093: Add decommissioning for vms
1 parent a54fcda commit 26ffa95

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

docs/release-notes/version-2.7.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
* [#3313](https://github.com/netbox-community/netbox/issues/3313) - Toggle config context display between JSON and YAML
3030
* [#3886](https://github.com/netbox-community/netbox/issues/3886) - Enable assigning config contexts by cluster and cluster group
3131
* [#4051](https://github.com/netbox-community/netbox/issues/4051) - Disable the `makemigrations` management command
32+
* [#4093](https://github.com/netbox-community/netbox/issues/4093) - Add decommissioning status for VMs
3233

3334
## Bug Fixes
3435

netbox/virtualization/choices.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,20 @@ class VirtualMachineStatusChoices(ChoiceSet):
1111
STATUS_ACTIVE = 'active'
1212
STATUS_OFFLINE = 'offline'
1313
STATUS_STAGED = 'staged'
14+
STATUS_DECOMMISSIONING = 'decommissioning'
1415

1516
CHOICES = (
1617
(STATUS_ACTIVE, 'Active'),
1718
(STATUS_OFFLINE, 'Offline'),
1819
(STATUS_STAGED, 'Staged'),
20+
(STATUS_DECOMMISSIONING, 'Decommissioning'),
1921
)
2022

2123
LEGACY_MAP = {
2224
STATUS_OFFLINE: 0,
2325
STATUS_ACTIVE: 1,
2426
STATUS_STAGED: 3,
27+
STATUS_DECOMMISSIONING: 4,
2528
}
2629

2730

netbox/virtualization/models.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,10 @@ class VirtualMachine(ChangeLoggedModel, ConfigContextModel, CustomFieldModel):
267267
]
268268

269269
STATUS_CLASS_MAP = {
270-
'active': 'success',
271-
'offline': 'warning',
272-
'staged': 'primary',
270+
VirtualMachineStatusChoices.STATUS_ACTIVE: 'success',
271+
VirtualMachineStatusChoices.STATUS_OFFLINE: 'warning',
272+
VirtualMachineStatusChoices.STATUS_STAGED: 'primary',
273+
VirtualMachineStatusChoices.STATUS_DECOMMISSIONING: 'warning',
273274
}
274275

275276
class Meta:

0 commit comments

Comments
 (0)