@Override // DatanodeProtocol
 public DatanodeRegistration registerDatanode(DatanodeRegistration nodeReg) throws IOException {
   verifyLayoutVersion(nodeReg.getVersion());
   verifySoftwareVersion(nodeReg);
   namesystem.registerDatanode(nodeReg);
   return nodeReg;
 }
 @Override // NamenodeProtocol
 public NamenodeRegistration register(NamenodeRegistration registration) throws IOException {
   verifyLayoutVersion(registration.getVersion());
   NamenodeRegistration myRegistration = nn.setRegistration();
   namesystem.registerBackupNode(registration, myRegistration);
   return myRegistration;
 }
 /**
  * Verifies the given registration.
  *
  * @param nodeReg node registration
  * @throws UnregisteredNodeException if the registration is invalid
  */
 void verifyRequest(NodeRegistration nodeReg) throws IOException {
   verifyLayoutVersion(nodeReg.getVersion());
   if (!namesystem.getRegistrationID().equals(nodeReg.getRegistrationID())) {
     LOG.warn(
         "Invalid registrationID - expected: "
             + namesystem.getRegistrationID()
             + " received: "
             + nodeReg.getRegistrationID());
     throw new UnregisteredNodeException(nodeReg);
   }
 }