~james-page/ubuntu/raring/openvswitch/lts-raring-backport-dkms

« back to all changes in this revision

Viewing changes to debian/patches/bug-681880-3-Make-the-location-of-the-database-separately-configu.patch

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-08-07 16:00:53 UTC
  • mfrom: (5.1.25 sid)
  • Revision ID: package-import@ubuntu.com-20120807160053-nj4pgmkn6bp8t4md
Tags: 1.4.2+git20120612-9ubuntu1
* Merge from Debian unstable; remaining changes:
  - d/control: Disable openvswitch-datapath-dkms package.
* Dropped changes:
  - d/patches/kernel_3.5_support.patch: Superceded by 
    bug-684057-ovs-ctl-Add-support-for-newer-module-name.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From f973f2af2fd4452c8e182caf6a4346cf2a2a394e Mon Sep 17 00:00:00 2001
 
2
From: Ben Pfaff <blp@nicira.com>
 
3
Date: Fri, 27 Jul 2012 15:52:21 -0700
 
4
Subject: [PATCH 1/7] Make the location of the database separately configurable.
 
5
 
 
6
The default is unchanged, /etc/openvswitch/conf.db.
 
7
 
 
8
This makes it possible to transition each Open vSwitch packaging from
 
9
/etc/openvswitch/conf.db to /var/lib/openvswitch/conf.db independently.
 
10
 
 
11
Signed-off-by: Ben Pfaff <blp@nicira.com>
 
12
---
 
13
 Makefile.am                                           |    1 +
 
14
 configure.ac                                          |    1 +
 
15
 lib/automake.mk                                       |    2 ++
 
16
 lib/dirs.c.in                                         |    7 +++++++
 
17
 lib/dirs.h                                            |    1 +
 
18
 m4/openvswitch.m4                                     |   10 ++++++++++
 
19
 ovsdb/ovsdb-server.1.in                               |    2 +-
 
20
 ovsdb/ovsdb-server.c                                  |    2 +-
 
21
 python/automake.mk                                    |    1 +
 
22
 python/ovs/dirs.py                                    |    1 +
 
23
 tests/ofproto-macros.at                               |    3 ++-
 
24
 tests/ovs-monitor-ipsec.at                            |    1 +
 
25
 tests/ovs-xapi-sync.at                                |    1 +
 
26
 utilities/bugtool/ovs-bugtool.in                      |    2 +-
 
27
 utilities/bugtool/plugins/system-logs/openvswitch.xml |    3 ++-
 
28
 utilities/ovs-ctl.8                                   |    3 ++-
 
29
 utilities/ovs-ctl.in                                  |    7 ++++---
 
30
 utilities/ovs-lib.in                                  |    2 ++
 
31
 18 files changed, 41 insertions(+), 9 deletions(-)
 
32
 
 
33
Index: b/Makefile.am
 
34
===================================================================
 
35
--- a/Makefile.am
 
36
+++ b/Makefile.am
 
37
@@ -96,6 +96,7 @@ SUFFIXES += .in
 
38
            sed \
 
39
                -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
 
40
                 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
 
41
+                -e 's,[@]DBDIR[@],$(DBDIR),g' \
 
42
                 -e 's,[@]PERL[@],$(PERL),g' \
 
43
                 -e 's,[@]PYTHON[@],$(PYTHON),g' \
 
44
                 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
 
45
Index: b/configure.ac
 
46
===================================================================
 
47
--- a/configure.ac
 
48
+++ b/configure.ac
 
49
@@ -61,6 +61,7 @@ AC_CHECK_HEADERS([mntent.h sys/statvfs.h
 
50
 
 
51
 OVS_CHECK_PKIDIR
 
52
 OVS_CHECK_RUNDIR
 
53
+OVS_CHECK_DBDIR
 
54
 OVS_CHECK_BACKTRACE
 
55
 OVS_CHECK_MALLOC_HOOKS
 
56
 OVS_CHECK_VALGRIND
 
57
Index: b/lib/automake.mk
 
58
===================================================================
 
59
--- a/lib/automake.mk
 
60
+++ b/lib/automake.mk
 
61
@@ -271,6 +271,7 @@ lib/dirs.c: lib/dirs.c.in Makefile
 
62
                -e 's,[@]srcdir[@],$(srcdir),g' \
 
63
                -e 's,[@]LOGDIR[@],"$(LOGDIR)",g' \
 
64
                -e 's,[@]RUNDIR[@],"$(RUNDIR)",g' \
 
65
+               -e 's,[@]DBDIR[@],"$(DBDIR)",g' \
 
66
                -e 's,[@]bindir[@],"$(bindir)",g' \
 
67
                -e 's,[@]sysconfdir[@],"$(sysconfdir)",g' \
 
68
                -e 's,[@]pkgdatadir[@],"$(pkgdatadir)",g') \
 
69
@@ -290,6 +291,7 @@ lib-install-data-local:
 
70
        $(MKDIR_P) $(DESTDIR)$(RUNDIR)
 
71
        $(MKDIR_P) $(DESTDIR)$(PKIDIR)
 
72
        $(MKDIR_P) $(DESTDIR)$(LOGDIR)
 
73
+       $(MKDIR_P) $(DESTDIR)$(DBDIR)
 
74
 
 
75
 if !USE_LINKER_SECTIONS
 
76
 # All distributed sources, with names adjust properly for referencing
 
77
Index: b/lib/dirs.c.in
 
78
===================================================================
 
79
--- a/lib/dirs.c.in
 
80
+++ b/lib/dirs.c.in
 
81
@@ -66,6 +66,13 @@ ovs_logdir(void)
 
82
 }
 
83
 
 
84
 const char *
 
85
+ovs_dbdir(void)
 
86
+{
 
87
+    static struct directory d = { NULL, @DBDIR@, "OVS_DBDIR" };
 
88
+    return get_dir(&d);
 
89
+}
 
90
+
 
91
+const char *
 
92
 ovs_bindir(void)
 
93
 {
 
94
     static struct directory d = { NULL, @bindir@, "OVS_BINDIR" };
 
95
Index: b/lib/dirs.h
 
96
===================================================================
 
97
--- a/lib/dirs.h
 
98
+++ b/lib/dirs.h
 
99
@@ -21,6 +21,7 @@ const char *ovs_sysconfdir(void); /* /us
 
100
 const char *ovs_pkgdatadir(void); /* /usr/local/share/openvswitch */
 
101
 const char *ovs_rundir(void);     /* /usr/local/var/run/openvswitch */
 
102
 const char *ovs_logdir(void);     /* /usr/local/var/log/openvswitch */
 
103
+const char *ovs_dbdir(void);      /* /usr/local/etc/openvswitch */
 
104
 const char *ovs_bindir(void);     /* /usr/local/bin */
 
105
 
 
106
 #endif /* dirs.h */
 
107
Index: b/m4/openvswitch.m4
 
108
===================================================================
 
109
--- a/m4/openvswitch.m4
 
110
+++ b/m4/openvswitch.m4
 
111
@@ -132,6 +132,16 @@ AC_DEFUN([OVS_CHECK_LOGDIR],
 
112
      [LOGDIR='${localstatedir}/log/${PACKAGE}'])
 
113
    AC_SUBST([LOGDIR])])
 
114
 
 
115
+dnl Checks for the directory in which to store the Open vSwitch database.
 
116
+AC_DEFUN([OVS_CHECK_DBDIR],
 
117
+  [AC_ARG_WITH(
 
118
+     [dbdir],
 
119
+     AC_HELP_STRING([--with-dbdir=DIR],
 
120
+                    [directory used for conf.db [[SYSCONFDIR/PACKAGE]]]),
 
121
+     [DBDIR=$withval],
 
122
+     [DBDIR='${sysconfdir}/${PACKAGE}'])
 
123
+   AC_SUBST([DBDIR])])
 
124
+
 
125
 dnl Defines HAVE_BACKTRACE if backtrace() is declared in <execinfo.h>
 
126
 dnl and exists in libc.
 
127
 AC_DEFUN([OVS_CHECK_BACKTRACE],
 
128
Index: b/ovsdb/ovsdb-server.1.in
 
129
===================================================================
 
130
--- a/ovsdb/ovsdb-server.1.in
 
131
+++ b/ovsdb/ovsdb-server.1.in
 
132
@@ -26,7 +26,7 @@ vSwitch database (OVSDB).  It supports J
 
133
 over active or passive TCP/IP or Unix domain sockets.
 
134
 .PP
 
135
 The OVSDB file may be specified on the command line as \fIdatabase\fR.
 
136
-The default is \fB@sysconfdir@/openvswitch/conf.db\fR.  The database
 
137
+The default is \fB@DBDIR@/conf.db\fR.  The database
 
138
 file must already have been created and initialized using, for
 
139
 example, \fBovsdb\-tool create\fR.
 
140
 .
 
141
Index: b/ovsdb/ovsdb-server.c
 
142
===================================================================
 
143
--- a/ovsdb/ovsdb-server.c
 
144
+++ b/ovsdb/ovsdb-server.c
 
145
@@ -748,7 +748,7 @@ parse_options(int argc, char *argv[], ch
 
146
 
 
147
     switch (argc) {
 
148
     case 0:
 
149
-        *file_namep = xasprintf("%s/openvswitch/conf.db", ovs_sysconfdir());
 
150
+        *file_namep = xasprintf("%s/conf.db", ovs_dbdir());
 
151
         break;
 
152
 
 
153
     case 1:
 
154
Index: b/python/automake.mk
 
155
===================================================================
 
156
--- a/python/automake.mk
 
157
+++ b/python/automake.mk
 
158
@@ -40,6 +40,7 @@ ovs-install-data-local:
 
159
         echo 'PKGDATADIR = os.environ.get("OVS_PKGDATADIR", """$(pkgdatadir)""")' && \
 
160
         echo 'RUNDIR = os.environ.get("OVS_RUNDIR", """@RUNDIR@""")' && \
 
161
         echo 'LOGDIR = os.environ.get("OVS_LOGDIR", """@LOGDIR@""")' && \
 
162
+        echo 'DBDIR = os.environ.get("OVS_DBDIR", """@DBDIR@""")' && \
 
163
         echo 'BINDIR = os.environ.get("OVS_BINDIR", """$(bindir)""")') \
 
164
                > python/ovs/dirs.py.tmp
 
165
        $(MKDIR_P) $(DESTDIR)$(pkgdatadir)/python/ovs
 
166
Index: b/python/ovs/dirs.py
 
167
===================================================================
 
168
--- a/python/ovs/dirs.py
 
169
+++ b/python/ovs/dirs.py
 
170
@@ -5,4 +5,5 @@ import os
 
171
 PKGDATADIR = os.environ.get("OVS_PKGDATADIR", "/usr/local/share/openvswitch")
 
172
 RUNDIR = os.environ.get("OVS_RUNDIR", "/var/run")
 
173
 LOGDIR = os.environ.get("OVS_LOGDIR", "/usr/local/var/log")
 
174
+LOGDIR = os.environ.get("OVS_DBDIR", "/usr/local/etc/openvswitch")
 
175
 BINDIR = os.environ.get("OVS_BINDIR", "/usr/local/bin")
 
176
Index: b/tests/ofproto-macros.at
 
177
===================================================================
 
178
--- a/tests/ofproto-macros.at
 
179
+++ b/tests/ofproto-macros.at
 
180
@@ -5,13 +5,14 @@ m4_define([TESTABLE_LOG], [-vPATTERN:ANY
 
181
 m4_define([OVS_VSWITCHD_START],
 
182
   [OVS_RUNDIR=$PWD; export OVS_RUNDIR
 
183
    OVS_LOGDIR=$PWD; export OVS_LOGDIR
 
184
+   OVS_DBDIR=`pwd`; export OVS_DBDIR
 
185
    OVS_SYSCONFDIR=$PWD; export OVS_SYSCONFDIR
 
186
    trap 'kill `cat ovsdb-server.pid ovs-vswitchd.pid`' 0
 
187
 
 
188
    dnl Create database.
 
189
    mkdir openvswitch
 
190
    touch openvswitch/.conf.db.~lock~
 
191
-   AT_CHECK([ovsdb-tool create openvswitch/conf.db $abs_top_srcdir/vswitchd/vswitch.ovsschema])
 
192
+   AT_CHECK([ovsdb-tool create conf.db $abs_top_srcdir/vswitchd/vswitch.ovsschema])
 
193
 
 
194
    dnl Start ovsdb-server.
 
195
    AT_CHECK([ovsdb-server --detach --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock], [0], [], [stderr])
 
196
Index: b/tests/ovs-monitor-ipsec.at
 
197
===================================================================
 
198
--- a/tests/ovs-monitor-ipsec.at
 
199
+++ b/tests/ovs-monitor-ipsec.at
 
200
@@ -3,6 +3,7 @@ AT_BANNER([ovs-monitor-ipsec])
 
201
 AT_SETUP([ovs-monitor-ipsec])
 
202
 AT_SKIP_IF([test $HAVE_PYTHON = no])
 
203
 
 
204
+OVS_DBDIR=`pwd`; export OVS_DBDIR
 
205
 OVS_PKGDATADIR=`pwd`; export OVS_PKGDATADIR
 
206
 cp "$top_srcdir/vswitchd/vswitch.ovsschema" .
 
207
 
 
208
Index: b/tests/ovs-xapi-sync.at
 
209
===================================================================
 
210
--- a/tests/ovs-xapi-sync.at
 
211
+++ b/tests/ovs-xapi-sync.at
 
212
@@ -8,6 +8,7 @@ cp "$top_srcdir/tests/MockXenAPI.py" Xen
 
213
 PYTHONPATH=`pwd`:$PYTHONPATH
 
214
 export PYTHONPATH
 
215
 
 
216
+OVS_DBDIR=`pwd`; export OVS_DBDIR
 
217
 OVS_PKGDATADIR=`pwd`; export OVS_PKGDATADIR
 
218
 cp "$top_srcdir/vswitchd/vswitch.ovsschema" .
 
219
 
 
220
Index: b/utilities/bugtool/ovs-bugtool.in
 
221
===================================================================
 
222
--- a/utilities/bugtool/ovs-bugtool.in
 
223
+++ b/utilities/bugtool/ovs-bugtool.in
 
224
@@ -115,7 +115,7 @@ OPENVSWITCH_LOG_DIR = '@LOGDIR@/'
 
225
 OPENVSWITCH_DEFAULT_SWITCH = '/etc/default/openvswitch-switch' # Debian
 
226
 OPENVSWITCH_SYSCONFIG_SWITCH = '/etc/sysconfig/openvswitch'    # RHEL
 
227
 OPENVSWITCH_DEFAULT_CONTROLLER = '/etc/default/openvswitch-controller'
 
228
-OPENVSWITCH_CONF_DB = '@sysconfdir@/openvswitch/conf.db'
 
229
+OPENVSWITCH_CONF_DB = '@DBDIR@/conf.db'
 
230
 OPENVSWITCH_VSWITCHD_PID = '@RUNDIR@/ovs-vswitchd.pid'
 
231
 COLLECTD_LOGS_DIR = '/var/lib/collectd/rrd'
 
232
 VAR_LOG_DIR = '/var/log/'
 
233
Index: b/utilities/bugtool/plugins/system-logs/openvswitch.xml
 
234
===================================================================
 
235
--- a/utilities/bugtool/plugins/system-logs/openvswitch.xml
 
236
+++ b/utilities/bugtool/plugins/system-logs/openvswitch.xml
 
237
@@ -13,9 +13,10 @@
 
238
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
 
239
  USA.
 
240
 
 
241
- Copyright (C) 2011 Nicira Networks.
 
242
+ Copyright (C) 2011, 2012 Nicira Networks.
 
243
 -->
 
244
 
 
245
 <collect>
 
246
   <directory label="ovsdb-backups" pattern=".*/conf.db.backup[0-9][^/]*$">/etc/openvswitch</directory>
 
247
+  <directory label="ovsdb-backups2" pattern=".*/conf.db.backup[0-9][^/]*$">/var/lib/openvswitch</directory>
 
248
 </collect>
 
249
Index: b/utilities/ovs-ctl.8
 
250
===================================================================
 
251
--- a/utilities/ovs-ctl.8
 
252
+++ b/utilities/ovs-ctl.8
 
253
@@ -361,6 +361,7 @@ that it runs.  \fBovs\-ctl\fR will add t
 
254
 .
 
255
 .IP "\fBOVS_LOGDIR\fR"
 
256
 .IQ "\fBOVS_RUNDIR\fR"
 
257
+.IQ "\fBOVS_DBDIR\fR"
 
258
 .IQ "\fBOVS_SYSCONFDIR\fR"
 
259
 .IQ "\fBOVS_PKGDATADIR\fR"
 
260
 .IQ "\fBOVS_BINDIR\fR"
 
261
@@ -388,7 +389,7 @@ process ID.
 
262
 The OVS database schema used to initialize the database (use
 
263
 \fB\-\-db\-schema to override this location).
 
264
 .
 
265
-.IP "\fIsysconfdir\fB/openvswitch/conf.db\fR"
 
266
+.IP "\fIdbdir\fB/conf.db\fR"
 
267
 The OVS database (use \fB\-\-db\-file\fR to override this location).
 
268
 .
 
269
 .IP "\fIrundir\fB/openvswitch/db.sock\fR"
 
270
Index: b/utilities/ovs-ctl.in
 
271
===================================================================
 
272
--- a/utilities/ovs-ctl.in
 
273
+++ b/utilities/ovs-ctl.in
 
274
@@ -371,7 +371,7 @@ set_defaults () {
 
275
     OVS_VSWITCHD_PRIORITY=-10
 
276
     OVS_BRCOMPATD_PRIORITY=-10
 
277
 
 
278
-    DB_FILE=$etcdir/conf.db
 
279
+    DB_FILE=$dbdir/conf.db
 
280
     DB_SOCK=$rundir/db.sock
 
281
     DB_SCHEMA=$datadir/vswitch.ovsschema
 
282
 
 
283
@@ -447,8 +447,9 @@ Other options:
 
284
   -V, --version               display version information
 
285
 
 
286
 Default directories with "configure" option and environment variable override:
 
287
-  logs: @LOGDIR@ (--log-dir, OVS_LOGDIR)
 
288
-  pidfiles and sockets: @RUNDIR@ (--run-dir, OVS_RUNDIR)
 
289
+  logs: @LOGDIR@ (--with-logdir, OVS_LOGDIR)
 
290
+  pidfiles and sockets: @RUNDIR@ (--with-rundir, OVS_RUNDIR)
 
291
+  conf.db: @DBDIR@ (--with-dbdir, OVS_DBDIR)
 
292
   system configuration: @sysconfdir@ (--sysconfdir, OVS_SYSCONFDIR)
 
293
   data files: @pkgdatadir@ (--pkgdatadir, OVS_PKGDATADIR)
 
294
   user binaries: @bindir@ (--bindir, OVS_BINDIR)
 
295
Index: b/utilities/ovs-lib.in
 
296
===================================================================
 
297
--- a/utilities/ovs-lib.in
 
298
+++ b/utilities/ovs-lib.in
 
299
@@ -22,6 +22,8 @@
 
300
 # All of these should be substituted by the Makefile at build time.
 
301
 logdir=${OVS_LOGDIR-'@LOGDIR@'}                 # /var/log/openvswitch
 
302
 rundir=${OVS_RUNDIR-'@RUNDIR@'}                 # /var/run/openvswitch
 
303
+dbdir=${OVS_DBDIR-'@DBDIR@'}                    # /etc/openvswitch
 
304
+                                                # or /var/lib/openvswitch
 
305
 sysconfdir=${OVS_SYSCONFDIR-'@sysconfdir@'}     # /etc
 
306
 etcdir=$sysconfdir/openvswitch                  # /etc/openvswitch
 
307
 datadir=${OVS_PKGDATADIR-'@pkgdatadir@'}        # /usr/share/openvswitch