static String findPoolName(OperationContext context, String jndiName)
     throws OperationFailedException {
   PathAddress address = context.getCurrentAddress();
   PathAddress rootAddress = address.subAddress(0, address.size() - 4);
   PathAddress subsystemAddress =
       rootAddress.append(
           PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "datasources"));
   Resource subsystem = context.readResourceFromRoot(subsystemAddress);
   for (String type : Arrays.asList("data-source", "xa-data-source")) {
     if (subsystem.hasChildren(type)) {
       for (Resource.ResourceEntry entry : subsystem.getChildren(type)) {
         ModelNode model = entry.getModel();
         if (model.get("jndi-name").asString().equals(jndiName)) {
           return entry.getName();
         }
       }
     }
   }
   throw InfinispanLogger.ROOT_LOGGER.dataSourceJndiNameNotFound(jndiName);
 }