[ovs-dev] [rhel --user 5/7] ovn: add --user option to ovn-ctl.

Andy Zhou azhou at ovn.org
Thu Nov 19 20:58:40 UTC 2015


ovs-ctl now takes --user option to start OVS daemons under the user
specified. This is a similar change in OVN to launch OVN daemons
under the specified user.

Signed-off-by: Andy Zhou <azhou at ovn.org>
---
 ovn/utilities/ovn-ctl       | 6 ++++++
 ovn/utilities/ovn-ctl.8.xml | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl
index 3e2ccf9..b49f37d 100755
--- a/ovn/utilities/ovn-ctl
+++ b/ovn/utilities/ovn-ctl
@@ -108,6 +108,8 @@ set_defaults () {
 
     OVS_RUNDIR=${OVS_RUNDIR:-${rundir}}
     OVN_RUNDIR=${OVN_RUNDIR:-${OVS_RUNDIR}}
+
+    USER="root:root"
 }
 
 set_option () {
@@ -145,6 +147,7 @@ Options:
   --ovn-northd-wrapper=WRAPPER   run with a wrapper like valgrind for debugging
   --ovn-controller-priority=NICE     set ovn-northd's niceness (default: $OVN_CONTROLLER_PRIORITY)
   --ovn-controller-wrapper=WRAPPER   run with a wrapper like valgrind for debugging
+  --user=USER                    run as 'USER' (default: root:root)
   -h, --help                     display this help message
 
 File location options:
@@ -206,6 +209,9 @@ do
             ;;
     esac
 done
+
+set_ovs_user_group $USER
+
 case $command in
     start_northd)
         start_northd
diff --git a/ovn/utilities/ovn-ctl.8.xml b/ovn/utilities/ovn-ctl.8.xml
index 89ad934..ced6384 100644
--- a/ovn/utilities/ovn-ctl.8.xml
+++ b/ovn/utilities/ovn-ctl.8.xml
@@ -26,6 +26,7 @@
     <p><code>--ovn-northd-wrapper=<var>WRAPPER</var></code></p>
     <p><code>--ovn-controller-priority=<var>NICE</var></code></p>
     <p><code>--ovn-controller-wrapper=<var>WRAPPER</var></code></p>
+    <p><code>--user=<var>USER</var></code></p>
     <p><code>-h</code> | <code>--help</code></p>
 
     <h1>File location options</h1>
@@ -47,4 +48,7 @@
     <p><code># ovn-ctl start_northd</code></p>
     <p><code># ovn-ctl start_controller</code></p>
 
+    <h2>Run as the ovs user</h2>
+    <p><code># ovn-ctl --user=ovs:ovs start_controller</code></p>
+
 </manpage>
-- 
1.8.3.1




More information about the dev mailing list