diff mbox

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

Message ID 1448019200-87207-4-git-send-email-azhou@ovn.org
State Changes Requested
Headers show

Commit Message

Andy Zhou Nov. 20, 2015, 11:33 a.m. UTC
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@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>

---
v1->v2: use USER[:GROUP] instead of USER in documentation.
---
 ovn/utilities/ovn-ctl       | 6 ++++++
 ovn/utilities/ovn-ctl.8.xml | 4 ++++
 2 files changed, 10 insertions(+)

Comments

Ben Pfaff Nov. 30, 2015, 1:30 a.m. UTC | #1
On Fri, Nov 20, 2015 at 03:33:17AM -0800, Andy Zhou wrote:
> 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@ovn.org>
> Acked-by: Ben Pfaff <blp@ovn.org>
> 
> ---
> v1->v2: use USER[:GROUP] instead of USER in documentation.

I think that this should say USER[:GROUP] also:

> --- a/ovn/utilities/ovn-ctl
> +++ b/ovn/utilities/ovn-ctl
> @@ -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
diff mbox

Patch

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..afceee9 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[:GROUP]</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 and group</h2>
+    <p><code># ovn-ctl --user=ovs:ovs start_controller</code></p>
+
 </manpage>