[ovs-dev] [PATCH] ovn: Add hostname to Chassis.

Russell Bryant russell at ovn.org
Tue Mar 22 12:59:23 UTC 2016


On Mon, Mar 21, 2016 at 10:36 PM, Russell Bryant <russell at ovn.org> wrote:
>
> @@ -125,8 +127,12 @@ chassis_run(struct controller_ctx *ctx, const char
> *chassis_id)
>                                chassis_id);
>
>      if (!chassis_rec) {
> +        char hostname[HOST_NAME_MAX + 1];
>          chassis_rec = sbrec_chassis_insert(ctx->ovnsb_idl_txn);
>          sbrec_chassis_set_name(chassis_rec, chassis_id);
> +        if (!gethostname(hostname, sizeof hostname)) {
> +            sbrec_chassis_set_hostname(chassis_rec, hostname);
> +        }
>      }
>
>      int n_encaps = count_1bits(req_tunnels);
>
>
I should have noted that this patch makes the assumption that the hostname
*very* rarely changes during the lifetime of a chassis record, so it
doesn't bother checking for changes after creating the chassis record.

Deleting the chassis record manually would cause it to get recreated with
an updated hostname if ever required, but that's totally non-obvious to an
administrator.  Maybe I should update it to check for hostname changes.  It
seemed wasteful, but correctness should come before premature optimization.

I think I just convinced myself this needs a v2.  Forgive me, it was late
when I quickly wrote this.  :-)

-- 
Russell Bryant



More information about the dev mailing list