<br><br><div class="gmail_quote">On Mon, Jul 30, 2012 at 10:28 PM, Nati Ueno <span dir="ltr"><<a href="mailto:nati.ueno@gmail.com" target="_blank">nati.ueno@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi  Matt, Yong, Dan and folks<br>
<br>
> Matt<br>
Thank you for your comment in launchpad<br>
<a href="https://bugs.launchpad.net/nova/+bug/1031096" target="_blank">https://bugs.launchpad.net/nova/+bug/1031096</a><br> </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Quantum team get consensus in a Netstack meeting today to propose<br>
 port-id for requested networks. I took the job.<br>
At first, i thought i can write extension for this. But as you say<br>
 we should add port-id for the core API which is only used for quantum API 2.0.<br></blockquote><div><br></div><div>Hi Nachi, why is it that we can't implement this as an API extension (even if passing in a network-id is in fact part of the core API)?  </div>

<div><br></div><div>dan</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
My WIP code is like [1]. This change keep backward compatibility.<br>
<br>
> Yong, Dan<br>
Matt said "you'd be breaking API compatibility and thus the API spec."<br>
<br>
This work will change API, so some consensus in community is needed to<br>
add port_id.<br>
I wanna discuss about the spec in this thread.<br>
If the community rejects this addition, I'll implement fixed_ip one<br>
 ( see previous my message )<br>
<br>
[1] WIP code for adding port_id ( Not tested)<br>
<br>
+    def _get_port(self, port_id):<br>
+        if FLAGS.network_api_class !=<br>
+        "nova.network.quantumv2.api.API":<br>
+            msg = _("Unknown argment : port_id")<br>
+            raise exc.HTTPBadRequest(explanation=msg)<br>
+<br>
+        if port_id and not utils.is_uuid_like(port_id):<br>
+            msg = _("Bad port format: port uuid is "<br>
+                    "not in proper format "<br>
+                    "(%s)") % port_id<br>
+            raise exc.HTTPBadRequest(explanation=msg)<br>
+        try:<br>
+            port = quantumv2.get_client(context).list_networks(**search_opts)<br>
+            if port.device_id:<br>
+                raise Exception("Port id %s is already used" % port_id)<br>
+            return port<br>
+        except Exception as e:<br>
+            msg = _("This port_id can't used "<br>
+                    "(%s)") % port_id<br>
+            raise exc.HTTPBadRequest(explanation=msg)<br>
+<br>
     def _get_requested_networks(self, requested_networks):<br>
         """Create a list of requested networks from the networks attribute."""<br>
         networks = []<br>
         for network in requested_networks:<br>
             try:<br>
+                port_id = network.get('port_id', None)<br>
+                if port_id:<br>
+                    port = self._get_port()<br>
+                    network['uuid'] = port.network_id<br>
+                    network['fixed_ip'] = port.fixed_ip<br>
+<br>
<br>
Thank you in advance<br>
Nachi Ueno<br>
<br>
>> Hi Nachi,<br>
>> It is seemingly a way to make it work, but I think we are thinking to<br>
>> provide 'port-id' or just 'port' to specify the top resource in quantum API.<br>
>> fix ip is not one.<br>
>><br>
>> Besides, Port can be assigned to more than one fixed IP.<br>
><br>
>Ah, It it true.<br>
>OK I'll implement port id version.<br>
><br>
>> Imagine in horizon, we created many networks, ports and subnets, but when<br>
>> booting a VM, we use a fixed_ip to specify our resource indirectly.<br>
><br>
>> By the way, we should use <a href="mailto:openstack-dev@list.openstack.org">openstack-dev@list.openstack.org</a><br>
><br>
>Sorry, I changed my mail address recently. But  launchpad rejects new<br>
>mail to receive.<br>
>I'll find way to fix this.<br>
><br>
>Thanks<br>
><br>
><br>
>Nachi<br>
><br>
>> Thanks<br>
>> Yong Sheng Gong<br>
>><br>
>> -----netstack-bounces+gongysh=<a href="mailto:cn.ibm.com@lists.launchpad.net">cn.ibm.com@lists.launchpad.net</a> wrote: -----<br>
>> To: <a href="mailto:openstack@lists.openstack.org">openstack@lists.openstack.org</a>, <a href="mailto:netstack@lists.launchpad.net">netstack@lists.launchpad.net</a><br>
>> From: Nachi Ueno<br>
>> Sent by: netstack-bounces+gongysh=<a href="mailto:cn.ibm.com@lists.launchpad.net">cn.ibm.com@lists.launchpad.net</a><br>
>> Date: 07/31/2012 08:33AM<br>
>> Subject: [Netstack] [Quantum][Nova] requested_id and port spec<br>
>><br>
>> Hi Dan,folks<br>
>><br>
>> As we talked in netstack IRC meetins, I submit this as bug.<br>
>> <a href="https://bugs.launchpad.net/nova/+bug/1031096" target="_blank">https://bugs.launchpad.net/nova/+bug/1031096</a><br>
>><br>
>> I tried to write this, but  the code looks very ugly in order to keep<br>
>> backward compatibility.<br>
>> So I wanna propose an alternative design.<br>
>> In this design, we will use fixed_ip as a temporary identifier of the port.<br>
>><br>
>> 1. create port<br>
>>    fixed_ip assigned<br>
>><br>
>> 2. specify  the fixed_ip in nova boot<br>
>><br>
>> 3. If the fixed_ip is specified,<br>
>>   nova.network.quantumv2.api.API will check existing port who use the<br>
>> fixed_ip.<br>
>><br>
>>   if there are existing port and device_id is None<br>
>>       use the port_id.<br>
>><br>
>>   if there are no existing port.<br>
>>        create new port with the fixed_ip<br>
>><br>
>> This approach needs no client side change.<br>
>><br>
>> Thank you in advance<br>
>> Nachi Ueno<br>
>><br>
>> --<br>
>> Mailing list: <a href="https://launchpad.net/~netstack" target="_blank">https://launchpad.net/~netstack</a><br>
>> Post to     : <a href="mailto:netstack@lists.launchpad.net">netstack@lists.launchpad.net</a><br>
>> Unsubscribe : <a href="https://launchpad.net/~netstack" target="_blank">https://launchpad.net/~netstack</a><br>
>> More help   : <a href="https://help.launchpad.net/ListHelp" target="_blank">https://help.launchpad.net/ListHelp</a><br>
>><br>
>--<br>
>Nachi Ueno<br>
><a href="mailto:email%3Anati.ueno@gmail.com">email:nati.ueno@gmail.com</a><br>
>twitter:<a href="http://twitter.com/nati" target="_blank">http://twitter.com/nati</a><br>
<br>
_______________________________________________<br>
Mailing list: <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
Post to     : <a href="mailto:openstack@lists.launchpad.net">openstack@lists.launchpad.net</a><br>
Unsubscribe : <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
More help   : <a href="https://help.launchpad.net/ListHelp" target="_blank">https://help.launchpad.net/ListHelp</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>Dan Wendlandt <div>Nicira, Inc: <a href="http://www.nicira.com" target="_blank">www.nicira.com</a><br><div>twitter: danwendlandt<br>

~~~~~~~~~~~~~~~~~~~~~~~~~~~<br></div></div><br>