在使用openstack4j连接调用OpenStack时,报错
具体部分报错:
Exception in thread "main" ConnectionException{message=RESTEASY004655: Unable to invoke request, status=0}
at org.openstack4j.connectors.resteasy.HttpExecutorServiceImpl.invoke(HttpExecutorServiceImpl.java:57)
at org.openstack4j.connectors.resteasy.HttpExecutorServiceImpl.execute(HttpExecutorServiceImpl.java:31)
at org.openstack4j.core.transport.internal.HttpExecutor.execute(HttpExecutor.java:51)
at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:213)
at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:207)
at
.............................
Caused by: java.net.UnknownHostException: controller
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
OpenStack环境:通过在两台虚拟机上搭建的OpenStack环境,两台虚拟机的主机名分别为controller、compute。而这里报错为未知主机。
解决:
(1)在Windows下打开windws/system32/driver/etc/hosts,添加以下内容
虚拟机IP controller 虚拟机IP compute
(2)linux服务器
vi /etc/hosts