[openstack-dev] 答复: [quantum][LBaas] Add members to the pool
Leon Cui
lcui at vmware.com
Tue Nov 20 03:03:56 UTC 2012
Hi Youcef,
Thanks for the clarification! It makes more sense to me now.
As you mentioned, a member should already have been created before create
the pool. The last question in my mind is that as per the API spec, when
create a member, the pool_id is a mandatory attribute, where in this
sample, the pool_id is unknown yet. This sounds like a “egg or chicken
came first” questionJ
Shall we make the pool_id of a member as an optional attribute?
Thanks
Leon
发件人: Youcef Laribi [mailto:Youcef.Laribi at eu.citrix.com]
发送时间: 2012年11月20日 10:53
收件人: Leon Cui
抄送: openstack-dev at lists.openstack.org
主题: RE: [quantum][LBaas] Add members to the pool
Hi Leon,
Let me clarify one thing. User doesn’t have to provide members when she
creates the pool, it is an optional attribute. User can create it an empty
pool and then add members to it later.
But if user wants to create the pool *and* populate it with members at the
same time, then this is possible by providing the “members” attribute
when creating a pool. In this case, the members should already have been
created (see “create member” section) because user will be using their
IDs to populate the pool.
So, if you are implementing this API, you should consider 2 use cases:
1. Whether user has provided a members attribute in the request or
not. If she hasn’t, you create an empty pool (user can add members to it
later).
2. If user specified the members attribute, then you:
a. Create the pool in the DB first and get the pool ID
b. For each member ID in the members attribute, update that member in
the DB by updating its “pool_id” attribute from step a.
We can always remove the option of “creating a pool and populating it at
the same time” to simplify implementation.
Thanks
Youcef
From: Leon Cui [mailto:lcui at vmware.com]
Sent: Monday, November 19, 2012 6:27 PM
To: Youcef Laribi
Cc: openstack-dev at lists.openstack.org
Subject: 答复: [quantum][LBaas] Add members to the pool
Hi Youcef,
The problem is “create the member rows” in this call (create a pool)
will insert new members which has only <member_id, pool_id> attributes.
The other mandatory attributes for the member, such as address and port,
are basically None at the end of this call. Do you mean that user has to
update those members by providing those attributes later?
In addition, how do you know the member id (which I suppose it’s
auto-generated) in this call before create the member?
Thanks
Leon
发件人: Youcef Laribi [mailto:Youcef.Laribi at eu.citrix.com]
发送时间: 2012年11月20日 2:51
收件人: Leon Cui
抄送: openstack-dev at lists.openstack.org
主题: RE: [quantum][LBaas] Add members to the pool
Hi Leon,
You don’t have to map the API operations one-to-one to SQLAlchemy
operations. For this call (create a pool), you can in SQLAlchemy first
create the “pool” row in a pool table, then create the members rows in
the member table (and set their pool_id to the pool you created).
If you are worried about updating the DB transactionally, then you can
start a transaction before updating both tables and commit it only when
both tables have been updated successfully. There will be a lot of
operations in the API that will require updating more than one table in
the DB, so we have to support transactions anyway.
Thanks
Youcef
From: Leon Cui [mailto:lcui at vmware.com]
Sent: Monday, November 19, 2012 2:34 AM
To: Youcef Laribi
Cc: openstack-dev at lists.openstack.org
Subject: [quantum][LBaas] Add members to the pool
Hi Youcef,
While I’m coding on SQLAlchemy data model for pool, I found that there is
no way to create a pool and specifying its members in a single rest call.
The members will only be added to a pool by using member creation/update
methods.
Therefore, the sample given in API spec in “Creating a pool” should be
corrected as below, where “members” is removed.
POST /v1.0/pools
Host: lbaas-service.cloudX.com:8651
Accept: application/json
Content-Type: application/json
X-Auth-Token:887665443383838
Content-Length: 194
{
"pool" : {
"name": "web_pool",
"vip_id": "db902c0c-d5ff-4753-b465-668ad9656918",
"protocol": "HTTP",
"network_id" : "e2a7a228-8fd1-4aa8-8d0c-4023a68e1c92",
}
What do you think? Correct me if I’m wrong.
Thanks
Leon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20121119/66486251/attachment.html>
More information about the OpenStack-dev
mailing list