[openstack-dev] [Heat][Nova][Neutron]Detach interface will delete the port

Huangtianhua huangtianhua at huawei.com
Thu Apr 17 06:49:41 UTC 2014


Hi all,

Port is a resource define in Heat. And heat support the actions: create a port/delete a port/attach to a server/detach from a server.

But we can't re-attach a port which once be detached.

-----------------------------------------------------------------------------------------------------------------------------------------------------
There is such a scenario:


1.       Create a stack with a template:

......

resources:

  my_instance:

    type: OS::Nova::Server

    properties:

      image: { get_param: ImageId }

      flavor: { get_param: InstanceType }

      networks: [ { "port" : {"Ref": "instacne_port"}}]



  instacne_port:

    type: OS::Neutron::Port

    properties:

          network_id: { get_param: Network }



Heat will create a port and a server, and attach the port to the server.



2.       I want to attach the port the another server, so I update the stack with a new template:

......

resources:

  my_instance:

    type: OS::Nova::Server

    properties:

      image: { get_param: ImageId }

      flavor: { get_param: InstanceType }

  my_instance2:

    type: OS::Nova::Server

    properties:

      image: { get_param: ImageId }

      flavor: { get_param: InstanceType }

      networks: [ { "port" : {"Ref": "instacne_port"}}]



  instacne_port:

    type: OS::Neutron::Port

    properties:

          network_id: { get_param: Network }



Heat will invoke the nova "detach_interface" API to detach the interface, and wanted to attach the port to the new server.

But the stack update is failed , and there is an 404 "portId not find" error raised on neutron. Because the port has been deleted while detaching.



There is no real detach api for heat to invoke. The nova API "detach_interface" will invoke the Neutron API "delete_port", and then the port will be deleted.
   -------------------------------------------------------------------------------------------------------------------------------------------------------

I think there are two solutions:
First:
Heat get the port information before to "detach", and to create the port again before to "attach".

But I think it looks ugly and will increase risk failure for re-create.

Second:
Neutron provide a detach_port api to nova, so that nova provide the real "detach" not "delete" to heat.

What do you think about?

Cheers

Tianhua



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140417/7ae4af96/attachment.html>


More information about the OpenStack-dev mailing list