ovsdb-idl: improve error handling when schema is not available
authorLance Richardson <lrichard@redhat.com>
Wed, 24 Feb 2016 15:48:34 +0000 (10:48 -0500)
committerBen Pfaff <blp@ovn.org>
Mon, 14 Mar 2016 17:17:23 +0000 (10:17 -0700)
commit6d8822103af351807461acdf23833d6c0f7d0bad
treec17467a3e125f6d8a2f6e7306f5c30ddef1c32b3
parent3cdc5697c73fa705e8bec156196ab39fc6d79296
ovsdb-idl: improve error handling when schema is not available

A common error scenario with OVN is to attempt to use ovn-nbctl when
the OVN databases have not been created in ovsdb-server:
   1. ovn-nbctl sends a "get_schema" request for the OVN db to ovsdb-server.
   2. ovsdb-server fails to find requested db, sends error response
      to ovn-nbctl.
   3. ovn-nbctl receives the error response in ovsdb_idl_run(), but
      takes no specific action.
   4. ovn-nbctl hangs forever in IDL_S_SCHEMA_REQUESTED state (assuming
      a timeout wasn't requested on the command line).

This commit adds a new IDL state, IDL_S_NO_SCHEMA, which is entered
when a negative response to a schema request is received. When in
this state, ovsdb_idl_is_alive() now returns 'false', allowing clients
(currently ovn-nbctl, ovn-sbctl, vtep-ctl, and ovs-vsctl) to detect this
condition and exit with an appropriate error message.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
lib/ovsdb-idl.c