'Start/Stop host maintenance window. On start, it triggers
guest VMs evacuation.'

@wrap_exception()
@target_host_cell
def set_host_maintenance(self, context, host_name, mode):

    host_name = self._assert_host_exists(context, host_name)
    payload = {'host_name': host_name, 'mode': mode}
    compute_utils.notify_about_host_update(context, 'set_maintenance.start', payload)
    result = self.rpcapi.host_maintenance_mode(context, host_param=host_name, mode=mode, host=host_name)
    compute_utils.notify_about_host_update(context, 'set_maintenance.end', payload)
    return result
