[ovs-dev] [PATCH] Supporting ovn-northd service HA depend on OVNDB-HA

Numan Siddique nusiddiq at redhat.com
Mon May 22 07:03:06 UTC 2017


On Fri, May 19, 2017 at 7:21 AM, 高正伟 <multi_task at 163.com> wrote:

> Thanks Numan
>
> I think that supporting  OVNDB and ovn-northd HA  depend on one pacemaker
> is an idea,   In case of thinking OVN-HA,  user will not individually care
> about OVNDB or ovn-northd HA.
>
>
Hi Zhangwei,

I do agree with you. But what I am trying to say is to make it configurable.

I tested with your patch again with tripleo and it is having few issues.
1. Since you are not passing "--ovn-manage-ovsdb=no", when "ovn-ctl
stop_northd" is called, it also stops ovsdb-servers. We probably don't want
to stop ovsdb-servers unless, pacemaker calls "stop" action.

2. When a master node is demoted, ovn-northd is not stopped since "ovn-ctl
stop_northd" code is not hit.

I tested with the below modifications and applying this patch -
https://patchwork.ozlabs.org/patch/765224/. It is working as expected. Can
you please test on your side and resubmit another version if it is fine
with you.

If the user wants to manage ovn_northd using the ocf resources, he could
pass manage_northd=yes while creating the resource.


-----------------------cut here -------------------------------------

diff --git a/ovn/utilities/ovndb-servers.ocf
b/ovn/utilities/ovndb-servers.ocf
index 40c5541..018d904 100755
--- a/ovn/utilities/ovndb-servers.ocf
+++ b/ovn/utilities/ovndb-servers.ocf
@@ -7,6 +7,7 @@
 : ${NB_MASTER_PROTO_DEFAULT="tcp"}
 : ${SB_MASTER_PORT_DEFAULT="6642"}
 : ${SB_MASTER_PROTO_DEFAULT="tcp"}
+: ${MANAGE_NORTHD_DEFAULT="no"}
 CRM_MASTER="${HA_SBIN_DIR}/crm_master -l reboot"
 CRM_ATTR_REPL_INFO="${HA_SBIN_DIR}/crm_attribute --type crm_config --name
OVN_REPL_INFO -s ovn_ovsdb_master_server"
 OVN_CTL=${OCF_RESKEY_ovn_ctl:-${OVN_CTL_DEFAULT}}
@@ -15,6 +16,7 @@
NB_MASTER_PORT=${OCF_RESKEY_nb_master_port:-${NB_MASTER_PORT_DEFAULT}}
 NB_MASTER_PROTO=${OCF_RESKEY_nb_master_protocol:-${NB_MASTER_PROTO_DEFAULT}}
 SB_MASTER_PORT=${OCF_RESKEY_sb_master_port:-${SB_MASTER_PORT_DEFAULT}}
 SB_MASTER_PROTO=${OCF_RESKEY_sb_master_protocol:-${SB_MASTER_PROTO_DEFAULT}}
+MANAGE_NORTHD=${OCF_RESKEY_manage_northd:-${MANAGE_NORTHD_DEFAULT}}

 # Invalid IP address is an address that can never exist in the network, as
 # mentioned in rfc-5737. The ovsdb servers connects to this IP address till
@@ -90,6 +92,14 @@ ovsdb_server_metadata() {
   <content type="string" />
   </parameter>

+  <parameter name="manage_northd" unique="1">
+  <longdesc lang="en">
+  If set to yes, manages ovn-northd service. ovn-northd will be started in
+  the master node.
+  </longdesc>
+  <shortdesc lang="en">manage ovn-northd service</shortdesc>
+  <content type="string" />
+  </parameter>
   </parameters>

   <actions>
@@ -122,12 +132,17 @@ ovsdb_server_notify() {
         # the right thing at startup
         ocf_log debug "ovndb_server: $host_name is the master"
         ${CRM_ATTR_REPL_INFO} -v "$host_name"
-        # Startup ovn-northd service
-        ${OVN_CTL} start_northd
+        if [ "$MANAGE_NORTHD" = "yes" ]; then
+            # Startup ovn-northd service
+            ${OVN_CTL} --ovn-manage-ovsdb=no start_northd
+        fi

     else
-        # Stop ovn-northd service
-        ${OVN_CTL} stop_northd
+        if [ "$MANAGE_NORTHD" = "yes" ]; then
+            # Stop ovn-northd service. Set --ovn-manage-ovsdb=no so that
+            # ovn-ctl doesn't stop ovsdb-servers.
+            ${OVN_CTL} --ovn-manage-ovsdb=no stop_northd
+        fi
         # Synchronize with the new master
         ocf_log debug "ovndb_server: Connecting to the new master
${OCF_RESKEY_CRM_meta_notify_promote_uname}"
         ${OVN_CTL} demote_ovnnb --db-nb-sync-from-addr=${MASTER_IP} \
@@ -289,6 +304,13 @@ ovsdb_server_start() {
 }

 ovsdb_server_stop() {
+    if [ "$MANAGE_NORTHD" = "yes" ]; then
+        # Stop ovn-northd service in case it was running. This is required
+        # when the master is demoted. For other cases, it would be a no-op.
+        # Set --ovn-manage-ovsdb=no so that ovn-ctl doesn't stop
ovsdb-servers.
+        ${OVN_CTL} --ovn-manage-ovsdb=no stop_northd
+    fi
+
     ovsdb_server_check_status
     case $? in
         $OCF_NOT_RUNNING)    return ${OCF_SUCCESS};;

--------------------------------------------------------------------------


Thanks
Numan





> Thanks.
>
>
> 在 2017-05-18 20:53:22,"Numan Siddique" <nusiddiq at redhat.com> 写道:
>
>
>
> On Wed, May 17, 2017 at 9:15 PM, Ben Pfaff <blp at ovn.org> wrote:
>
>> From: Zhengwei Gao <multi_task at 163.com>
>>
>> As ovn-northd servcie  parse network element between ovnnb_db and
>> ovnsb_db, it ensures ovn-northd service connecting to ovnnb_db and
>> ovnsb_db. OVNDB-HA was supported with pacemaker, ovn-northd service
>> will be failover fllowing OVNDB-HA.
>> ---
>> This was posted as a github pull request:
>> https://github.com/openvswitch/ovs/pull/176
>>
>>  ovn/utilities/ovndb-servers.ocf | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/ovn/utilities/ovndb-servers.ocf
>> b/ovn/utilities/ovndb-servers.ocf
>> index 908cb3c17d84..40c55411e828 100755
>> --- a/ovn/utilities/ovndb-servers.ocf
>> +++ b/ovn/utilities/ovndb-servers.ocf
>> @@ -122,8 +122,12 @@ ovsdb_server_notify() {
>>          # the right thing at startup
>>          ocf_log debug "ovndb_server: $host_name is the master"
>>          ${CRM_ATTR_REPL_INFO} -v "$host_name"
>> +        # Startup ovn-northd service
>> +        ${OVN_CTL} start_northd
>>
>>      else
>> +        # Stop ovn-northd service
>> +        ${OVN_CTL} stop_northd
>>          # Synchronize with the new master
>>          ocf_log debug "ovndb_server: Connecting to the new master
>> ${OCF_RESKEY_CRM_meta_notify_promote_uname}"
>>          ${OVN_CTL} demote_ovnnb --db-nb-sync-from-addr=${MASTER_IP} \
>>
>
> I tried this patch and it works.
> In the case of OpenStack and Tripleo, puppet is used to create and manage
> the pacemaker resources for OVN [1] and it also starts ovn-northd as a
> pacemaker service with colocation constraint set to the virtual ip created
> for the OVN DB servers.
>
> I think it makes more sense to start ovn-northd based on a flag (like
> START_NORTHD) so that the user or the configuration systems can chose.
>
> Thanks
> Numan
>
>
>
> [1] - https://review.openstack.org/#/c/372274/10/manifests/profi
> le/pacemaker/ovn_northd.pp
>
>
>> --
>> 2.10.2
>>
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>>
>
>


More information about the dev mailing list