Revision debed9ae lib/backend.py

b/lib/backend.py
2855 2855
  logging.info("Finalizing import/export %s", name)
2856 2856

  
2857 2857
  status_dir = utils.PathJoin(constants.IMPORT_EXPORT_DIR, name)
2858
  pid_file = utils.PathJoin(status_dir, _IES_PID_FILE)
2859 2858

  
2860
  pid = None
2861
  try:
2862
    fd = os.open(pid_file, os.O_RDONLY)
2863
  except EnvironmentError, err:
2864
    if err.errno != errno.ENOENT:
2865
      raise
2866
    # PID file doesn't exist
2867
  else:
2868
    try:
2869
      try:
2870
        # Try to acquire lock
2871
        utils.LockFile(fd)
2872
      except errors.LockError:
2873
        # Couldn't lock, daemon is running
2874
        pid = int(os.read(fd, 100))
2875
    finally:
2876
      os.close(fd)
2859
  pid = utils.ReadLockedPidFile(utils.PathJoin(status_dir, _IES_PID_FILE))
2877 2860

  
2878 2861
  if pid:
2879 2862
    logging.info("Import/export %s is still running with PID %s",

Also available in: Unified diff