Revision f9323011 lib/impexpd/__init__.py

b/lib/impexpd/__init__.py
82 82
(PROG_OTHER,
83 83
 PROG_SOCAT,
84 84
 PROG_DD,
85
 PROG_DD_PID) = range(1, 5)
85
 PROG_DD_PID,
86
 PROG_EXP_SIZE) = range(1, 6)
86 87
PROG_ALL = frozenset([
87 88
  PROG_OTHER,
88 89
  PROG_SOCAT,
89 90
  PROG_DD,
90 91
  PROG_DD_PID,
92
  PROG_EXP_SIZE,
91 93
  ])
92 94

  
93 95

  
......
274 276

  
275 277

  
276 278
class ChildIOProcessor(object):
277
  def __init__(self, debug, status_file, logger, throughput_samples):
279
  def __init__(self, debug, status_file, logger, throughput_samples, exp_size):
278 280
    """Initializes this class.
279 281

  
280 282
    """
......
291 293
    self._dd_progress = []
292 294

  
293 295
    # Expected size of transferred data
294
    self._exp_size = None
296
    self._exp_size = exp_size
295 297

  
296 298
  def GetLineSplitter(self, prog):
297 299
    """Returns the line splitter for a program.
......
389 391
      self._dd_pid = int(line)
390 392
      forward_line = None
391 393

  
394
    elif prog == PROG_EXP_SIZE:
395
      logging.debug("Received predicted size %r", line)
396
      forward_line = None
397

  
398
      if line:
399
        try:
400
          exp_size = utils.BytesToMebibyte(int(line))
401
        except (ValueError, TypeError), err:
402
          logging.error("Failed to convert predicted size %r to number: %s",
403
                        line, err)
404
          exp_size = None
405
      else:
406
        exp_size = None
407

  
408
      self._exp_size = exp_size
409

  
392 410
    if forward_line:
393 411
      self._logger.info(forward_line)
394 412
      self._status_file.AddRecentOutput(forward_line)

Also available in: Unified diff