Merge "Check manager status for policy using passthough healthcheck api"
This commit is contained in:
commit
ba228f75e8
@ -20,6 +20,7 @@ from oslo_log import log
|
||||
|
||||
from vmware_nsxlib import v3
|
||||
from vmware_nsxlib.v3 import client
|
||||
from vmware_nsxlib.v3 import exceptions
|
||||
from vmware_nsxlib.v3 import lib
|
||||
from vmware_nsxlib.v3 import nsx_constants
|
||||
|
||||
@ -119,8 +120,24 @@ class NsxPolicyLib(lib.NsxLibBase):
|
||||
|
||||
@property
|
||||
def validate_connection_method(self):
|
||||
# TODO(asarfaty): Find an equivalent api to check policy status
|
||||
pass
|
||||
"""Return a method that will validate the NSX manager status"""
|
||||
def check_manager_status_passthrough(client, manager_url):
|
||||
# Try to get the status silently and with no retries
|
||||
status = client.get('reverse-proxy/node/health',
|
||||
silent=True, with_retries=False)
|
||||
if (not status or not status.get('healthy', False)):
|
||||
msg = _("Manager is not in working state: %s") % status
|
||||
LOG.warning(msg)
|
||||
raise exceptions.ResourceNotFound(
|
||||
manager=manager_url, operation=msg)
|
||||
|
||||
def check_manager_status(client, manager_url):
|
||||
# Decide on the healthcheck by the passthrough status
|
||||
if self.nsx_api:
|
||||
return check_manager_status_passthrough(
|
||||
self.nsx_api.client, manager_url)
|
||||
|
||||
return check_manager_status
|
||||
|
||||
def get_version(self):
|
||||
"""Get the NSX Policy manager version
|
||||
|
Loading…
Reference in New Issue
Block a user