I agree that this seems harmless and potentially useful, so I applied it to master and branch-2.9.
On Tue, Jan 23, 2018 at 03:47:23PM +0000, Miguel Angel Ajo Pelayo wrote: > Awesome it, this would be very helpful to signal chassis details to the cms > in a consistent way. > > It'd be very helpful if we can get this on 2.9, and although I know it's a > feature it's tiny enough and independent enough which may not introduce any > regression to OVN. > > Best, > Miguel Ángel > > On Tue, Jan 23, 2018, 4:14 PM Daniel Alvarez <[email protected]> wrote: > > > This patch makes ovn-controller sets the external_ids key > > 'ovn-cms-options' to its own Chassis table entry copying its > > contents from the same external_ids key in the local OpenvSwitch > > database. > > > > The idea behind this patch is to allow setting general options > > from the CMS Plugin to a particular chassis. > > > > A good example of an use case is when we want to schedule a router > > on a chassis from OpenStack. In this case, we may want to exclude > > some nodes because they are more likely to be restarted for > > maintenance operations or they simply won't have external connectivity. > > This way, if the CMS/deployment tool would set the external_ids > > as: > > > > ovs-vsctl set open . external_ids:ovn-cms-options="enable-chassis-as-gw" > > > > Then ovn-controller will write the options to the Chassis table in > > southbound database. This value can be later read by the CMS in order > > to decide which Chassis are eligible to schedule a router on. > > > > Similarly, this new key would allow to specify additional options to > > be consumed by the CMS. > > > > Signed-off-by: Daniel Alvarez <[email protected]> > > --- > > ovn/controller/chassis.c | 13 ++++++++++++- > > ovn/controller/ovn-controller.8.xml | 7 +++++++ > > ovn/ovn-sb.xml | 8 ++++++++ > > 3 files changed, 27 insertions(+), 1 deletion(-) > > > > diff --git a/ovn/controller/chassis.c b/ovn/controller/chassis.c > > index 521b04c..6b5286a 100644 > > --- a/ovn/controller/chassis.c > > +++ b/ovn/controller/chassis.c > > @@ -66,6 +66,12 @@ get_bridge_mappings(const struct smap *ext_ids) > > return smap_get_def(ext_ids, "ovn-bridge-mappings", ""); > > } > > > > +static const char * > > +get_cms_options(const struct smap *ext_ids) > > +{ > > + return smap_get_def(ext_ids, "ovn-cms-options", ""); > > +} > > + > > /* Returns this chassis's Chassis record, if it is available and is > > currently > > * amenable to a transaction. */ > > const struct sbrec_chassis * > > @@ -119,6 +125,7 @@ chassis_run(struct controller_ctx *ctx, const char > > *chassis_id, > > const char *bridge_mappings = get_bridge_mappings(&cfg->external_ids); > > const char *datapath_type = > > br_int && br_int->datapath_type ? br_int->datapath_type : ""; > > + const char *cms_options = get_cms_options(&cfg->external_ids); > > > > struct ds iface_types = DS_EMPTY_INITIALIZER; > > ds_put_cstr(&iface_types, ""); > > @@ -144,16 +151,20 @@ chassis_run(struct controller_ctx *ctx, const char > > *chassis_id, > > = smap_get_def(&chassis_rec->external_ids, "datapath-type", > > ""); > > const char *chassis_iface_types > > = smap_get_def(&chassis_rec->external_ids, "iface-types", ""); > > + const char *chassis_cms_options > > + = get_cms_options(&chassis_rec->external_ids); > > > > /* If any of the external-ids should change, update them. */ > > if (strcmp(bridge_mappings, chassis_bridge_mappings) || > > strcmp(datapath_type, chassis_datapath_type) || > > - strcmp(iface_types_str, chassis_iface_types)) { > > + strcmp(iface_types_str, chassis_iface_types) || > > + strcmp(cms_options, chassis_cms_options)) { > > struct smap new_ids; > > smap_clone(&new_ids, &chassis_rec->external_ids); > > smap_replace(&new_ids, "ovn-bridge-mappings", > > bridge_mappings); > > smap_replace(&new_ids, "datapath-type", datapath_type); > > smap_replace(&new_ids, "iface-types", iface_types_str); > > + smap_replace(&new_ids, "ovn-cms-options", cms_options); > > sbrec_chassis_verify_external_ids(chassis_rec); > > sbrec_chassis_set_external_ids(chassis_rec, &new_ids); > > smap_destroy(&new_ids); > > diff --git a/ovn/controller/ovn-controller.8.xml > > b/ovn/controller/ovn-controller.8.xml > > index 2af3db5..0df59ac 100644 > > --- a/ovn/controller/ovn-controller.8.xml > > +++ b/ovn/controller/ovn-controller.8.xml > > @@ -150,6 +150,13 @@ > > network interface card, enabling encapsulation checksum may incur > > performance loss. In such cases, encapsulation checksums can be > > disabled. > > </dd> > > + > > + <dt><code>external_ids:ovn-cms-options</code></dt> > > + <dd> > > + A list of options that will be consumed by the CMS Plugin and > > which > > + specific to this particular chassis. An example would be: > > + <code>cms_option1,cms_option2:foo</code>. > > + </dd> > > </dl> > > > > <p> > > diff --git a/ovn/ovn-sb.xml b/ovn/ovn-sb.xml > > index abc241e..4a75135 100644 > > --- a/ovn/ovn-sb.xml > > +++ b/ovn/ovn-sb.xml > > @@ -241,6 +241,14 @@ > > read-only. See <code>ovn-controller</code>(8) for more information. > > </column> > > > > + <column name="external_ids" key="ovn-cms-options"> > > + <code>ovn-controller</code> populates this key with the set of > > options > > + configured in the <ref table="Open_vSwitch" > > + column="external_ids:ovn-cms-options"/> column of the Open_vSwitch > > + database's <ref table="Open_vSwitch" db="Open_vSwitch"/> table. > > + See <code>ovn-controller</code>(8) for more information. > > + </column> > > + > > <group title="Common Columns"> > > The overall purpose of these columns is described under <code>Common > > Columns</code> at the beginning of this document. > > -- > > 1.8.3.1 > > > > _______________________________________________ > > dev mailing list > > [email protected] > > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > > > _______________________________________________ > dev mailing list > [email protected] > https://mail.openvswitch.org/mailman/listinfo/ovs-dev _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
