Revision 4a0e011f lib/backend.py

b/lib/backend.py
789 789
  return output
790 790

  
791 791

  
792
def InstanceOsAdd(instance, reinstall):
792
def InstanceOsAdd(instance, reinstall, debug):
793 793
  """Add an OS to an instance.
794 794

  
795 795
  @type instance: L{objects.Instance}
796 796
  @param instance: Instance whose OS is to be installed
797 797
  @type reinstall: boolean
798 798
  @param reinstall: whether this is an instance reinstall
799
  @type debug: integer
800
  @param debug: debug level, passed to the OS scripts
799 801
  @rtype: None
800 802

  
801 803
  """
802 804
  inst_os = OSFromDisk(instance.os)
803 805

  
804
  create_env = OSEnvironment(instance, inst_os)
806
  create_env = OSEnvironment(instance, inst_os, debug)
805 807
  if reinstall:
806 808
    create_env['INSTANCE_REINSTALL'] = "1"
807 809

  
......
820 822
          " log file:\n%s", result.fail_reason, "\n".join(lines), log=False)
821 823

  
822 824

  
823
def RunRenameInstance(instance, old_name):
825
def RunRenameInstance(instance, old_name, debug):
824 826
  """Run the OS rename script for an instance.
825 827

  
826 828
  @type instance: L{objects.Instance}
827 829
  @param instance: Instance whose OS is to be installed
828 830
  @type old_name: string
829 831
  @param old_name: previous instance name
832
  @type debug: integer
833
  @param debug: debug level, passed to the OS scripts
830 834
  @rtype: boolean
831 835
  @return: the success of the operation
832 836

  
833 837
  """
834 838
  inst_os = OSFromDisk(instance.os)
835 839

  
836
  rename_env = OSEnvironment(instance, inst_os)
840
  rename_env = OSEnvironment(instance, inst_os, debug)
837 841
  rename_env['OLD_INSTANCE_NAME'] = old_name
838 842

  
839 843
  logfile = "%s/rename-%s-%s-%s-%d.log" % (constants.LOG_OS_DIR, instance.os,
......
1948 1952
          disk.unique_id, disk.dev_type)
1949 1953

  
1950 1954

  
1951
def ExportSnapshot(disk, dest_node, instance, cluster_name, idx):
1955
def ExportSnapshot(disk, dest_node, instance, cluster_name, idx, debug):
1952 1956
  """Export a block device snapshot to a remote node.
1953 1957

  
1954 1958
  @type disk: L{objects.Disk}
......
1962 1966
  @type idx: int
1963 1967
  @param idx: the index of the disk in the instance's disk list,
1964 1968
      used to export to the OS scripts environment
1969
  @type debug: integer
1970
  @param debug: debug level, passed to the OS scripts
1965 1971
  @rtype: None
1966 1972

  
1967 1973
  """
1968 1974
  inst_os = OSFromDisk(instance.os)
1969
  export_env = OSEnvironment(instance, inst_os)
1975
  export_env = OSEnvironment(instance, inst_os, debug)
1970 1976

  
1971 1977
  export_script = inst_os.export_script
1972 1978

  
......
2096 2102
  return config.Dumps()
2097 2103

  
2098 2104

  
2099
def ImportOSIntoInstance(instance, src_node, src_images, cluster_name):
2105
def ImportOSIntoInstance(instance, src_node, src_images, cluster_name, debug):
2100 2106
  """Import an os image into an instance.
2101 2107

  
2102 2108
  @type instance: L{objects.Instance}
......
2105 2111
  @param src_node: source node for the disk images
2106 2112
  @type src_images: list of string
2107 2113
  @param src_images: absolute paths of the disk images
2114
  @type debug: integer
2115
  @param debug: debug level, passed to the OS scripts
2108 2116
  @rtype: list of boolean
2109 2117
  @return: each boolean represent the success of importing the n-th disk
2110 2118

  
2111 2119
  """
2112 2120
  inst_os = OSFromDisk(instance.os)
2113
  import_env = OSEnvironment(instance, inst_os)
2121
  import_env = OSEnvironment(instance, inst_os, debug)
2114 2122
  import_script = inst_os.import_script
2115 2123

  
2116 2124
  logfile = "%s/import-%s-%s-%s.log" % (constants.LOG_OS_DIR, instance.os,

Also available in: Unified diff