Fix change_nova_service_state action
The function signature has been changed in 2.53 version[1] and this patch is required to fix watcher-tempest-plugin. If all tests are ok, I'll merge it ASAP. [1]: https://developer.openstack.org/api-ref/compute/#enable-scheduling-for-a-compute-service Change-Id: Ie03519dac2a55263e278344fd00f103067f90f27
This commit is contained in:
parent
b33b7a0474
commit
c53817c33d
@ -20,7 +20,7 @@ It is used via a single directive in the .rst file
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from sphinx.util.compat import Directive
|
from docutils.parsers.rst import Directive
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
|
|
||||||
from watcher.notifications import base as notification
|
from watcher.notifications import base as notification
|
||||||
|
@ -42,6 +42,7 @@ extensions = [
|
|||||||
'ext.versioned_notifications',
|
'ext.versioned_notifications',
|
||||||
'oslo_config.sphinxconfiggen',
|
'oslo_config.sphinxconfiggen',
|
||||||
'openstackdocstheme',
|
'openstackdocstheme',
|
||||||
|
'sphinx.ext.napoleon',
|
||||||
]
|
]
|
||||||
|
|
||||||
wsme_protocols = ['restjson']
|
wsme_protocols = ['restjson']
|
||||||
|
@ -29,9 +29,12 @@ import novaclient.exceptions as nvexceptions
|
|||||||
from watcher.common import clients
|
from watcher.common import clients
|
||||||
from watcher.common import exception
|
from watcher.common import exception
|
||||||
from watcher.common import utils
|
from watcher.common import utils
|
||||||
|
from watcher import conf
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
|
CONF = conf.CONF
|
||||||
|
|
||||||
|
|
||||||
class NovaHelper(object):
|
class NovaHelper(object):
|
||||||
|
|
||||||
@ -556,21 +559,31 @@ class NovaHelper(object):
|
|||||||
"for the instance %s" % instance_id)
|
"for the instance %s" % instance_id)
|
||||||
|
|
||||||
def enable_service_nova_compute(self, hostname):
|
def enable_service_nova_compute(self, hostname):
|
||||||
if self.nova.services.enable(host=hostname,
|
if float(CONF.nova_client.api_version) < 2.53:
|
||||||
binary='nova-compute'). \
|
status = self.nova.services.enable(
|
||||||
status == 'enabled':
|
host=hostname, binary='nova-compute').status == 'enabled'
|
||||||
return True
|
|
||||||
else:
|
else:
|
||||||
return False
|
service_uuid = self.nova.services.list(host=hostname,
|
||||||
|
binary='nova-compute')[0].id
|
||||||
|
status = self.nova.services.enable(
|
||||||
|
service_uuid=service_uuid).status == 'enabled'
|
||||||
|
|
||||||
|
return status
|
||||||
|
|
||||||
def disable_service_nova_compute(self, hostname, reason=None):
|
def disable_service_nova_compute(self, hostname, reason=None):
|
||||||
if self.nova.services.disable_log_reason(host=hostname,
|
if float(CONF.nova_client.api_version) < 2.53:
|
||||||
binary='nova-compute',
|
status = self.nova.services.disable_log_reason(
|
||||||
reason=reason). \
|
host=hostname,
|
||||||
status == 'disabled':
|
binary='nova-compute',
|
||||||
return True
|
reason=reason).status == 'disabled'
|
||||||
else:
|
else:
|
||||||
return False
|
service_uuid = self.nova.services.list(host=hostname,
|
||||||
|
binary='nova-compute')[0].id
|
||||||
|
status = self.nova.services.disable_log_reason(
|
||||||
|
service_uuid=service_uuid,
|
||||||
|
reason=reason).status == 'disabled'
|
||||||
|
|
||||||
|
return status
|
||||||
|
|
||||||
def set_host_offline(self, hostname):
|
def set_host_offline(self, hostname):
|
||||||
# See API on https://developer.openstack.org/api-ref/compute/
|
# See API on https://developer.openstack.org/api-ref/compute/
|
||||||
|
Loading…
Reference in New Issue
Block a user