Mark host down for maintenance

Registered by Facundo Maldonado

Summary
=======
Particular scope of this BP is to provide an action button to Hypervisors Table in Horizon that enables/disables nova-compute service on host marked for maintenance in order to disallow nova compute_filter to schedule new VM’s on that node (node with disabled nova-compute). This blueprint should also provide unit tests which will be covering added functionality. This action should only be available to users with the Admin role.

Motivation
========
This feature in Horizon is desirable because it is a part of more complex functionality marking host as be ready for maintenance so administrator can perform updates or other maintenance actions on it.

In background this feature should be done in following way:
1. Disable nova-compute service so no new VM’s are going to be scheduled to that node
2. Migrate all instances from host marked for maintenance
3. Do maintenance actions on host
4. Enable nova-compute service on host

This way of putting host on maintenance mode is also mentioned here:
http://docs.openstack.org/openstack-ops/content/maintenance.html

Why this way ?
Because actually there aren’t any other ways to mark host on maintenance mode and disallow new VM’s to be scheduled on that node. There is also another method to put host in maintenance mode using CLI the --maintenance parameter:

$nova host-update <host> --maintenance <enable|disable>

With the current implementation, only hypervisors that are themselves capable of performing re-scheduling of a VM, can be supported in the host_maintenance feature, e.g. XEN with VM.pool_migrate. Other hypervisor, such as KVM, are not, and trying to invoke the host_maintenance API will result in an error.

There is also another BP:
https://blueprints.launchpad.net/nova/+spec/kvm-host-maintenance-support
related to this issue but it is currently obsolete.

Description
=========
This blueprint is about enabling and disabling nova-compute service on specified host. This feature is related to Hypervisors table in Horizon, especially to “Compute Host” tab. There should be add a dedicated action button (located in “Actions” section) which allow users to open a confirm window containing possibility to enable/disable nova-compute service on specified host. Only users with Admin role should have availability to use this feature. In the background, functionality of enabling/disabling nova-compute service in Horizon are going to be implemented using python-novaclient. This blueprint should also provide unit tests which will be covering added functionality in positive and negative cases.

UX
===
UX implementation of this blueprint is pretty simple. It requires only one single new action button in Compute Host Tab in Hypervisors Table in Horizon. This button after being clicked should display confirmation window for action of disabling nova-compute service on specified host. After being disabled nova-compute, button should has ability to reenable nova-compute service for host again.

Testing
======
Functionality of enabling and disabling nova-compute service in Horizon should be covered by unit tests. Each of this implemented method should be covered in positive and negative context.

Positive context means that tested method should return expected value without errors , success message, appropriate response code and redirect.

In negative context, tested method should return error message, appropriate response code and redirect.

Here is proposition of test scenarios:
a) test_enable_maintenance
b) test_enable_maintenance_fails
c) test_disable_maintenance
d) test_disable_maintenance_fails

Preparing tests requires new stubbed nova-compute service with status ‘disabled’.

Outside Dependencies
==================
This blueprint will be using python-novaclient to enable/disable nova-compute service.
Beside that dependency tree is available in Work Items section.

Requirements Update Required
========================
There are no changes to openstack/requirements in openstack that will need to land before this change can merge into Horizon.

Doc Impact
=========
There are no changes to Horizon documentation that are required.

Blueprint information

Status:
Complete
Approver:
David Lyle
Priority:
Medium
Drafter:
Facundo Maldonado
Direction:
Needs approval
Assignee:
Bartosz Fic
Definition:
Superseded
Series goal:
None
Implementation:
Good progress
Milestone target:
None
Started by
Thierry Carrez
Completed by
David Lyle

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/mark-host-down-for-maintenance,n,z

[david-lyle] This review is merged and was a separate blueprint.
Addressed by: https://review.openstack.org/75940
    Need ability to evacuate host in syspanel

Addressed by: https://review.openstack.org/103627
    Mark host down for maintenance

[2014-07-26 jpomero] Hi Facundo. This is a feature I'm hoping to get in juno, so if you are confident that the work is done could you update the status and milestone target, maybe to juno-3 so that is gets more visibility?

[2014-11-17 | david-lyle] The first review was code from another blueprint. For Kilo we've changed the blueprint process to be more descriptive. Please see: https://blueprints.launchpad.net/horizon/+spec/template

I would be happy to consider this blueprint for Kilo, but some details would be helpful.

[2014-12-08 | bartosz-fic] I updated blueprint content using Horizon BP template.

[2014-12-10 | bartosz-fic] Yesterday I've realised that this feature (of enabling/disabling nova-compute service on specified host) which should be provided in this review https://review.openstack.org/103627 for this blueprint has already been implemented (and merged) for Kilo.

I've found this already implemented feature blueprint here:
https://blueprints.launchpad.net/horizon/+spec/service-disable-enable

and related review
https://review.openstack.org/#/c/135491/

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.