Skip to content

Status Decommissioning missing for virtual machines #4093

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

Closed
netsandbox opened this issue Feb 5, 2020 · 14 comments · Fixed by #4102
Closed

Status Decommissioning missing for virtual machines #4093

netsandbox opened this issue Feb 5, 2020 · 14 comments · Fixed by #4102
Assignees
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application

Comments

@netsandbox
Copy link
Contributor

Environment

  • Python version: 3.6.9
  • NetBox version: 2.7.4

Proposed Functionality

Currently a virtual machine can only have as status:

  • Active
  • Offline
  • Staged

I'm missing here at least Decommissioning as status.

Use Case

I would distinguish between Offline and Decommissioning in this way:

Offline is a VM that is temporary powered off and will be later powered on again.
Decommissioning is a VM that is powered off and will be later deleted.

Our decommissioning process is actually to power off a VM and then wait a reasonable time if still someone came up who needs this VM.
Being able to set Decommissioning as status would help to track VM's planned for decommissioning.

Maybe it also makes sense to use for virtual machines the same status as for devices.
If you think of devices as hardware servers, the same processes are often used for hardware servers and VM's. Having the same status choices for both of them would help here.

Database Changes

None

External Dependencies

None

@kobayashi kobayashi self-assigned this Feb 6, 2020
@kobayashi kobayashi added the type: feature Introduction of new functionality to the application label Feb 6, 2020
@kobayashi
Copy link
Contributor

This is reasonable to me. when it accepted, let me set Decommissioning to virtual machine.

This change will be like this. LEGACY_MAP might not be necessary?

class VirtualMachineStatusChoices(ChoiceSet):

    STATUS_ACTIVE = 'active'
    STATUS_OFFLINE = 'offline'
    STATUS_STAGED = 'staged'
    STATUS_DECOMMISSIONING = 'decommissioning'

    CHOICES = (
        (STATUS_ACTIVE, 'Active'),
        (STATUS_OFFLINE, 'Offline'),
        (STATUS_STAGED, 'Staged'),
        (STATUS_DECOMMISSIONING, 'Decommissioning'),
    )

    LEGACY_MAP = {
        STATUS_OFFLINE: 0,
        STATUS_ACTIVE: 1,
        STATUS_STAGED: 3,
        STATUS_DECOMMISSIONING: 4,
    }

@kobayashi
Copy link
Contributor

Just opened PR #4102 before accepted.
That could be merged if this issue will be accepted.

@jeremystretch jeremystretch added the status: accepted This issue has been accepted for implementation label Feb 10, 2020
kobayashi added a commit to kobayashi/netbox that referenced this issue Feb 11, 2020
@nathbooth
Copy link

Can we expand this further and add all the missing status's to give vms parity with devices. so add;

  • Planned
  • Staged
  • Failed
  • Inventory

@jeremystretch jeremystretch added status: under review Further discussion is needed to determine this issue's scope and/or implementation and removed status: accepted This issue has been accepted for implementation labels Feb 11, 2020
@jeremystretch
Copy link
Member

I don't see a valid use case for staged or inventory. A staged device is one that has been physically installed but not yet provisioned: This concept doesn't apply to virtual machines. Same with inventory.

Planned and failed make sense, I think.

@DanSheps
Copy link
Member

I agree with planed and failed. Failed is a valid state on some hypervisors.

That said, staged could make sense, if you create the VM but don't install the OS. You could also use planned for that as well however.

@kobayashi
Copy link
Contributor

Yes, we can set 'Staged' as the state of pre-provisioning or pre-installing. No thought about 'Inventory'.
If no any objects here, I will additionally set 'Planned' and 'Failed'. ('Staged' is already there)

  • Planned
  • Staged
  • Failed

And color labels should be the same as device. So like this

  • Active (color: success)
  • Staged (color: primary)
  • Offline (color: warning)
  • Planned (color: info)
  • Failed (color: danger)
  • Decommissioning (color: warning)

@netsandbox
Copy link
Contributor Author

I'm with @nathbooth that the status for devices and virtual machines should be the same.
Also with the last comment from @kobayashi, only Inventory is then missing for virtual machines.

What is status Inventory used for devices?

I can think of status Inventory for devices and virtual machines as servers, which are online, but you don't want to run Ansible playbooks agains them, if you use NetBox as inventory for Ansible.

@jeremystretch
Copy link
Member

The "inventory" status implies that the physical device is available for deployment but has not been brought online or configured. (Not to be confused with "inventory" from the Ansible vernacular.)

@vsvetlov
Copy link

I think the status attributes are primarily used to reflect workflow for specific type of object.
Every company has its own workflow process to track the lifecycle of devices and virtual machines. So it is better to have more choices or make it customizable. The same can be applied for VLANs and prefixes.
The one object that missed is device interface. It is quite difficult to track interface status during automation workflow. This is why there were so many requests to implement custom fields for interfaces.
Yes, it is possible with tags. But it is really inconvinient to track status of different objects using different features of the application. I can submit a request to implement statuses for interface.

@jeremystretch
Copy link
Member

@vsvetlov This issue is limited to virtual machine statuses. Let's keep the conversation focused on that please.

@nathbooth
Copy link

I feel that the current status is quite subjective. I.e. the ‘inventory’ status @jeremystretch described above sounds more like planned. It’s probably pragmatic that we update the wiki with some suggested definitions.
For me inventory makes more sense for a device that is stateless or who’s state is unknown.
Then you have:
-Planned: intending that it will exist in future
-Staged: has been powered on and booted with barebones configuration
-Active: fully provisioned
-Failed: object has failed
-Offline: object is offline
-Decomissioning: pending or has been removed

I think all of the above bar inventory can apply to both devices and vm’s.

@kobayashi
Copy link
Contributor

For my case, I set 'Inventory' to a device just to be stocked in a rack. So 'Inventory' for virtual machine is not applicable to me because no such case in a virtual machine. I think it's ok to add the status if giving an usecase.

@nathbooth
Copy link

I would agree that inventory isn’t required for virtual machines, I was more musing that an informal definition would help

@jeremystretch
Copy link
Member

Changing this back to "accepted" with the following statuses:

  • Planned
  • Staged
  • Active
  • Offline
  • Decommissioning
  • Failed

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Feb 12, 2020
kobayashi added a commit to kobayashi/netbox that referenced this issue Feb 13, 2020
jeremystretch added a commit that referenced this issue Feb 13, 2020
Fixes #4093: Additional status choices for vms
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants