@Override // DatanodeProtocol
  public DatanodeRegistration registerDatanode(DatanodeRegistration nodeReg) throws IOException {
    verifyVersion(nodeReg.getVersion());
    namesystem.registerDatanode(nodeReg);

    return nodeReg;
  }
 @Override // NamenodeProtocol
 public NamenodeRegistration register(NamenodeRegistration registration) throws IOException {
   verifyVersion(registration.getVersion());
   NamenodeRegistration myRegistration = nn.setRegistration();
   namesystem.registerBackupNode(registration, myRegistration);
   return myRegistration;
 }
 /**
  * Verify request.
  *
  * <p>Verifies correctness of the datanode version, registration ID, and if the datanode does not
  * need to be shutdown.
  *
  * @param nodeReg data node registration
  * @throws IOException
  */
 void verifyRequest(NodeRegistration nodeReg) throws IOException {
   verifyVersion(nodeReg.getVersion());
   if (!namesystem.getRegistrationID().equals(nodeReg.getRegistrationID())) {
     LOG.warn(
         "Invalid registrationID - expected: "
             + namesystem.getRegistrationID()
             + " received: "
             + nodeReg.getRegistrationID());
     throw new UnregisteredNodeException(nodeReg);
   }
 }