Message ID | 20200603124347.37761-1-michele@acksyn.org |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev,ovn,v2] Make the notify() calls work with IPv6 in the OCF resource-agent | expand |
On Wed, Jun 3, 2020 at 6:14 PM Michele Baldessari <michele@acksyn.org> wrote: > When the VIP is an IPv6 address we get the following error in the > resource agent: > ovndb_servers_notify_0:355:stderr [ + ovn-sbctl -- --id=@conn_uuid create > Connection 'target=ptcp\:6642\:[fd00:fd00:fd00:2000::a2]' > inactivity_probe=180000 -- set SB_Global . connections=@conn_uuid ] > ovndb_servers_notify_0:355:stderr [ ovn-sbctl: > ptcp\:6642\:[fd00:fd00:fd00:2000::a2]: unexpected "[" parsing string ] > > This is because MASTER_IP is an IPv6 address and is being passed to > ovn-[ns]bctl without being escaped and the command errors out with > unexpected parsing string errors. The rest of the create Connection > command was already escaping the columns, we are just missing the ip > address bits in case of IPv6. > > Let's make sure we escape the '[]:' characters and avoid this problem. > Tested this on an OpenStack environment on both IPv6 and IPv4. > > Signed-off-by: Michele Baldessari <michele@acksyn.org> > Thanks Michele for the fix. I applied this patch to master, branch-20.06 and branch-20.03. Thanks Numan > --- > utilities/ovndb-servers.ocf | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/utilities/ovndb-servers.ocf b/utilities/ovndb-servers.ocf > index 56c2bc3227c3..354818a78d4d 100755 > --- a/utilities/ovndb-servers.ocf > +++ b/utilities/ovndb-servers.ocf > @@ -249,7 +249,9 @@ ovsdb_server_notify() { > if [ "x${LISTEN_ON_MASTER_IP_ONLY}" = xno ]; then > LISTEN_ON_IP="0.0.0.0" > else > - LISTEN_ON_IP=${MASTER_IP} > + # ovn-[sn]bctl want ':[]' characters to be escaped. We do so > in order > + # to make this work when MASTER_IP is an IPv6 address > + LISTEN_ON_IP=$(sed -e 's/\(\[\|\]\|:\)/\\\1/g' <<< > ${MASTER_IP}) > fi > conn=`ovn-nbctl get NB_global . connections` > if [ "$conn" == "[]" ] > -- > 2.26.2 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > >
Bleep bloop. Greetings Michele Baldessari, I am a robot and I have tried out your patch. Thanks for your contribution. I encountered some error that I wasn't expecting. See the details below. git-am: error: Failed to merge in the changes. hint: Use 'git am --show-current-patch' to see the failed patch Patch failed at 0001 Make the notify() calls work with IPv6 in the OCF resource-agent When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". Please check this out. If you feel there has been an error, please email aconole@redhat.com Thanks, 0-day Robot
diff --git a/utilities/ovndb-servers.ocf b/utilities/ovndb-servers.ocf index 56c2bc3227c3..354818a78d4d 100755 --- a/utilities/ovndb-servers.ocf +++ b/utilities/ovndb-servers.ocf @@ -249,7 +249,9 @@ ovsdb_server_notify() { if [ "x${LISTEN_ON_MASTER_IP_ONLY}" = xno ]; then LISTEN_ON_IP="0.0.0.0" else - LISTEN_ON_IP=${MASTER_IP} + # ovn-[sn]bctl want ':[]' characters to be escaped. We do so in order + # to make this work when MASTER_IP is an IPv6 address + LISTEN_ON_IP=$(sed -e 's/\(\[\|\]\|:\)/\\\1/g' <<< ${MASTER_IP}) fi conn=`ovn-nbctl get NB_global . connections` if [ "$conn" == "[]" ]
When the VIP is an IPv6 address we get the following error in the resource agent: ovndb_servers_notify_0:355:stderr [ + ovn-sbctl -- --id=@conn_uuid create Connection 'target=ptcp\:6642\:[fd00:fd00:fd00:2000::a2]' inactivity_probe=180000 -- set SB_Global . connections=@conn_uuid ] ovndb_servers_notify_0:355:stderr [ ovn-sbctl: ptcp\:6642\:[fd00:fd00:fd00:2000::a2]: unexpected "[" parsing string ] This is because MASTER_IP is an IPv6 address and is being passed to ovn-[ns]bctl without being escaped and the command errors out with unexpected parsing string errors. The rest of the create Connection command was already escaping the columns, we are just missing the ip address bits in case of IPv6. Let's make sure we escape the '[]:' characters and avoid this problem. Tested this on an OpenStack environment on both IPv6 and IPv4. Signed-off-by: Michele Baldessari <michele@acksyn.org> --- utilities/ovndb-servers.ocf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)