Commit f11280b5 authored by Guido Trotter's avatar Guido Trotter
Browse files

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: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarOlivier Tharan <olive@google.com>
parent 95075fba
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment