[ovs-dev] [PATCH] ovsdb: Expose vhost-user socket directory in ovsdb

Christian Ehrhardt christian.ehrhardt at canonical.com
Thu Jan 28 12:30:07 UTC 2016


Hi Robert,

Aaron was working on the same and more (permissions&ownership)
=> netdev-dpdk: Support user cfg vhost socket perms (
http://openvswitch.org/pipermail/dev/2015-December/063567.html)

To be resubmitted, It depends on the discussion and acceptance of the
current 7th revision of the groundwork to get all of the dpdk config into
ovsdb:
=> [PATCH v7 0/5] Convert DPDK configuration from command line to DB based (
http://openvswitch.org/pipermail/dev/2016-January/065147.html)

As you achieve the same and the other patch is out for review for a
while  I'd encourage you to join in reviewing and testing the series to get
it accepted.



Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical Ltd

On Thu, Jan 28, 2016 at 11:57 AM, Robert Wojciechowicz <
robertx.wojciechowicz at intel.com> wrote:

> In order to correctly interoperate with Openstack and ODL,
> the vhost-user socket directory must be exposed from OVS via OVSDB.
> Different distros may package OVS in different ways,
> so the locations of these sockets may vary depending on how
> ovs-vswitchd has been started. Some clients need information where
> the sockets are located when instantiating Qemu virtual machines.
> This path is stored in Open_vSwitch table in other_config column
> with key vhost-sock-dir, e.g.:
> {vhost-sock-dir="/usr/local/var/run/openvswitch"}
>
> Signed-off-by: Robert Wojciechowicz <robertx.wojciechowicz at intel.com>
> ---
>  INSTALL.DPDK.md   |  3 +++
>  lib/netdev-dpdk.c | 26 ++++++++++++++++++++++++++
>  lib/netdev-dpdk.h |  9 +++++++++
>  vswitchd/bridge.c |  3 +++
>  4 files changed, 41 insertions(+)
>
> diff --git a/INSTALL.DPDK.md b/INSTALL.DPDK.md
> index 96b686c..27ba317 100644
> --- a/INSTALL.DPDK.md
> +++ b/INSTALL.DPDK.md
> @@ -527,6 +527,9 @@ have arbitrary names.
>
>        `./vswitchd/ovs-vswitchd --dpdk -vhost_sock_dir /my-dir -c 0x1 ...`
>
> +      Additionally vhost-user sockets directory is exposed in OVSDB
> +      (table: Open_vSwitch, column: other_config, key: vhost-sock-dir).
> +
>  DPDK vhost-user VM configuration:
>  ---------------------------------
>  Follow the steps below to attach vhost-user port(s) to a VM.
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index b209df2..272ade5 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -2207,6 +2207,32 @@ dpdk_init(int argc, char **argv)
>      return result + 1 + base;
>  }
>
> +void
> +dpdk_set_config(const struct ovsrec_open_vswitch *cfg)
> +{
> +    struct smap dpdk_args;
> +    const struct ovsdb_datum *datum;
> +    size_t i;
> +
> +    ovs_mutex_lock(&dpdk_mutex);
> +
> +    if (vhost_sock_dir && strlen(vhost_sock_dir)) {
> +        smap_init(&dpdk_args);
> +        datum = ovsrec_open_vswitch_get_other_config(cfg,
> OVSDB_TYPE_STRING,
> +                                                     OVSDB_TYPE_STRING);
> +        for (i = 0; i < datum->n; i++) {
> +            smap_add(&dpdk_args, datum->keys[i].string,
> +                     datum->values[i].string);
> +        }
> +        smap_add_format(&dpdk_args, "vhost-sock-dir", "%s",
> vhost_sock_dir);
> +        ovsrec_open_vswitch_set_other_config(cfg, &dpdk_args);
> +        smap_destroy(&dpdk_args);
> +    }
> +
> +    ovs_mutex_unlock(&dpdk_mutex);
> +}
> +
> +
>  static const struct netdev_class dpdk_class =
>      NETDEV_DPDK_CLASS(
>          "dpdk",
> diff --git a/lib/netdev-dpdk.h b/lib/netdev-dpdk.h
> index 646d3e2..f11d877 100644
> --- a/lib/netdev-dpdk.h
> +++ b/lib/netdev-dpdk.h
> @@ -3,6 +3,8 @@
>
>  #include <config.h>
>
> +#include "lib/vswitch-idl.h"
> +
>  struct dp_packet;
>
>  #ifdef DPDK_NETDEV
> @@ -23,6 +25,7 @@ struct dp_packet;
>  #define NON_PMD_CORE_ID LCORE_ID_ANY
>
>  int dpdk_init(int argc, char **argv);
> +void dpdk_set_config(const struct ovsrec_open_vswitch *cfg);
>  void netdev_dpdk_register(void);
>  void free_dpdk_buf(struct dp_packet *);
>  int pmd_thread_setaffinity_cpu(unsigned cpu);
> @@ -43,6 +46,12 @@ dpdk_init(int argc, char **argv)
>  }
>
>  static inline void
> +dpdk_set_config(const struct ovsrec_open_vswitch *cfg)
> +{
> +    /* Nothing */
> +}
> +
> +static inline void
>  netdev_dpdk_register(void)
>  {
>      /* Nothing */
> diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
> index f8afe55..cf84093 100644
> --- a/vswitchd/bridge.c
> +++ b/vswitchd/bridge.c
> @@ -411,6 +411,7 @@ bridge_init(const char *remote)
>      ovsdb_idl_omit(idl, &ovsrec_open_vswitch_col_db_version);
>      ovsdb_idl_omit(idl, &ovsrec_open_vswitch_col_system_type);
>      ovsdb_idl_omit(idl, &ovsrec_open_vswitch_col_system_version);
> +    ovsdb_idl_omit_alert(idl, &ovsrec_open_vswitch_col_other_config);
>
>      ovsdb_idl_omit_alert(idl, &ovsrec_bridge_col_datapath_id);
>      ovsdb_idl_omit_alert(idl, &ovsrec_bridge_col_datapath_version);
> @@ -428,6 +429,7 @@ bridge_init(const char *remote)
>      ovsdb_idl_omit(idl, &ovsrec_port_col_external_ids);
>      ovsdb_idl_omit_alert(idl, &ovsrec_port_col_trunks);
>      ovsdb_idl_omit_alert(idl, &ovsrec_port_col_vlan_mode);
> +
>      ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_admin_state);
>      ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_duplex);
>      ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_link_speed);
> @@ -2976,6 +2978,7 @@ bridge_run(void)
>
>          if (cfg) {
>              ovsrec_open_vswitch_set_cur_cfg(cfg, cfg->next_cfg);
> +            dpdk_set_config(cfg);
>              discover_types(cfg);
>          }
>
> --
> 1.8.3.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list