Skip to content

Fixes #4093: Additional status choices for vms #4102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/release-notes/version-2.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* [#3766](https://github.com/netbox-community/netbox/issues/3766) - Allow custom script authors to specify the form widget for each variable
* [#3799](https://github.com/netbox-community/netbox/issues/3799) - Greatly improve performance when ordering device components
* [#3986](https://github.com/netbox-community/netbox/issues/3986) - Include position numbers in SVG image when rendering rack elevation
* [#4093](https://github.com/netbox-community/netbox/issues/4093) - Add multiple status choices for VMs
* [#4100](https://github.com/netbox-community/netbox/issues/4100) - Add device filter to component list views
* [#4113](https://github.com/netbox-community/netbox/issues/4113) - Add bulk edit functionality for device type components
* [#4116](https://github.com/netbox-community/netbox/issues/4116) - Enable bulk edit and delete functions for device component list views
Expand Down
10 changes: 8 additions & 2 deletions netbox/virtualization/choices.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@

class VirtualMachineStatusChoices(ChoiceSet):

STATUS_ACTIVE = 'active'
STATUS_OFFLINE = 'offline'
STATUS_ACTIVE = 'active'
STATUS_PLANNED = 'planned'
STATUS_STAGED = 'staged'
STATUS_FAILED = 'failed'
STATUS_DECOMMISSIONING = 'decommissioning'

CHOICES = (
(STATUS_ACTIVE, 'Active'),
(STATUS_OFFLINE, 'Offline'),
(STATUS_ACTIVE, 'Active'),
(STATUS_PLANNED, 'Planned'),
(STATUS_STAGED, 'Staged'),
(STATUS_FAILED, 'Failed'),
(STATUS_DECOMMISSIONING, 'Decommissioning'),
)

LEGACY_MAP = {
Expand Down
9 changes: 6 additions & 3 deletions netbox/virtualization/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,12 @@ class VirtualMachine(ChangeLoggedModel, ConfigContextModel, CustomFieldModel):
]

STATUS_CLASS_MAP = {
'active': 'success',
'offline': 'warning',
'staged': 'primary',
VirtualMachineStatusChoices.STATUS_OFFLINE: 'warning',
VirtualMachineStatusChoices.STATUS_ACTIVE: 'success',
VirtualMachineStatusChoices.STATUS_PLANNED: 'info',
VirtualMachineStatusChoices.STATUS_STAGED: 'primary',
VirtualMachineStatusChoices.STATUS_FAILED: 'danger',
VirtualMachineStatusChoices.STATUS_DECOMMISSIONING: 'warning',
}

class Meta:
Expand Down