forked from ovn-org/ovn
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for using OVN specific rundirs
Until now, OVN uses the openvswitch rundirs (rundir, logdir, etcdir). The commit [1] changed the package name from openvswitch to ovn, but it didn't take into the account the effects of it. When "make install" is run ovn-ctl utility is copied to /usr/local/share/ovn/scripts folder. ovn-ctl depends on 'ovs-lib' and it is not present in this scripts foler. Because of which we cannot start OVN services using ovn-ctl. This patch addresses all these issues. It changes the rundir to ovn specific ones. (i.e /usr/local/var/run/ovn, /usr/local/var/log/ovn, /usr/local/etc/ovn with default configuration). [1] - 7795e0e("Change the package name from openvswitch to ovn in AC_INIT()") Tested:by: Dumitru Ceara <dceara@redhat.com> Signed-off-by: Numan Siddique <nusiddiq@redhat.com> Signed-off-by: 0-day Robot <robot@bytheb.org>
- Loading branch information
1 parent
7984c60
commit 28f87d1
Showing
17 changed files
with
491 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#line 2 "@srcdir@/lib/dirs.c.in" | ||
/* | ||
* Copyright (c) 2019 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at: | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <config.h> | ||
#include "ovn-dirs.h" | ||
#include <stdlib.h> | ||
#include "lib/ovs-thread.h" | ||
#include "lib/util.h" | ||
|
||
struct directory { | ||
const char *value; /* Actual value; NULL if not yet determined. */ | ||
const char *default_value; /* Default value. */ | ||
const char *var_name; /* Environment variable to override default. */ | ||
struct ovsthread_once once; /* Ensures 'value' gets initialized once. */ | ||
}; | ||
|
||
static const char * | ||
get_dir(struct directory *d) | ||
{ | ||
if (ovsthread_once_start(&d->once)) { | ||
d->value = getenv(d->var_name); | ||
if (!d->value || !d->value[0]) { | ||
d->value = d->default_value; | ||
} | ||
ovsthread_once_done(&d->once); | ||
} | ||
return d->value; | ||
} | ||
|
||
const char * | ||
ovn_sysconfdir(void) | ||
{ | ||
static struct directory d = { | ||
NULL, @sysconfdir@, "OVN_SYSCONFDIR", OVSTHREAD_ONCE_INITIALIZER | ||
}; | ||
|
||
return get_dir(&d); | ||
} | ||
|
||
const char * | ||
ovn_pkgdatadir(void) | ||
{ | ||
static struct directory d = { | ||
NULL, @pkgdatadir@, "OVN_PKGDATADIR", OVSTHREAD_ONCE_INITIALIZER | ||
}; | ||
|
||
return get_dir(&d); | ||
} | ||
|
||
const char * | ||
ovn_rundir(void) | ||
{ | ||
static struct directory d = { | ||
NULL, @OVN_RUNDIR@, "OVN_RUNDIR", OVSTHREAD_ONCE_INITIALIZER | ||
}; | ||
|
||
return get_dir(&d); | ||
} | ||
|
||
const char * | ||
ovn_logdir(void) | ||
{ | ||
static struct directory d = { | ||
NULL, @LOGDIR@, "OVN_LOGDIR", OVSTHREAD_ONCE_INITIALIZER | ||
}; | ||
|
||
return get_dir(&d); | ||
} | ||
|
||
const char * | ||
ovn_dbdir(void) | ||
{ | ||
static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; | ||
static const char *dbdir; | ||
|
||
if (ovsthread_once_start(&once)) { | ||
dbdir = getenv("OVN_DBDIR"); | ||
if (!dbdir || !dbdir[0]) { | ||
char *sysconfdir = getenv("OVN_SYSCONFDIR"); | ||
|
||
dbdir = (sysconfdir | ||
? xasprintf("%s/ovn", sysconfdir) | ||
: @DBDIR@); | ||
} | ||
ovsthread_once_done(&once); | ||
} | ||
return dbdir; | ||
} | ||
|
||
const char * | ||
ovn_bindir(void) | ||
{ | ||
static struct directory d = { | ||
NULL, @bindir@, "OVN_BINDIR", OVSTHREAD_ONCE_INITIALIZER | ||
}; | ||
|
||
return get_dir(&d); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (c) 2019. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at: | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef OVN_DIRS_H | ||
#define OVN_DIRS_H 1 | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
const char *ovn_sysconfdir(void); /* /usr/local/etc */ | ||
const char *ovn_pkgdatadir(void); /* /usr/local/share/ovn */ | ||
const char *ovn_rundir(void); /* /usr/local/var/run/ovn */ | ||
const char *ovn_logdir(void); /* /usr/local/var/log/ovn */ | ||
const char *ovn_dbdir(void); /* /usr/local/etc/ovn */ | ||
const char *ovn_bindir(void); /* /usr/local/bin */ | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* OVN_DIRS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.