diff mbox

[ovs-dev,5/8] ovs-dev.py: rename ROOT to VARDIR

Message ID 1442969477-11026-5-git-send-email-azhou@nicira.com
State Accepted
Headers show

Commit Message

Andy Zhou Sept. 23, 2015, 12:51 a.m. UTC
VARDIR seems to be a better name.

Signed-off-by: Andy Zhou <azhou@nicira.com>
---
 utilities/ovs-dev.py | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

Comments

Joe Stringer Sept. 30, 2015, 11:54 p.m. UTC | #1
On 22 September 2015 at 17:51, Andy Zhou <azhou@nicira.com> wrote:
> VARDIR seems to be a better name.
>
> Signed-off-by: Andy Zhou <azhou@nicira.com>

Personally I thought RUNDIR was a better name, since that's where
we're running it (and we're also installing, whereas you don't usually
install into /var).... but I'm not going to hold out on this.

Note that some of the later patches still refer to RUNDIR, so please
pick one and make sure all the patches are consistent.

Acked-by: Joe Stringer <joestringer@nicira.com>
Andy Zhou Oct. 1, 2015, 4:01 a.m. UTC | #2
On Wed, Sep 30, 2015 at 4:54 PM, Joe Stringer <joestringer@nicira.com> wrote:
> On 22 September 2015 at 17:51, Andy Zhou <azhou@nicira.com> wrote:
>> VARDIR seems to be a better name.
>>
>> Signed-off-by: Andy Zhou <azhou@nicira.com>
>
> Personally I thought RUNDIR was a better name, since that's where
> we're running it (and we're also installing, whereas you don't usually
> install into /var).... but I'm not going to hold out on this.
>
> Note that some of the later patches still refer to RUNDIR, so please
> pick one and make sure all the patches are consistent.
>
> Acked-by: Joe Stringer <joestringer@nicira.com>
Thanks Joe for the review comments and discussion.

Talked with Ansis off-line. He now agrees that we should go back to
RUNDIR, as you suggested here.

Applied the reset of series to master.
diff mbox

Patch

diff --git a/utilities/ovs-dev.py b/utilities/ovs-dev.py
index 54989e6..82d946d 100755
--- a/utilities/ovs-dev.py
+++ b/utilities/ovs-dev.py
@@ -26,7 +26,7 @@  PWD = os.getcwd()
 OVS_SRC = HOME + "/ovs"
 if os.path.exists(PWD + "/WHY-OVS.md"):
     OVS_SRC = PWD  # Use current directory as OVS source tree
-ROOT = HOME + "/root"
+VARDIR = OVS_SRC + "/_var"
 BUILD_GCC = OVS_SRC + "/_build-gcc"
 BUILD_CLANG = OVS_SRC + "/_build-clang"
 
@@ -63,9 +63,11 @@  def conf():
     except OSError:
         pass
 
-    configure = ["../configure", "--prefix=" + ROOT, "--localstatedir=" + ROOT,
-                 "--with-logdir=%s/log" % ROOT, "--with-rundir=%s/run" % ROOT,
-                 "--enable-silent-rules", "--with-dbdir=" + ROOT, "--silent"]
+    configure = ["../configure",
+                 "--prefix=" + VARDIR, "--localstatedir=" + VARDIR,
+                 "--with-logdir=%s/log" % VARDIR,
+                 "--with-rundir=%s/run" % VARDIR,
+                 "--enable-silent-rules", "--with-dbdir=" + VARDIR, "--silent"]
 
     cflags = "-g -fno-omit-frame-pointer"
 
@@ -185,7 +187,7 @@  commands.append(tag)
 
 def kill():
     for proc in ["ovs-vswitchd", "ovsdb-server"]:
-        if os.path.exists("%s/run/openvswitch/%s.pid" % (ROOT, proc)):
+        if os.path.exists("%s/run/openvswitch/%s.pid" % (VARDIR, proc)):
             _sh("ovs-appctl", "-t", proc, "exit", check=False)
             time.sleep(.1)
         _sh("sudo", "killall", "-q", "-2", proc, check=False)
@@ -194,8 +196,8 @@  commands.append(kill)
 
 def reset():
     kill()
-    if os.path.exists(ROOT):
-        shutil.rmtree(ROOT)
+    if os.path.exists(VARDIR):
+        shutil.rmtree(VARDIR)
     for dp in _sh("ovs-dpctl dump-dps", capture=True):
         _sh("ovs-dpctl", "del-dp", dp.strip())
 commands.append(reset)
@@ -204,11 +206,11 @@  commands.append(reset)
 def run():
     kill()
     for d in ["log", "run"]:
-        d = "%s/%s" % (ROOT, d)
+        d = "%s/%s" % (VARDIR, d)
         shutil.rmtree(d, ignore_errors=True)
         os.makedirs(d)
 
-    pki_dir = ROOT + "/pki"
+    pki_dir = VARDIR + "/pki"
     if not os.path.exists(pki_dir):
         os.mkdir(pki_dir)
         os.chdir(pki_dir)
@@ -216,14 +218,14 @@  def run():
         _sh("ovs-pki req+sign ovsclient")
         os.chdir(OVS_SRC)
 
-    if not os.path.exists(ROOT + "/conf.db"):
-        _sh("ovsdb-tool", "create", ROOT + "/conf.db",
+    if not os.path.exists(VARDIR + "/conf.db"):
+        _sh("ovsdb-tool", "create", VARDIR + "/conf.db",
             OVS_SRC + "/vswitchd/vswitch.ovsschema")
 
     opts = ["--pidfile", "--log-file"]
 
     _sh(*(["ovsdb-server",
-           "--remote=punix:%s/run/db.sock" % ROOT,
+           "--remote=punix:%s/run/db.sock" % VARDIR,
            "--remote=db:Open_vSwitch,Open_vSwitch,manager_options",
            "--private-key=db:Open_vSwitch,SSL,private_key",
            "--certificate=db:Open_vSwitch,SSL,certificate",
@@ -339,7 +341,7 @@  Commands:
     modinst - Build ovs and install the kernel module.
     env     - Print the required path environment variable.
     doc     - Print this message.
-""" % {"ovs": OVS_SRC, "v": sys.argv[0], "run": ROOT}
+""" % {"ovs": OVS_SRC, "v": sys.argv[0], "run": VARDIR}
     sys.exit(0)
 commands.append(doc)