code: public DatanodeRegistration getDNRegistrationForNS(int namespaceId) 
    throws IOException {
      NamespaceService nsos = namespaceManager.get(namespaceId);
      if(nsos==null || nsos.getNsRegistration()==null) {
        throw new IOException("cannot find NSOfferService for namespaceId="+namespaceId);
      }
      return nsos.getNsRegistration();
    }
docs: get datanode registration by namespace id
  @param namespaceId
  @return datanode registration object
  @throws IOException