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



_______________________________________________
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to