summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com>2012-11-20 14:26:27 -0500
committerMauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com>2012-11-21 08:04:21 -0500
commite6ba5845cd0bebc5c606e976296164081fbbfcd3 (patch)
tree3de45c69da89e3b65582188abdfd2073cf8f34f4
parent9dfb4b420f9d15d348f9fa9a2a0cb1a57f4e5771 (diff)
downloadnova-e6ba5845cd0bebc5c606e976296164081fbbfcd3.tar.gz
nova-e6ba5845cd0bebc5c606e976296164081fbbfcd3.tar.xz
nova-e6ba5845cd0bebc5c606e976296164081fbbfcd3.zip
Add methods to Host operations to fake hypervisor
This patch implements some features present in os-hosts extension that are not implemented in fake hypervisor: - Power Actions: Shutdown/Reboot/Startup a host - Change host status: enable or disable - Set/Unset the host into maintenance mode With this patch we're able to get full api samples for this extension Change-Id: I3b76e3070e326b39a67b9d4d25b5e3d91a3c102f
-rw-r--r--nova/virt/fake.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/nova/virt/fake.py b/nova/virt/fake.py
index 49f7b548b..3b5a7e288 100644
--- a/nova/virt/fake.py
+++ b/nova/virt/fake.py
@@ -363,16 +363,20 @@ class FakeDriver(driver.ComputeDriver):
def host_power_action(self, host, action):
"""Reboots, shuts down or powers up the host."""
- pass
+ return action
def host_maintenance_mode(self, host, mode):
"""Start/Stop host maintenance window. On start, it triggers
guest VMs evacuation."""
- pass
+ if not mode:
+ return 'off_maintenance'
+ return 'on_maintenance'
def set_host_enabled(self, host, enabled):
"""Sets the specified host's ability to accept new instances."""
- pass
+ if enabled:
+ return 'enabled'
+ return 'disabled'
def get_disk_available_least(self):
""" """