diff --git a/Makefile b/Makefile index e5d160b..d559b4d 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,8 @@ ${BUILDROOT}/${PLUGIN_NAME}: ${BRANDING} iso -e s/@HYPERVISOR_LOWER@/${HYPERVISOR_LOWER}/g \ -e s/@PLUGIN_NAME@/${PLUGIN_NAME}/g {} \ -e s/@PLUGIN_VERSION@/${PLUGIN_VERSION}/g {} \ - -e s/@PLUGIN_REVISION@/${PLUGIN_REVISION}/g {} + -e s/@PLUGIN_REVISION@/${PLUGIN_REVISION}/g {} \ + -e s/@VERSION_HOTFIXES@/${VERSION_HOTFIXES}/g {} cp suppack/xenapi-plugins-*.iso ${BUILDROOT}/${PLUGIN_NAME}/deployment_scripts/ ${BUILDROOT}/doc/source ${BUILDROOT}/doc/Makefile: ${BRANDING} diff --git a/branding.inc b/branding.inc index 48712a2..5fffac6 100644 --- a/branding.inc +++ b/branding.inc @@ -1,6 +1,7 @@ HYPERVISOR_NAME=XenServer HYPERVISOR_LOWER=xenserver PLUGIN_NAME=fuel-plugin-xenserver +VERSION_HOTFIXES='{"6.5.0":["XS65ESP1013"]}' PLUGIN_BRANCHES="9.0 8.0 7.0 6.1" PLUGIN_VERSION_6_1=1.0 diff --git a/plugin_source/deployment_scripts/compute_pre_test.py b/plugin_source/deployment_scripts/compute_pre_test.py index db7311a..e932249 100755 --- a/plugin_source/deployment_scripts/compute_pre_test.py +++ b/plugin_source/deployment_scripts/compute_pre_test.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import json import logging import os import stat @@ -8,7 +9,7 @@ from utils import HIMN_IP XS_RSA = '/root/.ssh/xs_rsa' LOG_FILE = os.path.join(utils.LOG_ROOT, 'compute_pre_deployment.log') -PLATFORM_VERSION = '1.9' +VERSION_HOTFIXES = '@VERSION_HOTFIXES@' if not os.path.exists(utils.LOG_ROOT): os.mkdir(utils.LOG_ROOT) @@ -42,16 +43,24 @@ def ssh_copy_id(host, username, password): def check_host_compatibility(himn, username): - hotfix = 'XS65ESP1013' - installed = utils.ssh(himn, username, - 'xe patch-list name-label=%s --minimal' % hotfix) + version_hotfixes = json.loads(VERSION_HOTFIXES) + ver = utils.ssh(himn, username, ('xe host-param-get uuid=$(xe host-list --minimal) ' - 'param-name=software-version param-key=platform_version')) + 'param-name=software-version param-key=product_version')) + hotfixes = version_hotfixes.get(ver) + if not hotfixes: + return - if not installed and ver[:3] == PLATFORM_VERSION: - utils.reportError(('Hotfix %s has not been installed ' - 'and product version is %s') % (hotfix, ver)) + for hotfix in hotfixes: + if not hotfix: + continue + + installed = utils.ssh(himn, username, + 'xe patch-list name-label=%s --minimal' % hotfix) + + if not installed: + utils.reportError('Hotfix %s has not been installed ' % ver) def check_local_sr(himn, username):