diff options
author | Alex Wang <alexw@nicira.com> | 2015-05-19 14:22:16 -0700 |
---|---|---|
committer | Alex Wang <alexw@nicira.com> | 2015-05-22 13:39:47 -0700 |
commit | 713322317cf123eaab403c3c39b0faaef1968ceb (patch) | |
tree | 089569543462f9ce23138410c0e4ff871368fbb3 /ovn/controller/ovn-controller.h | |
parent | 7b303ff9838fc7cb022cb5ff3eed14d700c8bc61 (diff) | |
download | openvswitch-713322317cf123eaab403c3c39b0faaef1968ceb.tar.gz |
ovn: Change type of 'chassis' column in 'Binding' table.
This commit changes the type of 'chassis' column in 'Binding' table
from string to weak reference of 'Chassis' table entry. This will
make accessing the chassis from binding more efficient.
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'ovn/controller/ovn-controller.h')
-rw-r--r-- | ovn/controller/ovn-controller.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ovn/controller/ovn-controller.h b/ovn/controller/ovn-controller.h index a1630f768..6f9865833 100644 --- a/ovn/controller/ovn-controller.h +++ b/ovn/controller/ovn-controller.h @@ -17,6 +17,8 @@ #ifndef OVN_CONTROLLER_H #define OVN_CONTROLLER_H 1 +#include "ovn/lib/ovn-sb-idl.h" + struct controller_ctx { char *chassis_id; /* ID for this chassis. */ char *br_int_name; /* Name of local integration bridge. */ @@ -26,4 +28,18 @@ struct controller_ctx { const struct ovsrec_bridge *br_int; }; +static inline const struct sbrec_chassis * +get_chassis_by_name(struct ovsdb_idl *ovnsb_idl, char *chassis_id) +{ + const struct sbrec_chassis *chassis_rec; + + SBREC_CHASSIS_FOR_EACH(chassis_rec, ovnsb_idl) { + if (!strcmp(chassis_rec->name, chassis_id)) { + break; + } + } + + return chassis_rec; +} + #endif /* ovn/ovn-controller.h */ |