How to serializer the openstack.compute.v2.server.ServerDetail ?
I use the openstacksdk for develop my own openstack app.
But when I get the generator of my connection:
user_conn = UserOpenstackConn()
openstack_servers_gen = user_conn.conn.compute.servers()
I can use the list() to convert the openstack_servers_gen to list:
: [openstack.compute.v2.server.ServerDetail(OS-EXT-AZ:availability_zone=, key_name=None, hostId=, os-extended-volumes:volumes_attached=[], OS-SRV-USG:launched_at=None, OS-EXT-STS:vm_state=error, flavor={'id': '5c5dca53-9f96-4851-afd4-60de75faf896', 'links': [{'href': 'http://controller:8774/233cf23186bf4c52afc464ee008cdf7f/flavors/5c5dca53-9f96-4851-afd4-60de75faf896', 'rel': 'bookmark'}]}, updated=2017-11-27T10:29:50Z, accessIPv4=, image={'id': '60f4005e-5daf-4aef-a018-4c6b2ff06b40', 'links': [{'href': 'http://controller:8774/233cf23186bf4c52afc464ee008cdf7f/images/60f4005e-5daf-4aef-a018-4c6b2ff06b40', 'rel': 'bookmark'}]}, created=2017-11-27T10:29:49Z, metadata={}, links=[{'href': 'http://controller:8774/v2.1/233cf23186bf4c52afc464ee008cdf7f/servers/3db46b7b-a641-49ce-97ef-f17c9a11f58a', 'rel': 'self'}, {'href': 'http://controller:8774/233cf23186bf4c52afc464ee008cdf7f/servers/3db46b7b-a641-49ce-97ef-f17c9a11f58a', 'rel': 'bookmark'}], OS-DCF:diskConfig=MANUAL, id=3db46b7b-a641-49ce-97ef-f17c9a11f58a, user_id=41bb48ee30e449d5868f7af9e6251156, OS-SRV-USG:terminated_at=None, name=123456, config_drive=, accessIPv6=, OS-EXT-STS:power_state=0, addresses={}, OS-EXT-STS:task_state=None, status=ERROR, tenant_id=233cf23186bf4c52afc464ee008cdf7f), openstack.compute.v2.server.ServerDetail(OS-EXT-AZ:availability_zone=, key_name=None, hostId=, os-extended-volumes:volumes_attached=[], OS-SRV-USG:launched_at=None, OS-EXT-STS:vm_state=error, flavor={'id': '5c5dca53-9f96-4851-afd4-60de75faf896', 'links': [{'href': 'http://controller:8774/233cf23186bf4c52afc464ee008cdf7f/flavors/5c5dca53-9f96-4851-afd4-60de75faf896', 'rel': 'bookmark'}]}, updated=2017-11-27T10:27:42Z, accessIPv4=, image={'id': '60f4005e-5daf-4aef-a018-4c6b2ff06b40', 'links': [{'href': 'http://controller:8774/233cf23186bf4c52afc464ee008cdf7f/images/60f4005e-5daf-4aef-a018-4c6b2ff06b40', 'rel': 'bookmark'}]}, created=2017-11-27T10:27:41Z, metadata={}, links=[{'href': 'http://controller:8774/v2.1/233cf23186bf4c52afc464ee008cdf7f/servers/721467ac-440f-4784-b825-f6155c65abee', 'rel': 'self'}, {'href': 'http://controller:8774/233cf23186bf4c52afc464ee008 .......
But how can I make it to be serializable in my project?
Such as if I write the Serializer to map it I do not know how to deal with the bellow key:
os-extended-volumes:volumes_attached
EDIT-1x
I open another post, which can be related to this post:
How to serializer the openstack.compute.v2.server.ServerDetail?
When I hear serializer in Python, I immediately think of pickle, but maybe there is another way. It used to be with the SDK that you could repr and object and recreate it with that. I'm not sure if that still works anymore, it should. The other thing that comes to mind is just converting to json, but in that case you might lose some data that would be in the url. It depends on what you need on the other side.