[sdk] openstacksdk vs. server groups

thoralf schulze t.schulze at tu-berlin.de
Fri Sep 11 17:08:11 UTC 2020


hi there,

the current openstack-sdk crashes while trying to process instances that
are part of a server group. to give an example:
one of our instances shows up in the output of "openstack-inventory
--list --debug" as

[…]
REQ: curl -g -i -X GET
https://redacted:8774/v2.1/servers/352307ba-0c06-43e5-ba21-467ec25a4a2e
-H "OpenStack-API-Version: compute 2.72" -H "User-Agent:
openstacksdk/0.49.0 keystoneauth1/4.2.1 python-requests/2.
22.0 CPython/3.8.2" -H "X-Auth-Token: redacted" -H
"X-OpenStack-Nova-API-Version: 2.72"
RESP: [200] Connection: Keep-Alive Content-Length: 2024 Content-Type:
application/json Date: Fri, 11 Sep 2020 15:22:14 GMT Keep-Alive:
timeout=5, max=92 OpenStack-API-Version: compute 2.72 Server:
Apache/2.4.29 (Ubuntu) Vary: Op
enStack-API-Version,X-OpenStack-Nova-API-Version
X-OpenStack-Nova-API-Version: 2.72 x-compute-request-id:
req-54078034-3b9e-42bc-afeb-c9c2288db568 x-openstack-request-id:
req-54078034-3b9e-42bc-afeb-c9c2288db568
RESP BODY: {"server": {"id": "352307ba-0c06-43e5-ba21-467ec25a4a2e",
"name": "dss-test-aaai2hq3gmjc-node-0", "status": "ACTIVE", "tenant_id":
"56c37bc705364d34a5f423c531d9e1a7", "user_id":
"120258b9dbc7831140ed30b57366fe91feaa77608c7a118da9cf0f6288f1886b",
"metadata": {}, "hostId":
"16e275df317b4699aa6fdb52b437295c4e3beb83b5e4d15276314660", "image":
{"id": "41bb79e0-0962-4162-b9c5-ff178ab61218", "links": [{"rel":
"bookmark", "href":
"https://redacted/images/41bb79e0-0962-4162-b9c5-ff178ab61218"}]},
"flavor": {"vcpus": 8, "ram": 16384, "disk": 100, "ephemeral": 0,
"swap": 0, "original_name": "tx.medium", "extra_specs":
{"hw:mem_page_size": "large", "hw:watchdog_action": "reset",
"hw_rng:allowed": "true", "hw_rng:rate_bytes": "24",
"hw_rng:rate_period": "5000", "trait:CUSTOM_DC_CLASS_TEST":
"required"}}, "created": "2020-07-10T07:09:48Z", "updated":
"2020-07-10T07:09:59Z", "addresses": {"dss-test": [{"version": 4,
"addr": "10.0.0.42", "OS-EXT-IPS:type": "fixed",
"OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:62:3e:69"}, {"version": 4, "addr":
"10.176.1.154", "OS-EXT-IPS:type": "floating",
"OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:62:3e:69"}]}, "accessIPv4": "",
"accessIPv6": "", "links": [{"rel": "self", "href":
"https://redacted/v2.1/servers/352307ba-0c06-43e5-ba21-467ec25a4a2e"},
{"rel": "bookmark", "href":
"https://redacted/servers/352307ba-0c06-43e5-ba21-467ec25a4a2e"}],
"OS-DCF:diskConfig": "MANUAL", "progress": 0,
"OS-EXT-AZ:availability_zone": "BARZ", "config_drive": "", "key_name":
null, "OS-SRV-USG:launched_at": "2020-07-10T07:09:58.000000",
"OS-SRV-USG:terminated_at": null, "security_groups": [{"name":
"dss-test-aaai2hq3gmjc-secgroup_kube_minion-cjco6vmpgs6j"}],
"OS-EXT-STS:task_state": null, "OS-EXT-STS:vm_state": "active",
"OS-EXT-STS:power_state": 1, "os-extended-volumes:volumes_attached": [],
"locked": false, "description": null, "tags": [],
"trusted_image_certificates": null, "server_groups":
["2b9dfdd8-0a5e-45ec-af07-1a0437a7f61e"]}}

due to the value of "server_groups" not being a dict,
openstack/resource.py crashes while trying to process this instance:

  File
"/home/ubuntu/.local/lib/python3.8/site-packages/openstack/resource.py",
line 82, in _convert_type
    return data_type(value)
ValueError: dictionary update sequence element #0 has length 1; 2 is
required

is server_groups really supposed to be just a list of uuids? having it
dealt with in a manner akin to security_groups seems to be an obvious
choice …

thank you very much & with kind regards,
t.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20200911/a3b78012/attachment-0001.sig>


More information about the openstack-discuss mailing list