← Back to team overview

openstack team mailing list archive

Re: [Quantum][Nova] requested_id and port spec

 

Hi Vish

Thanks. I got it.

2012/7/31 Vishvananda Ishaya <vishvananda@xxxxxxxxx>:
> For now it is fine to put it in the same place where network_id is specified. In the nova meeting on Thursday, we are going to discuss a better way to do extensions that need to do things based on additional post params.
>
> Vish
>
> On Jul 31, 2012, at 12:30 AM, Nati Ueno <Nati.Ueno@xxxxxxxxx> wrote:
>
>> Hi Dan
>>
>>>>> Matt
>>>> Thank you for your comment in launchpad
>>>> https://bugs.launchpad.net/nova/+bug/1031096
>>>>
>>>>
>>>> Quantum team get consensus in a Netstack meeting today to propose
>>>> port-id for requested networks. I took the job.
>>>> At first, i thought i can write extension for this. But as you say
>>>> we should add port-id for the core API which is only used for quantum API
>>>> 2.0.
>>>
>>>
>>> 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)?
>>
>> I can write extension implemented in core API code.
>> My understanding of definition of extension was "the code is in
>> extension directory".
>> However , the implementation for extensions are also in outside of
>> extension directory as you mentioned in bug report.
>> # I could see no clear policy for this.
>>
>> IMO, the key concept of extension is let users to select the function
>> to use. ( User can turn off the extension. )
>> So if we enable port_id when we use quantumV2 only, the concept will
>> be satisfied.
>>
>> Nachi
>>
>>> dan
>>>
>>>
>>>>
>>>> My WIP code is like [1]. This change keep backward compatibility.
>>>>
>>>>> Yong, Dan
>>>> Matt said "you'd be breaking API compatibility and thus the API spec."
>>>>
>>>> This work will change API, so some consensus in community is needed to
>>>> add port_id.
>>>> I wanna discuss about the spec in this thread.
>>>> If the community rejects this addition, I'll implement fixed_ip one
>>>> ( see previous my message )
>>>>
>>>> [1] WIP code for adding port_id ( Not tested)
>>>>
>>>> +    def _get_port(self, port_id):
>>>> +        if FLAGS.network_api_class !=
>>>> +        "nova.network.quantumv2.api.API":
>>>> +            msg = _("Unknown argment : port_id")
>>>> +            raise exc.HTTPBadRequest(explanation=msg)
>>>> +
>>>> +        if port_id and not utils.is_uuid_like(port_id):
>>>> +            msg = _("Bad port format: port uuid is "
>>>> +                    "not in proper format "
>>>> +                    "(%s)") % port_id
>>>> +            raise exc.HTTPBadRequest(explanation=msg)
>>>> +        try:
>>>> +            port =
>>>> quantumv2.get_client(context).list_networks(**search_opts)
>>>> +            if port.device_id:
>>>> +                raise Exception("Port id %s is already used" % port_id)
>>>> +            return port
>>>> +        except Exception as e:
>>>> +            msg = _("This port_id can't used "
>>>> +                    "(%s)") % port_id
>>>> +            raise exc.HTTPBadRequest(explanation=msg)
>>>> +
>>>>     def _get_requested_networks(self, requested_networks):
>>>>         """Create a list of requested networks from the networks
>>>> attribute."""
>>>>         networks = []
>>>>         for network in requested_networks:
>>>>             try:
>>>> +                port_id = network.get('port_id', None)
>>>> +                if port_id:
>>>> +                    port = self._get_port()
>>>> +                    network['uuid'] = port.network_id
>>>> +                    network['fixed_ip'] = port.fixed_ip
>>>> +
>>>>
>>>> Thank you in advance
>>>> Nachi Ueno
>>>>
>>>>>> Hi Nachi,
>>>>>> It is seemingly a way to make it work, but I think we are thinking to
>>>>>> provide 'port-id' or just 'port' to specify the top resource in quantum
>>>>>> API.
>>>>>> fix ip is not one.
>>>>>>
>>>>>> Besides, Port can be assigned to more than one fixed IP.
>>>>>
>>>>> Ah, It it true.
>>>>> OK I'll implement port id version.
>>>>>
>>>>>> Imagine in horizon, we created many networks, ports and subnets, but
>>>>>> when
>>>>>> booting a VM, we use a fixed_ip to specify our resource indirectly.
>>>>>
>>>>>> By the way, we should use openstack-dev@xxxxxxxxxxxxxxxxxx
>>>>>
>>>>> Sorry, I changed my mail address recently. But  launchpad rejects new
>>>>> mail to receive.
>>>>> I'll find way to fix this.
>>>>>
>>>>> Thanks
>>>>>
>>>>>
>>>>> Nachi
>>>>>
>>>>>> Thanks
>>>>>> Yong Sheng Gong
>>>>>>
>>>>>> -----netstack-bounces+gongysh=cn.ibm.com@xxxxxxxxxxxxxxxxxxx wrote:
>>>>>> -----
>>>>>> To: openstack@xxxxxxxxxxxxxxxxxxx, netstack@xxxxxxxxxxxxxxxxxxx
>>>>>> From: Nachi Ueno
>>>>>> Sent by: netstack-bounces+gongysh=cn.ibm.com@xxxxxxxxxxxxxxxxxxx
>>>>>> Date: 07/31/2012 08:33AM
>>>>>> Subject: [Netstack] [Quantum][Nova] requested_id and port spec
>>>>>>
>>>>>> Hi Dan,folks
>>>>>>
>>>>>> As we talked in netstack IRC meetins, I submit this as bug.
>>>>>> https://bugs.launchpad.net/nova/+bug/1031096
>>>>>>
>>>>>> I tried to write this, but  the code looks very ugly in order to keep
>>>>>> backward compatibility.
>>>>>> So I wanna propose an alternative design.
>>>>>> In this design, we will use fixed_ip as a temporary identifier of the
>>>>>> port.
>>>>>>
>>>>>> 1. create port
>>>>>>   fixed_ip assigned
>>>>>>
>>>>>> 2. specify  the fixed_ip in nova boot
>>>>>>
>>>>>> 3. If the fixed_ip is specified,
>>>>>>  nova.network.quantumv2.api.API will check existing port who use the
>>>>>> fixed_ip.
>>>>>>
>>>>>>  if there are existing port and device_id is None
>>>>>>      use the port_id.
>>>>>>
>>>>>>  if there are no existing port.
>>>>>>       create new port with the fixed_ip
>>>>>>
>>>>>> This approach needs no client side change.
>>>>>>
>>>>>> Thank you in advance
>>>>>> Nachi Ueno
>>>>>>
>>>>>> --
>>>>>> Mailing list: https://launchpad.net/~netstack
>>>>>> Post to     : netstack@xxxxxxxxxxxxxxxxxxx
>>>>>> Unsubscribe : https://launchpad.net/~netstack
>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>
>>>>> --
>>>>> Nachi Ueno
>>>>> email:nati.ueno@xxxxxxxxx
>>>>> twitter:http://twitter.com/nati
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~openstack
>>>> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~openstack
>>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>>
>>>
>>> --
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> Dan Wendlandt
>>> Nicira, Inc: www.nicira.com
>>> twitter: danwendlandt
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>
>>
>>
>>
>> --
>> Nachi Ueno
>> email:nati.ueno@xxxxxxxxx
>> twitter:http://twitter.com/nati
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~openstack
>> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~openstack
>> More help   : https://help.launchpad.net/ListHelp
>



-- 
Nachi Ueno
email:nati.ueno@xxxxxxxxx
twitter:http://twitter.com/nati


References