Revision 099c52ad lib/backend.py

b/lib/backend.py
1807 1807
  return payload
1808 1808

  
1809 1809

  
1810
def OSEnvironment(instance, os, debug=0):
1810
def OSEnvironment(instance, inst_os, debug=0):
1811 1811
  """Calculate the environment for an os script.
1812 1812

  
1813 1813
  @type instance: L{objects.Instance}
1814 1814
  @param instance: target instance for the os script run
1815
  @type os: L{objects.OS}
1816
  @param os: operating system for which the environment is being built
1815
  @type inst_os: L{objects.OS}
1816
  @param inst_os: operating system for which the environment is being built
1817 1817
  @type debug: integer
1818 1818
  @param debug: debug level (0 or 1, for OS Api 10)
1819 1819
  @rtype: dict
......
1823 1823

  
1824 1824
  """
1825 1825
  result = {}
1826
  api_version = max(constants.OS_API_VERSIONS.intersection(os.api_versions))
1826
  api_version = \
1827
    max(constants.OS_API_VERSIONS.intersection(inst_os.api_versions))
1827 1828
  result['OS_API_VERSION'] = '%d' % api_version
1828 1829
  result['INSTANCE_NAME'] = instance.name
1829 1830
  result['INSTANCE_OS'] = instance.os
......
1835 1836
    try:
1836 1837
      variant = instance.os.split('+', 1)[1]
1837 1838
    except IndexError:
1838
      variant = os.supported_variants[0]
1839
      variant = inst_os.supported_variants[0]
1839 1840
    result['OS_VARIANT'] = variant
1840 1841
  for idx, disk in enumerate(instance.disks):
1841 1842
    real_disk = _RecursiveFindBD(disk)

Also available in: Unified diff