Using CLI to attach a volume to a VM returns successful even if the operation did not work

asked 2017-07-25 05:09:04 -0500

anva gravatar image

By implementation the code for attaching a volume to a VM does not wait to get a respons if the attaching was succeful or not. The user of the CLI gets the device node on which the volume was attached even if the operation of attaching did not succeed. /nova/compute/ code _attach_volume calls self.compute_rpcapi.attach_volume(context, instance, volume_bdm) which by implementation does cctxt.cast(ctxt, 'attach_volume', instance=instance, bdm=bdm). Because of using the cast mechanism it will not wait for a reply from the Compute node where the actual work is done, so it will never know if the attachment was succeful, and will inform the CLI user with the expected succeful yaml, according to the Openstack Compute API. RESP BODY: {"volumeAttachment": {"device": "/dev/vdc", "serverId": "04ab7b2d-daf5-4ef7-9266-e90777d5a377", "id": "6589aaef-7d9d-45d5-af0a-a6cdbaca1a7a", "volumeId": "6589aaef-7d9d-45d5-af0a-a6cdbaca1a7a"}}


To use a call instead of a cast and return to the CLI user the right answer, according to what actually happened on the compute node. The downside of this would be that it blocks the console where the CLI command was issued for the time it takes to actually attach the volume on the compute node.

Question: Why a cast is prefered against a call? Did you too in account to use a call and decided that a better way is with cast, and let the user know the device where would be attached the volume if successful?

Many thanks, Andrei Varvara

edit retag flag offensive close merge delete


Hi, for development questions/suggestions, please ask in #openstack-nova IRC channel, open a bug in or create a change request agains nova source code.


Eduardo Gonzalez gravatar imageEduardo Gonzalez ( 2017-07-25 06:02:09 -0500 )edit