ovs-dev.py: run operational commands as root
authorAndy Zhou <azhou@nicira.com>
Fri, 11 Sep 2015 23:06:50 +0000 (16:06 -0700)
committerAndy Zhou <azhou@nicira.com>
Thu, 1 Oct 2015 03:43:53 +0000 (20:43 -0700)
commitc5c9cb9ef22464b6ff7d4085645d31d368c5be7a
tree916f3c07cd7e1a382a28f41e1f33269943c36ead
parent0c001985e2e6fcce7598c94394c2c070b4a6216f
ovs-dev.py: run operational commands as root

Switch operational commands, run, kill, reset and modinst directly
or indirectly read and writes files within the RUNDIR. Currently
these commands run in the current user context, with some "sudo"
commands thrown in to ensure daemons such as ovs-vswichd will be
launched as root.

This approach works fine as long as ovs-dev.py is always
run as root, (but then the 'sudo' commands added are redundant).
When invoking ovs-dev.py as non-root, files in RUNDIR will be mixed
with root created file and non-root created files, making it confusing
to decide whether to run ovs-appctl as root or not. Multiple
invocations of ovs-dev.py as root or non-root causes permission issues
since the same file created by a different user may no longer be
accessible when user changes.

This patch improves the situation by always run those four operational
commands as root. When they are invoked as non-root, "sudo" will be
used automatically by re-run the command with sudo.  VARDIR will now
always be access as root. The next patch will add --user and -u option
to allow for downgrading to running all daemons as non-root.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
utilities/ovs-dev.py