From f11280b52cca0b1c923b09d55913921d1a6ae358 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Fri, 2 Oct 2009 12:15:49 +0100 Subject: [PATCH] OSEnvironment: populate OS_VARIANT According to the design on api_version >= 15 the OS variant is the part of the OS name after the "+" sign. If none is found, we just pass in the first variant an OS declares (which is bound to exist, as we check for it in _TryOSFromDisk). Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Olivier Tharan <olive@google.com> --- lib/backend.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/backend.py b/lib/backend.py index 741599710..09831fb0f 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -1789,6 +1789,12 @@ def OSEnvironment(instance, os, debug=0): result['DISK_COUNT'] = '%d' % len(instance.disks) result['NIC_COUNT'] = '%d' % len(instance.nics) result['DEBUG_LEVEL'] = '%d' % debug + if api_version >= constants.OS_API_V15: + try: + variant = instance.os.split('+', 1)[1] + except IndexError: + variant = os.supported_variants[0] + result['OS_VARIANT'] = variant for idx, disk in enumerate(instance.disks): real_disk = _RecursiveFindBD(disk) if real_disk is None: -- GitLab