Merge "Add host maintenance mode support for PowerVC Driver"
This commit is contained in:
commit
33e09d2496
|
@ -290,6 +290,16 @@ class PVCServerManager(servers.ServerManager):
|
|||
_resp, body = self.api.client.get(url)
|
||||
return body
|
||||
|
||||
def set_host_maintenance_mode(self, host, mode):
|
||||
url = "/ego/prs/hypervisor_maintenance/%s" % host
|
||||
if mode:
|
||||
status = "enable"
|
||||
else:
|
||||
status = "disable"
|
||||
body = {"status": status,
|
||||
"migrate": "none"}
|
||||
return self._update(url, body)
|
||||
|
||||
|
||||
class StorageConnectivityGroup(client_base.Resource):
|
||||
"""
|
||||
|
|
|
@ -1021,7 +1021,18 @@ class PowerVCDriver(driver.ComputeDriver):
|
|||
"""Start/Stop host maintenance window. On start, it triggers
|
||||
guest VMs evacuation.
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
try:
|
||||
self._service.set_host_maintenance_mode(host, mode)
|
||||
except Exception as e:
|
||||
# return powervc error message to uplayer
|
||||
LOG.error(_("Set host maintenance mode failed: %s"), e)
|
||||
return e.message
|
||||
# return 'on_maintenance' or 'off_maintenance' string
|
||||
# to nova-api response if pvc performed with no Exception
|
||||
if mode:
|
||||
return 'on_maintenance'
|
||||
else:
|
||||
return 'off_maintenance'
|
||||
|
||||
def set_host_enabled(self, host, enabled):
|
||||
"""Sets the specified host's ability to accept new instances."""
|
||||
|
|
|
@ -60,6 +60,10 @@ class PowerVCService(object):
|
|||
self.longrun_initial_delay = CONF.powervc.longrun_initial_delay
|
||||
# Add version checking as required
|
||||
|
||||
def set_host_maintenance_mode(self, host, mode):
|
||||
resp = self._manager.set_host_maintenance_mode(host, mode)
|
||||
return resp
|
||||
|
||||
def list_instances(self):
|
||||
"""Return the names of all the instances known to the virtualization
|
||||
layer, as a list.
|
||||
|
|
Loading…
Reference in New Issue