From patchwork Wed Nov 23 20:01:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell Bryant X-Patchwork-Id: 698520 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tPCsb4dp8z9t2F for ; Thu, 24 Nov 2016 07:01:55 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id EDE84B66; Wed, 23 Nov 2016 20:01:31 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id C9C84B3F for ; Wed, 23 Nov 2016 20:01:30 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 4E8AD148 for ; Wed, 23 Nov 2016 20:01:30 +0000 (UTC) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CEC073B3E7; Wed, 23 Nov 2016 20:01:29 +0000 (UTC) Received: from t460s.redhat.com (ovpn-112-70.phx2.redhat.com [10.3.112.70]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uANK1PXo015264; Wed, 23 Nov 2016 15:01:28 -0500 From: Russell Bryant To: dev@openvswitch.org Date: Wed, 23 Nov 2016 15:01:24 -0500 Message-Id: <20161123200124.17829-2-russell@ovn.org> In-Reply-To: <20161123200124.17829-1-russell@ovn.org> References: <20161123200124.17829-1-russell@ovn.org> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 23 Nov 2016 20:01:29 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v2 2/2] rhel: Add EnvironmentFile for ovn services. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org A previous commit documented how you do this using systemd native interfaces for customizing services. However, it seems that some people still would rather see environment variables specified through an old-style sysconfig file. It seems harmless enough to provide, so this patch adds it. The "-" prefix to the filename means that systemd will ignore this setting if the file does not exist and will not report any error. Signed-off-by: Russell Bryant Acked-by: Simon Horman --- rhel/usr_lib_systemd_system_ovn-controller-vtep.service | 10 ++++++++-- rhel/usr_lib_systemd_system_ovn-controller.service | 9 +++++++-- rhel/usr_lib_systemd_system_ovn-northd.service | 9 +++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) v1->v2: - s/ovn-controller/ovn-northd/ in a comment to fix a copy/paste mistake diff --git a/rhel/usr_lib_systemd_system_ovn-controller-vtep.service b/rhel/usr_lib_systemd_system_ovn-controller-vtep.service index 26d4d9a..cc201b4 100644 --- a/rhel/usr_lib_systemd_system_ovn-controller-vtep.service +++ b/rhel/usr_lib_systemd_system_ovn-controller-vtep.service @@ -18,8 +18,13 @@ # you could place the following contents in # /etc/systemd/system/ovn-controller-vtep.d/local.conf: # -# [System] -# Environment="OVN_DB=unix:/usr/local/var/run/openvswitch/db.sock" "VTEP_DB=unix:/usr/local/var/run/openvswitch/vtep.sock" +# [System] +# Environment="OVN_DB=unix:/usr/local/var/run/openvswitch/db.sock" "VTEP_DB=unix:/usr/local/var/run/openvswitch/vtep.sock" +# +# Alternatively, you may specify environment variables in the file /etc/sysconfig/ovn-controller-vtep: +# +# OVN_DB="unix:/usr/local/var/run/openvswitch/db.sock" +# VTEP_DB="unix:/usr/local/var/run/openvswitch/vtep.sock" [Unit] Description=OVN VTEP gateway controller daemon @@ -30,6 +35,7 @@ After=openvswitch.service [Service] Type=simple Environment=OVS_RUNDIR=%t/openvswitch OVN_DB=unix:%t/openvswitch/db.sock VTEP_DB=unix:%t/openvswitch/db.sock +EnvironmentFile=-/etc/sysconfig/ovn-controller-vtep ExecStart=/usr/bin/ovn-controller-vtep -vconsole:emer -vsyslog:err -vfile:info \ --log-file=/var/log/openvswitch/ovn-controller-vtep.log \ --no-chdir --pidfile=${OVS_RUNDIR}/ovn-controller-vtep.pid \ diff --git a/rhel/usr_lib_systemd_system_ovn-controller.service b/rhel/usr_lib_systemd_system_ovn-controller.service index 2ddcc1c..a21a7de 100644 --- a/rhel/usr_lib_systemd_system_ovn-controller.service +++ b/rhel/usr_lib_systemd_system_ovn-controller.service @@ -6,8 +6,12 @@ # could place the following contents in # /etc/systemd/system/ovn-controller.d/local.conf: # -# [System] -# Environment="OVN_CONTROLLER_OPTS=--ovn-controller-log=-vconsole:emer -vsyslog:err -vfile:info" +# [System] +# Environment="OVN_CONTROLLER_OPTS=--ovn-controller-log=-vconsole:emer -vsyslog:err -vfile:info" +# +# Alternatively, you may specify environment variables in the file /etc/sysconfig/ovn-controller: +# +# OVN_CONTROLLER_OPTS="--ovn-controller-log=-vconsole:emer -vsyslog:err -vfile:info" [Unit] Description=OVN controller daemon @@ -18,6 +22,7 @@ After=openvswitch.service [Service] Type=oneshot RemainAfterExit=yes +EnvironmentFile=-/etc/sysconfig/ovn-controller ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_controller $OVN_CONTROLLER_OPTS ExecStop=/usr/share/openvswitch/scripts/ovn-ctl stop_controller diff --git a/rhel/usr_lib_systemd_system_ovn-northd.service b/rhel/usr_lib_systemd_system_ovn-northd.service index d0045e3..3c44600 100644 --- a/rhel/usr_lib_systemd_system_ovn-northd.service +++ b/rhel/usr_lib_systemd_system_ovn-northd.service @@ -6,8 +6,12 @@ # could place the following contents in # /etc/systemd/system/ovn-northd.d/local.conf: # -# [System] -# Environment="OVN_NORTHD_OPTS=--db-nb-sock=/usr/local/var/run/openvswitch/ovnnb_db.sock --db-sb-sock=/usr/local/var/run/openvswitch/ovnsb_db.sock" +# [System] +# Environment="OVN_NORTHD_OPTS=--db-nb-sock=/usr/local/var/run/openvswitch/ovnnb_db.sock --db-sb-sock=/usr/local/var/run/openvswitch/ovnsb_db.sock" +# +# Alternatively, you may specify environment variables in the file /etc/sysconfig/ovn-northd: +# +# OVN_NORTHD_OPTS="--db-nb-sock=/usr/local/var/run/openvswitch/ovnnb_db.sock --db-sb-sock=/usr/local/var/run/openvswitch/ovnsb_db.sock" [Unit] Description=OVN northd management daemon @@ -19,6 +23,7 @@ After=openvswitch.service Type=oneshot RemainAfterExit=yes Environment=OVS_RUNDIR=%t/openvswitch OVS_DBDIR=/var/lib/openvswitch +EnvironmentFile=-/etc/sysconfig/ovn-northd ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_northd $OVN_NORTHD_OPTS ExecStop=/usr/share/openvswitch/scripts/ovn-ctl stop_northd