openstacksdk conn.list_server() result doesn't have "hostname" attribute

asked 2019-04-13 12:59:20 -0500

legochen gravatar image

Hi, I’m encountering an openstacksdk issue. The .list_server result doesn’t include hostname attribute.

# Import the OpenStack connection class from the SDK
from openstack import connection

# Create a connection object by calling the constructor and pass the security information
conn = connection.Connection(auth_url="XXXX",
project_name="admin",
username="XXXX",
password="XXXX",
user_domain_id="default",
compute_api_version='2',
project_domain_id="default")

# Iterate through the list of VMs and print them
for server in conn.list_servers():
    print(server)

I have made some tests, looks like it missed to determine hostname in the Server class.

I have tried the add one line hostname = resource.Body('hostname') after the following line, then I can see hostname showed in list_server()result. https://github.com/openstack/openstacksdk/blob/master/openstack/compute/v2/server.py#L139 (https://github.com/openstack/openstac...)

Not sure is there any reason SDK doesn’t determine hostname in the Server class or just missed.

I’m just new to OpenStack, please help to guide me how to solve this issue. I think hostname is one of necessary attributes of compute server information.

edit retag flag offensive close merge delete