[ovs-dev] [PATCH ovn 1/2] Fix incorrect version display
Dumitru Ceara
dceara at redhat.com
Mon Feb 17 12:39:28 UTC 2020
On 2/14/20 7:49 PM, numans at ovn.org wrote:
> From: Numan Siddique <numans at ovn.org>
>
> Running any ovn binary with --version displays wrong version
> information. This patch fixes it.
>
> Signed-off-by: Numan Siddique <numans at ovn.org>
Hi Numan,
This change looks good to me. One small issue below.
Thanks,
Dumitru
> ---
> controller-vtep/ovn-controller-vtep.c | 4 ++--
> controller/ovn-controller.c | 2 +-
> ic/ovn-ic.c | 4 ++--
> lib/ovn-util.h | 7 +++++++
> northd/ovn-northd.c | 4 ++--
> utilities/ovn-appctl.c | 3 ++-
> utilities/ovn-detrace.in | 2 +-
> utilities/ovn-ic-nbctl.c | 4 ++--
> utilities/ovn-ic-sbctl.c | 4 ++--
> utilities/ovn-nbctl.c | 4 ++--
> utilities/ovn-sbctl.c | 4 ++--
> utilities/ovn-trace.c | 4 ++--
> 12 files changed, 27 insertions(+), 19 deletions(-)
>
> diff --git a/controller-vtep/ovn-controller-vtep.c b/controller-vtep/ovn-controller-vtep.c
> index ec4d8c1b6..b30a731d4 100644
> --- a/controller-vtep/ovn-controller-vtep.c
> +++ b/controller-vtep/ovn-controller-vtep.c
> @@ -60,7 +60,7 @@ main(int argc, char *argv[])
> int retval;
>
> ovs_cmdl_proctitle_init(argc, argv);
> - set_program_name(argv[0]);
> + ovn_set_program_name(argv[0]);
> service_start(&argc, &argv);
> parse_options(argc, argv);
> fatal_ignore_sigpipe();
> @@ -205,7 +205,7 @@ parse_options(int argc, char *argv[])
> usage();
>
> case 'V':
> - ovs_print_version(OFP13_VERSION, OFP13_VERSION);
> + ovn_print_version(OFP13_VERSION, OFP13_VERSION);
> exit(EXIT_SUCCESS);
>
> VLOG_OPTION_HANDLERS
> diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
> index caef80be1..4d245ca28 100644
> --- a/controller/ovn-controller.c
> +++ b/controller/ovn-controller.c
> @@ -1723,7 +1723,7 @@ main(int argc, char *argv[])
> int retval;
>
> ovs_cmdl_proctitle_init(argc, argv);
> - set_program_name(argv[0]);
> + ovn_set_program_name(argv[0]);
> service_start(&argc, &argv);
> char *ovs_remote = parse_options(argc, argv);
> fatal_ignore_sigpipe();
> diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c
> index 25ca3f7a0..d19fcf8fc 100644
> --- a/ic/ovn-ic.c
> +++ b/ic/ovn-ic.c
> @@ -839,7 +839,7 @@ parse_options(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
> exit(EXIT_SUCCESS);
>
> case 'V':
> - ovs_print_version(0, 0);
> + ovn_print_version(0, 0);
> exit(EXIT_SUCCESS);
>
> default:
> @@ -885,7 +885,7 @@ main(int argc, char *argv[])
>
> fatal_ignore_sigpipe();
> ovs_cmdl_proctitle_init(argc, argv);
> - set_program_name(argv[0]);
> + ovn_set_program_name(argv[0]);
> service_start(&argc, &argv);
> parse_options(argc, argv);
>
> diff --git a/lib/ovn-util.h b/lib/ovn-util.h
> index d0a264583..01b2320a8 100644
> --- a/lib/ovn-util.h
> +++ b/lib/ovn-util.h
> @@ -17,6 +17,13 @@
> #define OVN_UTIL_H 1
>
> #include "lib/packets.h"
> +#include "include/ovn/version.h"
> +
> +#define ovn_set_program_name(name) \
> + ovs_set_program_name(name, OVN_PACKAGE_VERSION)
> +
> +#define ovn_print_version(MIN_OFP, MAX_OFP) \
> + ovs_print_version(MIN_OFP, MAX_OFP)
>
> struct nbrec_logical_router_port;
> struct sbrec_logical_flow;
> diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
> index 46521b552..548e36bab 100644
> --- a/northd/ovn-northd.c
> +++ b/northd/ovn-northd.c
> @@ -11404,7 +11404,7 @@ parse_options(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
> exit(EXIT_SUCCESS);
>
> case 'V':
> - ovs_print_version(0, 0);
> + ovn_print_version(0, 0);
> exit(EXIT_SUCCESS);
>
> default:
> @@ -11442,7 +11442,7 @@ main(int argc, char *argv[])
>
> fatal_ignore_sigpipe();
> ovs_cmdl_proctitle_init(argc, argv);
> - set_program_name(argv[0]);
> + ovn_set_program_name(argv[0]);
> service_start(&argc, &argv);
> parse_options(argc, argv);
>
> diff --git a/utilities/ovn-appctl.c b/utilities/ovn-appctl.c
> index ffd30b452..912e96890 100644
> --- a/utilities/ovn-appctl.c
> +++ b/utilities/ovn-appctl.c
> @@ -25,6 +25,7 @@
> #include "command-line.h"
> #include "daemon.h"
> #include "lib/ovn-dirs.h"
> +#include "lib/ovn-util.h"
> #include "openvswitch/dynamic-string.h"
> #include "jsonrpc.h"
> #include "process.h"
> @@ -47,7 +48,7 @@ main(int argc, char *argv[])
> int cmd_argc;
> int error;
>
> - set_program_name(argv[0]);
> + ovn_set_program_name(argv[0]);
>
> /* Parse command line and connect to target. */
> target = parse_command_line(argc, argv);
> diff --git a/utilities/ovn-detrace.in b/utilities/ovn-detrace.in
> index 9ab2b66f0..ae246e484 100755
> --- a/utilities/ovn-detrace.in
> +++ b/utilities/ovn-detrace.in
I think we should also update the error message when trying to import
OVS libraries in ovn-detrace to point to OVS version instead of OVN. Now
we do:
print("ERROR: Please install the correct Open vSwitch python support")
print(" libraries (@VERSION@).")
Should be:
print(" libraries (@OVSVERSION@).")
> @@ -343,7 +343,7 @@ def main():
> if key in ['-h', '--help']:
> usage()
> elif key in ['-V', '--version']:
> - print("%s (Open vSwitch) @VERSION@" % argv0)
> + print("%s (OVN) @VERSION@" % argv0)
> elif key in ['--ovnsb']:
> ovnsb_db = value
> elif key in ['--ovnnb']:
> diff --git a/utilities/ovn-ic-nbctl.c b/utilities/ovn-ic-nbctl.c
> index 9f209a97e..46cf5189b 100644
> --- a/utilities/ovn-ic-nbctl.c
> +++ b/utilities/ovn-ic-nbctl.c
> @@ -90,7 +90,7 @@ main(int argc, char *argv[])
> unsigned int seqno;
> size_t n_commands;
>
> - set_program_name(argv[0]);
> + ovn_set_program_name(argv[0]);
> fatal_ignore_sigpipe();
> vlog_set_levels(NULL, VLF_CONSOLE, VLL_WARN);
> vlog_set_levels_from_string_assert("reconnect:warn");
> @@ -250,7 +250,7 @@ parse_options(int argc, char *argv[], struct shash *local_options)
> /* fall through */
>
> case 'V':
> - ovs_print_version(0, 0);
> + ovn_print_version(0, 0);
> printf("DB Schema %s\n", icnbrec_get_db_version());
> exit(EXIT_SUCCESS);
>
> diff --git a/utilities/ovn-ic-sbctl.c b/utilities/ovn-ic-sbctl.c
> index f01a77c11..e46b3bbbd 100644
> --- a/utilities/ovn-ic-sbctl.c
> +++ b/utilities/ovn-ic-sbctl.c
> @@ -89,7 +89,7 @@ main(int argc, char *argv[])
> unsigned int seqno;
> size_t n_commands;
>
> - set_program_name(argv[0]);
> + ovn_set_program_name(argv[0]);
> fatal_ignore_sigpipe();
> vlog_set_levels(NULL, VLF_CONSOLE, VLL_WARN);
> vlog_set_levels_from_string_assert("reconnect:warn");
> @@ -249,7 +249,7 @@ parse_options(int argc, char *argv[], struct shash *local_options)
> /* fall through */
>
> case 'V':
> - ovs_print_version(0, 0);
> + ovn_print_version(0, 0);
> printf("DB Schema %s\n", icsbrec_get_db_version());
> exit(EXIT_SUCCESS);
>
> diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c
> index f5d58cc42..b257a5697 100644
> --- a/utilities/ovn-nbctl.c
> +++ b/utilities/ovn-nbctl.c
> @@ -129,7 +129,7 @@ main(int argc, char *argv[])
> struct ovsdb_idl *idl;
> struct shash local_options;
>
> - set_program_name(argv[0]);
> + ovn_set_program_name(argv[0]);
> fatal_ignore_sigpipe();
> vlog_set_levels(NULL, VLF_CONSOLE, VLL_WARN);
> vlog_set_levels_from_string_assert("reconnect:warn");
> @@ -543,7 +543,7 @@ apply_options_direct(const struct ovs_cmdl_parsed_option *parsed_options,
> break;
>
> case 'V':
> - ovs_print_version(0, 0);
> + ovn_print_version(0, 0);
> printf("DB Schema %s\n", nbrec_get_db_version());
> exit(EXIT_SUCCESS);
>
> diff --git a/utilities/ovn-sbctl.c b/utilities/ovn-sbctl.c
> index 4facdb108..d8bb3dcbc 100644
> --- a/utilities/ovn-sbctl.c
> +++ b/utilities/ovn-sbctl.c
> @@ -101,7 +101,7 @@ main(int argc, char *argv[])
> unsigned int seqno;
> size_t n_commands;
>
> - set_program_name(argv[0]);
> + ovn_set_program_name(argv[0]);
> fatal_ignore_sigpipe();
> vlog_set_levels(NULL, VLF_CONSOLE, VLL_WARN);
> vlog_set_levels_from_string_assert("reconnect:warn");
> @@ -264,7 +264,7 @@ parse_options(int argc, char *argv[], struct shash *local_options)
> /* fall through */
>
> case 'V':
> - ovs_print_version(0, 0);
> + ovn_print_version(0, 0);
> printf("DB Schema %s\n", sbrec_get_db_version());
> exit(EXIT_SUCCESS);
>
> diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c
> index 89f1a87c5..7279452ee 100644
> --- a/utilities/ovn-trace.c
> +++ b/utilities/ovn-trace.c
> @@ -99,7 +99,7 @@ static unixctl_cb_func ovntrace_trace;
> int
> main(int argc, char *argv[])
> {
> - set_program_name(argv[0]);
> + ovn_set_program_name(argv[0]);
> service_start(&argc, &argv);
> fatal_ignore_sigpipe();
> vlog_set_levels_from_string_assert("reconnect:warn");
> @@ -325,7 +325,7 @@ parse_options(int argc, char *argv[])
> usage();
>
> case 'V':
> - ovs_print_version(0, 0);
> + ovn_print_version(0, 0);
> printf("DB Schema %s\n", sbrec_get_db_version());
> exit(EXIT_SUCCESS);
>
>
More information about the dev
mailing list