X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/2d1153739f79523df60ac9a3047a6e476ce68aca..f7314dfb9cdce0ae4994987a9123746e1b5b7ba1:/lib/backend.py diff --git a/lib/backend.py b/lib/backend.py index b7df899..6bf9c8d 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -1149,21 +1149,21 @@ def _OSOndiskVersion(name, os_dir): try: f = open(api_file) try: - api_version = f.read(256) + api_versions = f.readlines() finally: f.close() except EnvironmentError, err: raise errors.InvalidOS(name, os_dir, "error while reading the" " API version (%s)" % _ErrnoOrStr(err)) - api_version = api_version.strip() + api_versions = [version.strip() for version in api_versions] try: - api_version = int(api_version) + api_versions = [int(version) for version in api_versions] except (TypeError, ValueError), err: raise errors.InvalidOS(name, os_dir, "API version is not integer (%s)" % str(err)) - return api_version + return api_versions def DiagnoseOS(top_dirs=None): @@ -1219,12 +1219,12 @@ def OSFromDisk(name, base_dir=None): else: os_dir = os.path.sep.join([base_dir, name]) - api_version = _OSOndiskVersion(name, os_dir) + api_versions = _OSOndiskVersion(name, os_dir) - if api_version != constants.OS_API_VERSION: + if constants.OS_API_VERSION not in api_versions: raise errors.InvalidOS(name, os_dir, "API version mismatch" " (found %s want %s)" - % (api_version, constants.OS_API_VERSION)) + % (api_versions, constants.OS_API_VERSION)) # OS Scripts dictionary, we will populate it with the actual script names os_scripts = {'create': '', 'export': '', 'import': '', 'rename': ''} @@ -1252,7 +1252,7 @@ def OSFromDisk(name, base_dir=None): export_script=os_scripts['export'], import_script=os_scripts['import'], rename_script=os_scripts['rename'], - api_version=api_version) + api_versions=api_versions) def GrowBlockDevice(disk, amount):