Ejemplo n.º 1
0
  private void startupCleanup(String parent) {
    s_logger.info("Cleanup mounted NFS mount points used in previous session");

    long mshostId = ManagementServerNode.getManagementServerId();

    // cleanup left-over NFS mounts from previous session
    String[] mounts = _storage.listFiles(parent + File.separator + String.valueOf(mshostId) + ".*");
    if (mounts != null && mounts.length > 0) {
      for (String mountPoint : mounts) {
        s_logger.info("umount NFS mount from previous session: " + mountPoint);

        String result = null;
        Script command = new Script(true, "umount", _timeout, s_logger);
        command.add(mountPoint);
        result = command.execute();
        if (result != null) {
          s_logger.warn("Unable to umount " + mountPoint + " due to " + result);
        }
        File file = new File(mountPoint);
        if (file.exists()) {
          file.delete();
        }
      }
    }
  }
 @Override
 public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
   _executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("Upload-Monitor"));
   _monitoringInterval = UploadMonitoringInterval.value();
   _uploadOperationTimeout = UploadOperationTimeout.value() * 60 * 1000;
   _nodeId = ManagementServerNode.getManagementServerId();
   return true;
 }
Ejemplo n.º 3
0
  private String setupMountPoint(String parent) {
    String mountPoint = null;
    long mshostId = ManagementServerNode.getManagementServerId();
    for (int i = 0; i < 10; i++) {
      String mntPt =
          parent
              + File.separator
              + String.valueOf(mshostId)
              + "."
              + Integer.toHexString(_rand.nextInt(Integer.MAX_VALUE));
      File file = new File(mntPt);
      if (!file.exists()) {
        if (_storage.mkdir(mntPt)) {
          mountPoint = mntPt;
          break;
        }
      }
      s_logger.error("Unable to create mount: " + mntPt);
    }

    return mountPoint;
  }