Merge "NSX|V: improve get_version method"
This commit is contained in:
commit
9f6a1307e9
@ -13,6 +13,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from distutils import version
|
||||||
import eventlet
|
import eventlet
|
||||||
import netaddr
|
import netaddr
|
||||||
import random
|
import random
|
||||||
@ -116,9 +117,8 @@ class EdgeManager(object):
|
|||||||
self._check_backup_edge_pools()
|
self._check_backup_edge_pools()
|
||||||
|
|
||||||
def _get_per_edge_rp_filter_state(self):
|
def _get_per_edge_rp_filter_state(self):
|
||||||
version = self.nsxv_manager.vcns.get_version()
|
ver = self.nsxv_manager.vcns.get_version()
|
||||||
# TODO(kobis): should have better mapping of versions here for this
|
if version.LooseVersion(ver) < version.LooseVersion('6.2.0'):
|
||||||
if version[:3] == '6.1':
|
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ import retrying
|
|||||||
import six
|
import six
|
||||||
import xml.etree.ElementTree as et
|
import xml.etree.ElementTree as et
|
||||||
|
|
||||||
|
from vmware_nsx._i18n import _LE
|
||||||
from vmware_nsx.common import nsxv_constants
|
from vmware_nsx.common import nsxv_constants
|
||||||
from vmware_nsx.plugins.nsx_v.vshield.common import exceptions
|
from vmware_nsx.plugins.nsx_v.vshield.common import exceptions
|
||||||
from vmware_nsx.plugins.nsx_v.vshield.common import VcnsApiClient
|
from vmware_nsx.plugins.nsx_v.vshield.common import VcnsApiClient
|
||||||
@ -793,16 +794,22 @@ class Vcns(object):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def get_version(self):
|
def _get_version(self):
|
||||||
uri = '/api/1.0/appliance-management/summary/system'
|
uri = '/api/2.0/services/vsmconfig'
|
||||||
h, c = self.do_request(HTTP_GET, uri, decode=True)
|
h, c = self.do_request(HTTP_GET, uri, decode=True)
|
||||||
version = '%s.%s.%s' % (c['versionInfo']['majorVersion'],
|
version = c['version']
|
||||||
c['versionInfo']['minorVersion'],
|
LOG.debug("NSX Version: %s", version)
|
||||||
c['versionInfo']['patchVersion'])
|
|
||||||
LOG.debug("NSX Version: %s, Build: %s",
|
|
||||||
version, c['versionInfo']['buildNumber'])
|
|
||||||
return version
|
return version
|
||||||
|
|
||||||
|
def get_version(self):
|
||||||
|
try:
|
||||||
|
return self._get_version()
|
||||||
|
except Exception as e:
|
||||||
|
# Versions prior to 6.2.0 do not support the above API
|
||||||
|
LOG.error(_LE("Unable to get NSX version. Exception: %s"), e)
|
||||||
|
# Minimum supported version is 6.1
|
||||||
|
return '6.1'
|
||||||
|
|
||||||
def get_tuning_configration(self):
|
def get_tuning_configration(self):
|
||||||
uri = '/api/4.0/edgePublish/tuningConfiguration'
|
uri = '/api/4.0/edgePublish/tuningConfiguration'
|
||||||
h, c = self.do_request(HTTP_GET, uri, decode=True)
|
h, c = self.do_request(HTTP_GET, uri, decode=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user