Discussion:
[ovs-discuss] how to use ovsdb-tool transact?
ychen
2014-09-01 12:16:49 UTC
Permalink
hi:
I want to find where is the bottle neck of adding lots of port, vsctl, ovsdb-server or vswitchd?
I noticed that every time i use vsctl, it will send monitor request to ovsdb-server to retrieve all the data.
so I want to just use ovsdb-tool, and what's the correct format of ovsdb-tool transact format ?
can you give me an example?
"ovs-vsctl add-port br0 p0 -- set interface type=internal" ?
"ovs-vsctl del-port p0" ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/discuss/attachments/20140901/64df68ac/attachment.html>
ychen
2014-09-02 12:27:07 UTC
Permalink
hi:
I want to find where is the bottle neck of adding lots of port, vsctl, ovsdb-server or vswitchd?
I noticed that every time i use vsctl, it will send monitor request to ovsdb-server to retrieve all the data.
so I want to just use ovsdb-tool, and what's the correct format of ovsdb-tool transact format ?
can you give me an example?
"ovs-vsctl add-port br0 p0 -- set interface type=internal" ?
"ovs-vsctl del-port p0" ?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/discuss/attachments/20140902/8bfd3a36/attachment.html>
Ben Pfaff
2014-09-02 18:03:32 UTC
Permalink
Post by ychen
I want to find where is the bottle neck of adding lots of port, vsctl, ovsdb-server or vswitchd?
I noticed that every time i use vsctl, it will send monitor request to ovsdb-server to retrieve all the data.
so I want to just use ovsdb-tool, and what's the correct format of ovsdb-tool transact format ?
can you give me an example?
"ovs-vsctl add-port br0 p0 -- set interface type=internal" ?
"ovs-vsctl del-port p0" ?
As documented in ovsdb-tool(1), the argument must be in the form
described in the OVSDB specification (RFC 7047).
Ben Pfaff
2014-09-03 15:23:40 UTC
Permalink
Please don't drop the mailing list.
I am still have serval problems about transact.
when I use the following format to add port p100,type=internal, system returns error
"ovsdb-client: invalid syntax for 'transact' (use --help for help)"
ovsdb-client transact {"method":"transact", "params":["Open_vSwitch",{"row":{"type":"internal"},"table":"Interface","uuid-name":"rowp100intf","op":"insert"},{"row":{"ports":["set",[["uuid","275537c3-b469-47d1-b3c0-10efd08cb193"],["named-uuid","rowp100port"]]]},"table":"Bridge","where":[["_uuid","==",["uuid","8f725ab8-c5f4-4077-a251-d866e7a448d9"]]],"op":"update"},{"row":{"name":"p100","interfaces":["named-uuid","rowp100intf"],"tag":100},"table":"Port","uuid-name":"rowp100port","op":"insert"}], "id":1}
It looks like you forgot to quote to protect the JSON content from the
shell.
Also, I have tried to substitute the outer {} to [], and "method:transact" to "method=transact", but system still reports error.
so what's the correct transact format?
As specified in RFC 7047.
I noticed that when add or delete one port, we should always update table Bridge. But the update operation needs the old value(exp: add port p100, there will be an operation update in bridge table, column ports). That's really complicated when I want to debug with tool ovsdb-tool or ovsdb-client.
I am considering why we can't just use operation like "add" or "remove" to add/delete one element of the ports column?(or other column which type is map or set)
Use "mutate"?
ychen
2014-09-05 05:55:08 UTC
Permalink
hi, Ben:
Thanks for your reply, it really works with the following command:
ovsdb-client transact "[\"Open_vSwitch\",{\"mutations\":[[\"ports\",\"delete\",[\"uuid\",\"508cd3d7-a29c-47c3-80df-cdff04228cf9\"]]], \"table\":\"Bridge\", \"where\":[[\"_uuid\",\"==\",[\"uuid\",\"a24d9a54-c30c-4224-906d-d0af73c53094\"]]], \"op\":\"mutate\"}]"


Then there is another question, how can I delete a port with its name? As you see, in the above command, I must use the "uuid" to delete port from bridge table. Is there a simple way to use "select" and "mutate" to delete port with name? like this:
ovsdb-client transact "["Open_vSwitch",{"mutations":[["ports","delete",["uuid","{"columns":["_uuid"],"table":"Port","where":[["name","==","p0"]],"op":"select"}"]]], "table":"Bridge", "where":[["_uuid","==",["uuid","a24d9a54-c30c-4224-906d-d0af73c53094"]]],
"op":"mutate"}]"
Post by Ben Pfaff
Please don't drop the mailing list.
I am still have serval problems about transact.
when I use the following format to add port p100,type=internal, system returns error
"ovsdb-client: invalid syntax for 'transact' (use --help for help)"
ovsdb-client transact {"method":"transact", "params":["Open_vSwitch",{"row":{"type":"internal"},"table":"Interface","uuid-name":"rowp100intf","op":"insert"},{"row":{"ports":["set",[["uuid","275537c3-b469-47d1-b3c0-10efd08cb193"],["named-uuid","rowp100port"]]]},"table":"Bridge","where":[["_uuid","==",["uuid","8f725ab8-c5f4-4077-a251-d866e7a448d9"]]],"op":"update"},{"row":{"name":"p100","interfaces":["named-uuid","rowp100intf"],"tag":100},"table":"Port","uuid-name":"rowp100port","op":"insert"}], "id":1}
It looks like you forgot to quote to protect the JSON content from the
shell.
Also, I have tried to substitute the outer {} to [], and "method:transact" to "method=transact", but system still reports error.
so what's the correct transact format?
As specified in RFC 7047.
I noticed that when add or delete one port, we should always update table Bridge. But the update operation needs the old value(exp: add port p100, there will be an operation update in bridge table, column ports). That's really complicated when I want to debug with tool ovsdb-tool or ovsdb-client.
I am considering why we can't just use operation like "add" or "remove" to add/delete one element of the ports column?(or other column which type is map or set)
Use "mutate"?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/discuss/attachments/20140905/700cc062/attachment.html>
Ben Pfaff
2014-09-08 17:58:29 UTC
Permalink
Post by ychen
ovsdb-client transact "["Open_vSwitch",{"mutations":[["ports","delete",["uuid","{"columns":["_uuid"],"table":"Port","where":[["name","==","p0"]],"op":"select"}"]]], "table":"Bridge", "where":[["_uuid","==",["uuid","a24d9a54-c30c-4224-906d-d0af73c53094"]]],
"op":"mutate"}]"
There may not be. OVSDB is not designed to be as general-purpose as,
say, SQL, in terms of the power of a transaction. It is designed for
clients to retrieve the information they need, then to make the
changes they want to make while checking prerequisites, as necessary,
to ensure that the transaction is atomic.

Loading...