summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0311d4f)
Currently, the 'ofport' column in Interface table is
ephemeral and is populated by vswitchd everytime it is
started or when a new interface is created with vswitchd
running.
Making it persistent lets vswitchd try and assign the
same ofport number to a particular interface across
restarts. This is just a fallback option when
'ofport_request' column is empty.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
static void iface_refresh_stats(struct iface *);
static void iface_refresh_status(struct iface *);
static bool iface_is_synthetic(const struct iface *);
static void iface_refresh_stats(struct iface *);
static void iface_refresh_status(struct iface *);
static bool iface_is_synthetic(const struct iface *);
+static int64_t iface_pick_ofport(const struct ovsrec_interface *);
/* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.)
*
/* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.)
*
iface_hint = xmalloc(sizeof *iface_hint);
iface_hint->br_name = br_cfg->name;
iface_hint->br_type = br_cfg->datapath_type;
iface_hint = xmalloc(sizeof *iface_hint);
iface_hint->br_name = br_cfg->name;
iface_hint->br_type = br_cfg->datapath_type;
- iface_hint->ofp_port = if_cfg->n_ofport_request ?
- *if_cfg->ofport_request : OFPP_NONE;
+ iface_hint->ofp_port = iface_pick_ofport(if_cfg);
shash_add(&iface_hints, if_cfg->name, iface_hint);
}
shash_add(&iface_hints, if_cfg->name, iface_hint);
}
error = iface_do_create(br, if_cfg, &ofp_port, &netdev);
bridge_run_fast();
if (error) {
error = iface_do_create(br, if_cfg, &ofp_port, &netdev);
bridge_run_fast();
if (error) {
+ iface_set_ofport(iface_cfg, -1);
iface_clear_db_record(iface_cfg);
ok = false;
goto done;
iface_clear_db_record(iface_cfg);
ok = false;
goto done;
if_cfg->cfg = cfg;
if_cfg->parent = parent;
if_cfg->cfg = cfg;
if_cfg->parent = parent;
- if_cfg->ofport = cfg->n_ofport_request ? *cfg->ofport_request : OFPP_NONE;
+ if_cfg->ofport = iface_pick_ofport(cfg);
hmap_insert(&br->if_cfg_todo, &if_cfg->hmap_node,
hash_string(if_cfg->cfg->name, 0));
}
hmap_insert(&br->if_cfg_todo, &if_cfg->hmap_node,
hash_string(if_cfg->cfg->name, 0));
}
iface_clear_db_record(const struct ovsrec_interface *if_cfg)
{
if (!ovsdb_idl_row_is_synthetic(&if_cfg->header_)) {
iface_clear_db_record(const struct ovsrec_interface *if_cfg)
{
if (!ovsdb_idl_row_is_synthetic(&if_cfg->header_)) {
- iface_set_ofport(if_cfg, -1);
ovsrec_interface_set_status(if_cfg, NULL);
ovsrec_interface_set_admin_state(if_cfg, NULL);
ovsrec_interface_set_duplex(if_cfg, NULL);
ovsrec_interface_set_status(if_cfg, NULL);
ovsrec_interface_set_admin_state(if_cfg, NULL);
ovsrec_interface_set_duplex(if_cfg, NULL);
return ovsdb_idl_row_is_synthetic(&iface->cfg->header_);
}
return ovsdb_idl_row_is_synthetic(&iface->cfg->header_);
}
+static int64_t
+iface_pick_ofport(const struct ovsrec_interface *cfg)
+{
+ int64_t ofport = cfg->n_ofport ? *cfg->ofport : OFPP_NONE;
+ return cfg->n_ofport_request ? *cfg->ofport_request : ofport;
+}
+
- "version": "6.11.1",
- "cksum": "2684374538 17324",
+ "version": "6.11.2",
+ "cksum": "2033079075 17296",
"tables": {
"Open_vSwitch": {
"columns": {
"tables": {
"Open_vSwitch": {
"columns": {
"external_ids": {
"type": {"key": "string", "value": "string", "min": 0, "max": "unlimited"}},
"ofport": {
"external_ids": {
"type": {"key": "string", "value": "string", "min": 0, "max": "unlimited"}},
"ofport": {
- "type": {"key": "integer", "min": 0, "max": 1},
- "ephemeral": true},
+ "type": {"key": "integer", "min": 0, "max": 1}},
"ofport_request": {
"type": {
"key": {"type": "integer",
"ofport_request": {
"type": {
"key": {"type": "integer",
port number for the OpenFlow ``local port''). If the interface
cannot be added then Open vSwitch sets this column
to -1.</p>
port number for the OpenFlow ``local port''). If the interface
cannot be added then Open vSwitch sets this column
to -1.</p>
+ <p>When <ref column="ofport_request"/> is not set, Open vSwitch picks
+ an appropriate value for this column and then tries to keep the value
+ constant across restarts.</p>
</column>
<column name="ofport_request">
</column>
<column name="ofport_request">