[ovs-dev] [PATCH 7/8] ovs-dev.py: add --user and -u option

Joe Stringer joestringer at nicira.com
Thu Oct 1 01:56:15 UTC 2015


On 30 September 2015 at 18:53, Andy Zhou <azhou at nicira.com> wrote:
> As discussed off-line, I decided to drop the "-u" option.  Now the
> patch is simpler.
>
> index fab3813..04415f9 100755
> --- a/utilities/ovs-dev.py
> +++ b/utilities/ovs-dev.py
> @@ -232,6 +232,13 @@ def run():
>
>      opts = ["--pidfile", "--log-file"]
>
> +    if (options.user == "") or (options.user == "root:root"):
> +        _sh("chown", "root:root", "-R", RUNDIR)
> +        sys.argv.remove("--user")
> +    else:
> +        _sh("chown", options.user, "-R", RUNDIR);
> +        opts = ["--user", options.user] + opts
> +
>      _sh(*(["ovsdb-server",
>             "--remote=punix:%s/run/db.sock" % RUNDIR,
>             "--remote=db:Open_vSwitch,Open_vSwitch,manager_options",
> @@ -316,7 +323,7 @@ Basic Configuration:
>
>      # First install the basic requirements needed to build Open vSwitch.
>      sudo apt-get install git build-essential libtool autoconf pkg-config \\
> -            libssl-dev gdb linux-headers-`uname -r`
> +            libssl-dev gdb libcap-ng linux-headers-`uname -r`
>
>      # Next clone the Open vSwitch source.
>      git clone https://github.com/openvswitch/ovs.git %(ovs)s
> @@ -415,6 +422,8 @@ def main():
>                       help="run ovs-vswitchd with dpdk subopts (ended by --)")
>      group.add_option("--clang", dest="clang", action="store_true",
>                       help="Use binaries built by clang")
> +    group.add_option("--user", dest="user", action="store", default="",
> +                     help="run all daemons as a non root user")
>
>      parser.add_option_group(group)
>

Looks good to me. I assume you've tested it.

Acked-by: Joe Stringer <joestringer at nicira.com>


More information about the dev mailing list