Revision a002ed79 lib/ovf.py

b/lib/ovf.py
143 143
  COW: "http://www.gnome.org/~markmc/qcow-image-format.html",
144 144
}
145 145

  
146
def CheckQemuImg():
147
  """ Make sure that qemu-img is present before performing operations.
148

  
149
  @raise errors.OpPrereqError: when qemu-img was not found in the system
150

  
151
  """
152
  if not constants.QEMUIMG_PATH:
153
    raise errors.OpPrereqError("qemu-img not found at build time, unable"
154
                               " to continue")
146 155

  
147 156
def LinkFile(old_path, prefix=None, suffix=None, directory=None):
148 157
  """Create link with a given prefix and suffix.
......
916 925
    @raise errors.OpPrereqError: convertion of the disk failed
917 926

  
918 927
    """
928
    CheckQemuImg()
919 929
    disk_file = os.path.basename(disk_path)
920 930
    (disk_name, disk_extension) = os.path.splitext(disk_file)
921 931
    if disk_extension != disk_format:
......
953 963
    @raise errors.OpPrereqError: format information cannot be retrieved
954 964

  
955 965
    """
966
    CheckQemuImg()
956 967
    args = ["qemu-img", "info", disk_path]
957 968
    run_result = utils.RunCmd(args, cwd=os.getcwd())
958 969
    if run_result.failed:
......
1317 1328
      information or size information is invalid or creation failed
1318 1329

  
1319 1330
    """
1331
    CheckQemuImg()
1320 1332
    assert self.options.disks
1321 1333
    results = {}
1322 1334
    for (disk_id, disk_desc) in self.options.disks:

Also available in: Unified diff