0

After authenticating, if I call any method, like os.compute().flavors().list() or os.images().list(), I get connect timed out. Why is this happening?

I set up a OpenStack with RDO packstack at a GoogleCloudsPlataform VM. I am doing auth with domain and project. Ive tried authing without project, and method calls did not timed out, but the responses were wrong, e.g, if I called list flavors, return none flavor.

If I do those calls with API endpoints, it works; if I auth with the same infos (user, pass, domain, project) and call flavors or images, it works.

Auth code:

OSClient.OSClientV3 os = OSFactory.builderV3()
                .endpoint("http://host:5000/v3")
                .credentials("admin", "pass", domain)
                .scopeToProject(project)
                .authenticate();

os.compute().flavors().list(); // "connection timed out" code

Endpoint auth call (that works):

curl -i \
  -H "Content-Type: application/json" \
  -d '
{ "auth": {
    "identity": {
      "methods": ["password"],
      "password": {
        "user": {
          "name": "admin",
          "domain": { "id": "default" },
          "password": "pass"
        }
      }
    },
    "scope": {
      "project": {
        "name": "admin",
        "domain": { "id": "default" }
      }
    }
  }
}' \
"http://host:5000/v3/auth/tokens" ; echo

Endpoint images call:

curl -v -i -H "Content-Type: application/json" -H "X-Auth-Token:token" "http://host:8774/v2/images"; echo
Kilmer Luiz Aleluia
  • 305
  • 1
  • 3
  • 14

1 Answers1

0

In general, if you are getting timeouts on HTTP requests, the things to check are:

  • Are you using the correct hostname or IP address?
  • Are you using the correct port?
  • Is access being blocked by a firewall (somewhere)?
  • Is access being thwarted by misconfigured network routing (somewhere)?

Since you are using openstack4j, you can probably get more insights as to what is going on by turning on logging of the HTTP requests:

OSFactory.enableHttpLoggingFilter(true);

Check that it is sending requests to the V2 glance endpoint.

If that fails, use your IDE's Java debugger to figure out what requests are being sent to which service endpoints.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • Thanks in advance for helping me. I add that loggin code and I found out that `os` is calling internal IP from my GCP VM, for some reason, instead of the external one that I set. Do you know if there is some way I can set host before calling openstack4j methods? Just to be clear, when creating `os`, I set the external IP, so I dont know where openstack4j get that internal IP. – Kilmer Luiz Aleluia Apr 19 '19 at 19:27
  • I can't diagnose this for you, but look at how / where you have set the IP on the host, and how / where the OSclient library is getting the wrong IP from. Bear in mind that Java *may* be using its own DNS resolver ... https://stackoverflow.com/questions/11647629/how-to-configure-hostname-resolution-to-use-a-custom-dns-server-in-java – Stephen C Apr 20 '19 at 02:03