From e6ba5845cd0bebc5c606e976296164081fbbfcd3 Mon Sep 17 00:00:00 2001 From: "Mauro S. M. Rodrigues" Date: Tue, 20 Nov 2012 14:26:27 -0500 Subject: 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 --- nova/virt/fake.py | 10 +++++++--- 1 file 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): """ """ -- cgit