Catch oslo.db error instead of sqlalchemy error

The latest oslo.db code wraps all sqlalchemy exceptions and re-raise
them as oslo.db exceptions. But there is a single case in Ironic when
we suppose to get sqlalchemy exception, so this will break unittest,
when the new version of oslo.db will come.

Added check for the new oslo.db exception, left the old check for the
compatibility.

Closes-Bug: #1214341
Change-Id: Iae5599948d29778ac416edf31d3b1b2f7a8a54a9
Merge "Catch oslo.db error instead of sqlalchemy error"