Service controllers can set their roles, so it's necessary to demote them
to slaves if another controller becomes master. Unfortunately the
'controllers' hmap only contains primary controllers, so this was omitted.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
char *local_port_name;
/* OpenFlow connections. */
char *local_port_name;
/* OpenFlow connections. */
- struct hmap controllers; /* Controller "struct ofconn"s. */
- struct list all_conns; /* Contains "struct ofconn"s. */
+ struct hmap controllers; /* All OFCONN_PRIMARY controllers. */
+ struct list all_conns; /* All controllers. */
uint64_t master_election_id; /* monotonically increasing sequence number
* for master election */
bool master_election_id_defined;
uint64_t master_election_id; /* monotonically increasing sequence number
* for master election */
bool master_election_id_defined;
if (role != ofconn->role && role == OFPCR12_ROLE_MASTER) {
struct ofconn *other;
if (role != ofconn->role && role == OFPCR12_ROLE_MASTER) {
struct ofconn *other;
- HMAP_FOR_EACH (other, hmap_node, &ofconn->connmgr->controllers) {
+ LIST_FOR_EACH (other, node, &ofconn->connmgr->all_conns) {
if (other->role == OFPCR12_ROLE_MASTER) {
other->role = OFPCR12_ROLE_SLAVE;
ofconn_send_role_status(other, OFPCR12_ROLE_SLAVE, OFPCRR_MASTER_REQUEST);
if (other->role == OFPCR12_ROLE_MASTER) {
other->role = OFPCR12_ROLE_SLAVE;
ofconn_send_role_status(other, OFPCR12_ROLE_SLAVE, OFPCRR_MASTER_REQUEST);