server is required in openstack volume attachment create while it is optional in cinder api
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| python-openstackclient |
New
|
Undecided
|
Unassigned | ||
Bug Description
osc is needlessly restrictive in 'volume attachment create'. Supplying a 'server' is mandatory in the cli, while it is optional in the cinder api.
cinder api accepts instance=null:
$ source openrc admin admin
$ export TOKEN="$( openstack token issue -f value -c id )"
$ curl -s -H "X-Auth-Token: $TOKEN" -H "OpenStack-
{
"attachment" : {
"attach_mode" : "ro",
"attached_at" : "",
"
"detached_at" : "",
"id" : "4e8dae68-
"instance" : null,
"status" : "reserved",
"volume_id" : "472a7656-
}
}
$ openstack volume attachment delete ...
But osc does not:
$ openstack volume create --size 1 vol0
$ openstack volume attachment create --mode ro vol0
usage: openstack volume attachment create [-h] [-f {json,shell,
openstack volume attachment create: error: the following arguments are required: <server>
However it does work as expected when both the volume and the server are given:
$ openstack server create --flavor cirros256 --image cirros-
$ openstack volume attachment create --mode ro vol0 vm0
as expected
$ openstack volume attachment delete ...
See also:
cinder api-ref: https:/
related code: https:/
$ openstack --version
openstack 7.2.0
$ openstack --debug
[snip]
compute API version 2.1, cmd group openstack.
identity API version 3, cmd group openstack.
image API version 2, cmd group openstack.image.v2
network API version 2, cmd group openstack.
object_store API version 1, cmd group openstack.
volume API version 3, cmd group openstack.volume.v3
orchestration API version 1, cmd group openstack.
alarming API version 2, cmd group openstack.
load_balancer API version 2.0, cmd group openstack.
baremetal API version 1.92, cmd group openstack.
key_manager API version 1, cmd group openstack.
database API version 1, cmd group openstack.
placement API version 1, cmd group openstack.
rca API version 1, cmd group openstack.rca.v1
container_infra API version 1, cmd group openstack.
workflow_engine API version 2, cmd group openstack.
container API version 1, cmd group openstack.
dns API version 2, cmd group openstack.dns.v2
messaging API version 2, cmd group openstack.
share API version 2.84, cmd group openstack.share.v2
reservation API version 1, cmd group openstack.
neutronclient API version 2, cmd group openstack.
[snip]