VMPowerOnOff
- Launchpad Entry: https://blueprints.launchpad.net/nova/+spec/power-on-off-vm
- Created: 23 Aug 2012
- Contributors: Chetan Kumar
Contents
Summary
Add the ability in Nova to:
- power off a VM without destroying the instance
- power on a powered-off VM on an availability_zone of choice
Release Note
Added following features:
- Power off a VM without destroying the instance
- Power on a VM powered off earlier with the same settings some time later on an availability_zone of choice
- Added a new power_state POWER_OFF for the purpose
Rationale
It is not possible to power off a VM and power on later with the same network settings.
User stories
User wants to use an existing VM later with the current settings.
Design
- The VmPowerOnOffController will have extensions to:
- power off a VM
- power on the VM on a give availability_zone
Implementation
Code Changes
Add VmPowerOnOffController to support the following API:
1. Power off VM:
URI: v2/<tenant_id>/servers/<server_id>/action Request Body: JSON { "vm-poweroff": {} } Normal Response Code: 202 Error Response Code(s): Bad Request (400), Not Found(404) Response: JSON { <To be Added> } Response: XML <?xml version="1.0" encoding="UTF-8"?> <To be Added>
2. Power on VM:
URI: v2/<tenant_id>/servers/<server_id>/action Request body: JSON { "vm-poweron": { "availability_zone": <availability_zone> } } Request body: XML <?xml version="1.0" encoding="UTF-8"?> <To be Added> Normal Response Code: 202 Error Response Code(s): Bad Request (400), Not Found(404) Response: JSON { <To be Added> } Response: XML <?xml version="1.0" encoding="UTF-8"?> <To be Added>
Possible exceptions required to be handled:
- VM is not in POWER_OFF state.
- VM does not exist.
- Insufficient permissions: The API should return a 'Bad Request (400)' response with an appropriate error message.
Migration
No database or core API changes.
Test/Demo Plan
Tests being added