{"id":809039,"url":"http://patchwork.ozlabs.org/api/patches/809039/?format=json","web_url":"http://patchwork.ozlabs.org/project/openvswitch/patch/20170902011410.25228-2-russell@ovn.org/","project":{"id":47,"url":"http://patchwork.ozlabs.org/api/projects/47/?format=json","name":"Open vSwitch","link_name":"openvswitch","list_id":"ovs-dev.openvswitch.org","list_email":"ovs-dev@openvswitch.org","web_url":"http://openvswitch.org/","scm_url":"git@github.com:openvswitch/ovs.git","webscm_url":"https://github.com/openvswitch/ovs","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170902011410.25228-2-russell@ovn.org>","list_archive_url":null,"date":"2017-09-02T01:14:10","name":"[ovs-dev,2/2] ovn: Support chassis hostname in requested-chassis.","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"e37a7a13ec29777b93436e641c9f47de13e8cfc6","submitter":{"id":67631,"url":"http://patchwork.ozlabs.org/api/people/67631/?format=json","name":"Russell Bryant","email":"russell@ovn.org"},"delegate":{"id":55721,"url":"http://patchwork.ozlabs.org/api/users/55721/?format=json","username":"russellb","first_name":"Russell","last_name":"Bryant","email":"rbryant@redhat.com"},"mbox":"http://patchwork.ozlabs.org/project/openvswitch/patch/20170902011410.25228-2-russell@ovn.org/mbox/","series":[{"id":1135,"url":"http://patchwork.ozlabs.org/api/series/1135/?format=json","web_url":"http://patchwork.ozlabs.org/project/openvswitch/list/?series=1135","date":"2017-09-02T01:14:09","name":"[ovs-dev,1/2] .gitignore: Ignore generated file cxxtest.cc.","version":1,"mbox":"http://patchwork.ozlabs.org/series/1135/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/809039/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809039/checks/","tags":{},"related":[],"headers":{"Return-Path":"<ovs-dev-bounces@openvswitch.org>","X-Original-To":["incoming@patchwork.ozlabs.org","dev@openvswitch.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","ovs-dev@mail.linuxfoundation.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)","ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=ovn.org","ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=russell@ovn.org"],"Received":["from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkdTW4xlkz9sNr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  2 Sep 2017 11:15:43 +1000 (AEST)","from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 57ACBD3D;\n\tSat,  2 Sep 2017 01:15:14 +0000 (UTC)","from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id 31D58D32\n\tfor <dev@openvswitch.org>; Sat,  2 Sep 2017 01:15:13 +0000 (UTC)","from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id 570E0F8\n\tfor <dev@openvswitch.org>; Sat,  2 Sep 2017 01:15:12 +0000 (UTC)","from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id BD2C27E447;\n\tSat,  2 Sep 2017 01:15:11 +0000 (UTC)","from t460s.redhat.com (ovpn-120-61.rdu2.redhat.com [10.10.120.61])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 46E445FCAB;\n\tSat,  2 Sep 2017 01:15:11 +0000 (UTC)"],"X-Greylist":["from auto-whitelisted by SQLgrey-1.7.6","Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.27]);\n\tSat, 02 Sep 2017 01:15:11 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com BD2C27E447","DKIM-Filter":"OpenDKIM Filter v2.11.0 mx1.redhat.com BD2C27E447","From":"Russell Bryant <russell@ovn.org>","To":"dev@openvswitch.org","Date":"Fri,  1 Sep 2017 21:14:10 -0400","Message-Id":"<20170902011410.25228-2-russell@ovn.org>","In-Reply-To":"<20170902011410.25228-1-russell@ovn.org>","References":"<20170902011410.25228-1-russell@ovn.org>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.12","X-Spam-Status":"No, score=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI\n\tautolearn=disabled version=3.3.1","X-Spam-Checker-Version":"SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org","Subject":"[ovs-dev] [PATCH 2/2] ovn: Support chassis hostname in\n\trequested-chassis.","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.12","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>","List-Archive":"<http://mail.openvswitch.org/pipermail/ovs-dev/>","List-Post":"<mailto:ovs-dev@openvswitch.org>","List-Help":"<mailto:ovs-dev-request@openvswitch.org?subject=help>","List-Subscribe":"<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"ovs-dev-bounces@openvswitch.org","Errors-To":"ovs-dev-bounces@openvswitch.org"},"content":"Previously, OVN expected the Chassis \"name\" in the \"requested-chassis\"\noption for a Logical_Switch_Port.  It turns out that in the two OVN\nintegrations I've checked with that plan to use this option,\nspecifying the Chassis \"hostname\" is much more convenient.  This patch\nextends the \"requested-chassis\" option to support both the Chassis\nname or the hostname as a value.\n\nSigned-off-by: Russell Bryant <russell@ovn.org>\n---\n ovn/controller/binding.c |  5 +++--\n ovn/ovn-nb.xml           | 11 ++++++-----\n ovn/ovn-sb.xml           | 11 ++++++-----\n tests/ovn.at             | 33 +++++++++++++++++++++++++++++++++\n 4 files changed, 48 insertions(+), 12 deletions(-)","diff":"diff --git a/ovn/controller/binding.c b/ovn/controller/binding.c\nindex 6a56e26ca..ca1d43395 100644\n--- a/ovn/controller/binding.c\n+++ b/ovn/controller/binding.c\n@@ -442,8 +442,9 @@ consider_local_datapath(struct controller_ctx *ctx,\n     if (ctx->ovnsb_idl_txn) {\n         const char *vif_chassis = smap_get(&binding_rec->options,\n                                            \"requested-chassis\");\n-        bool can_bind = !vif_chassis || !vif_chassis[0] ||\n-                        !strcmp(vif_chassis, chassis_rec->name);\n+        bool can_bind = !vif_chassis || !vif_chassis[0]\n+                        || !strcmp(vif_chassis, chassis_rec->name)\n+                        || !strcmp(vif_chassis, chassis_rec->hostname);\n \n         if (can_bind && our_chassis) {\n             if (binding_rec->chassis != chassis_rec) {\ndiff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml\nindex be72610c0..9869d7ed7 100644\n--- a/ovn/ovn-nb.xml\n+++ b/ovn/ovn-nb.xml\n@@ -436,11 +436,12 @@\n         </p>\n \n         <column name=\"options\" key=\"requested-chassis\">\n-          If set, identifies a specific chassis (by name) that is allowed to\n-          bind this port. Using this option will prevent thrashing between\n-          two chassis trying to bind the same port during a live migration.\n-          It can also prevent similar thrashing due to a mis-configuration,\n-          if a port is accidentally created on more than one chassis.\n+          If set, identifies a specific chassis (by name or hostname) that\n+          is allowed to bind this port. Using this option will prevent\n+          thrashing between two chassis trying to bind the same port during\n+          a live migration. It can also prevent similar thrashing due to a\n+          mis-configuration, if a port is accidentally created on more than\n+          one chassis.\n         </column>\n \n         <column name=\"options\" key=\"qos_max_rate\">\ndiff --git a/ovn/ovn-sb.xml b/ovn/ovn-sb.xml\nindex 7098194c6..0a894f8cb 100644\n--- a/ovn/ovn-sb.xml\n+++ b/ovn/ovn-sb.xml\n@@ -2160,11 +2160,12 @@ tcp.flags = RST;\n       </p>\n \n       <column name=\"options\" key=\"requested-chassis\">\n-        If set, identifies a specific chassis (by name) that is allowed to\n-        bind this port. Using this option will prevent thrashing between\n-        two chassis trying to bind the same port during a live migration.\n-        It can also prevent similar thrashing due to a mis-configuration,\n-        if a port is accidentally created on more than one chassis.\n+        If set, identifies a specific chassis (by name or hostname) that\n+        is allowed to bind this port. Using this option will prevent\n+        thrashing between two chassis trying to bind the same port during\n+        a live migration. It can also prevent similar thrashing due to a\n+        mis-configuration, if a port is accidentally created on more than\n+        one chassis.\n       </column>\n \n       <column name=\"options\" key=\"qos_max_rate\">\ndiff --git a/tests/ovn.at b/tests/ovn.at\nindex fb9fc7352..bb9999ce0 100644\n--- a/tests/ovn.at\n+++ b/tests/ovn.at\n@@ -8541,3 +8541,36 @@ OVS_WAIT_UNTIL([test $(ovn-sbctl --bare --columns chassis find port_binding logi\n OVN_CLEANUP([hv1],[hv2])\n \n AT_CLEANUP\n+\n+AT_SETUP([ovn -- options:requested-chassis with hostname])\n+\n+ovn_start\n+\n+ovn-nbctl ls-add ls0\n+ovn-nbctl lsp-add ls0 lsp0\n+\n+net_add n1\n+sim_add hv1\n+as hv1\n+ovs-vsctl add-br br-phys\n+ovn_attach n1 br-phys 192.168.0.11\n+ovs-vsctl -- add-port br-int hv1-vif0\n+\n+hv1_hostname=$(ovn-sbctl --bare --columns hostname find Chassis name=hv1)\n+echo \"hv1_hostname=${hv1_hostname}\"\n+ovn-nbctl --wait=hv --timeout=3 lsp-set-options lsp0 requested-chassis=${hv1_hostname}\n+as hv1 ovs-vsctl set interface hv1-vif0 external-ids:iface-id=lsp0\n+\n+hv1_uuid=$(ovn-sbctl --bare --columns _uuid find Chassis name=hv1)\n+echo \"hv1_uuid=${hv1_uuid}\"\n+OVS_WAIT_UNTIL([test 1 = $(grep -c \"Claiming lport lsp0\" hv1/ovn-controller.log)])\n+AT_CHECK([test x$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x\"$hv1_uuid\"], [0], [])\n+\n+ovn-nbctl --wait=hv --timeout=3 lsp-set-options lsp0 requested-chassis=non-existant-chassis\n+OVS_WAIT_UNTIL([test 1 = $(grep -c \"Releasing lport lsp0 from this chassis\" hv1/ovn-controller.log)])\n+ovn-nbctl --wait=hv --timeout=3 sync\n+AT_CHECK([test x$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x], [0], [])\n+\n+OVN_CLEANUP([hv1])\n+\n+AT_CLEANUP\n","prefixes":["ovs-dev","2/2"]}