Zun

'zun start' and 'zun delete' should accept only container ids but not name

Bug #1634411 reported by Pradeep Kumar Singh
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zun
Fix Committed
Undecided
Pradeep Kumar Singh

Bug Description

vagrant@vagrant:~$ zun list
+--------------------------------------+------+----------+---------------+--------+------------+-------+
| uuid | name | status | task_state | image | command | ports |
+--------------------------------------+------+----------+---------------+--------+------------+-------+
| f5a91fb9-d30c-4780-b5e3-8dd7d6b9a3dc | test | Running | None | cirros | sleep 1000 | [] |
| 23ccf3d4-5750-4113-817c-fad1fade80b5 | test | Creating | image_pulling | cirros | sleep 1000 | [] |
+--------------------------------------+------+----------+---------------+--------+------------+-------+
vagrant@vagrant:~$ zun list
+--------------------------------------+------+---------+------------+--------+------------+-------+
| uuid | name | status | task_state | image | command | ports |
+--------------------------------------+------+---------+------------+--------+------------+-------+
| f5a91fb9-d30c-4780-b5e3-8dd7d6b9a3dc | test | Running | None | cirros | sleep 1000 | [] |
| 23ccf3d4-5750-4113-817c-fad1fade80b5 | test | Stopped | None | cirros | sleep 1000 | [] |
+--------------------------------------+------+---------+------------+--------+------------+-------+
vagrant@vagrant:~$ zun start test
Start for container test failed: Conflict (HTTP 409) (Request-ID: req-4a8c432e-7ea6-404e-a00e-2f1dd7acaea0)
vagrant@vagrant:~$ zun delete test
Delete for container test failed: Conflict (HTTP 409) (Request-ID: req-a7aff841-a0c5-4f09-ac83-071e20a85789)
vagrant@vagrant:~$ zun start 23ccf3d4-5750-4113-817c-fad1fade80b5
Request to start container 23ccf3d4-5750-4113-817c-fad1fade80b5 has been accepted.
vagrant@vagrant:~$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8f00e6be2e67 cirros "sleep 1000" 2 minutes ago Up 5 seconds silly_agnesi
ab10399197fa cirros "sleep 1000" 13 minutes ago Up 13 minutes hungry_mirzakhani

Revision history for this message
Pradeep Kumar Singh (pradeep-singh-u) wrote :

And BTW why i am able to create two containers with same name on same host?
And if one container stops, i am not able to delete another
vagrant@vagrant:~$ zun list
+--------------------------------------+------+---------+------------+--------+------------+-------+
| uuid | name | status | task_state | image | command | ports |
+--------------------------------------+------+---------+------------+--------+------------+-------+
| f5a91fb9-d30c-4780-b5e3-8dd7d6b9a3dc | test | Stopped | None | cirros | sleep 1000 | [] |
| 23ccf3d4-5750-4113-817c-fad1fade80b5 | test | Running | None | cirros | sleep 1000 | [] |
+--------------------------------------+------+---------+------------+--------+------------+-------+
vagrant@vagrant:~$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8f00e6be2e67 cirros "sleep 1000" 8 minutes ago Up 6 minutes silly_agnesi
vagrant@vagrant:~$ zun delete 23ccf3d4-5750-4113-817c-fad1fade80b5
Delete for container 23ccf3d4-5750-4113-817c-fad1fade80b5 failed: Conflict (HTTP 409) (Request-ID: req-da58a743-da93-459c-ac24-83ab5e460399)
vagrant@vagrant:~$ zun delete f5a91fb9-d30c-4780-b5e3-8dd7d6b9a3dc
Request to delete container f5a91fb9-d30c-4780-b5e3-8dd7d6b9a3dc has been accepted.
vagrant@vagrant:~$ zun delete 23ccf3d4-5750-4113-817c-fad1fade80b5
Delete for container 23ccf3d4-5750-4113-817c-fad1fade80b5 failed: Conflict (HTTP 409) (Request-ID: req-d180bbec-e3ba-417b-98f8-bbde571f7a9f)
vagrant@vagrant:~$

Changed in zun:
assignee: nobody → Pradeep Kumar Singh (pradeep-singh-u)
Revision history for this message
Pradeep Kumar Singh (pradeep-singh-u) wrote :

I think only issue in this bug is,
when to use name and when to use id, should be explanatory.
Using alone ID, should resolve the issue.

Revision history for this message
HengHa (2001xxj) wrote :

I think the logic should be when enter a container name for zun start and zun delete, it may return immediately and prompt that more than one containers have the same name and suggest user to use container ID then. This logic is already used in Nova, if I don't wrongly remember.

Anyway, accepting both container name and ID is neccesary and this is a common behavior in other Openstack project.

Revision history for this message
Pradeep Kumar Singh (pradeep-singh-u) wrote :

This Bug has been rectified in https://review.openstack.org/#/c/394347/.

Changed in zun:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.