"openstack volume create" sending null values in create requests
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| python-openstackclient |
Confirmed
|
Undecided
|
Chaemin Lim | ||
Bug Description
The "openstack volume create" command is sending null values for unset fields in create requests. For example, when running "openstack volume create --size 1 testvolume", the result request is:
{
"volume": {
"status": "creating",
"user_id": null,
"name": "testvolume",
"imageRef": null,
"availabili
"description": null,
"multiattach": false,
"attach_
"volume_type": null,
"metadata": {},
"consistenc
"source_volid": null,
"snapshot_id": null,
"project_id": null,
"source_
"size": 1
}
}
Unset fields should probably be omitted from the request rather than sent as null.
| Changed in python-openstackclient: | |
| assignee: | nobody → 임채민 (antraxmin) |
Hello, I tried to analyze the code to resolve this issue.
After adding debugging logs and checking actual API requests, I found the following:
If you add code to filter null values in the python- openstackclient :
volume_args = {k: v for k, v in volume_args.items() if v is not None}
The actual API request still included a null value.
Debug Log Results:
Volume args before filtering: {'size': 1, 'snapshot_id': None, ...}
Volume args after filtering: {'size': 1, 'name': 'test_volume'}
Final volume args being passed to create(): {'size': 1, 'name': 'test_volume'}
However, actual API requests: up_id": null, "snapshot_id": null, ...}}'
REQ: -d '{"volume": {"size": 1, "consistencygro
When I checked the code in python- cinderclient, the create method in the v3/volumes.py file included all parameters in the API request as they were without null value filtering: up_id': consistencygrou p_id, ...}}
body = {'volume': {'size': size, 'consistencygro
Therefore, I decided that both projects needed to be fixed to completely resolve this bug openstackclient :adding null value filtering code cinderclient: add null value filtering logic in create method
- python-
- python-
I'd appreciate it if you could review what I analyzed and if the approach is correct. Please advise if there is anything you missed or if you need to consider other approaches.