This patch fixes handling of logical switch and logical port names
that look like a UUID. Previously, if the argument looked like a
UUID, it would only do a UUID lookup for a match. After this change,
if the UUID lookup fails, it will treat it as a name and look it up
that way.
Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
is_uuid = true;
lswitch = nbrec_logical_switch_get_for_uuid(nb_ctx->idl,
&lswitch_uuid);
- } else {
+ }
+
+ if (!lswitch) {
const struct nbrec_logical_switch *iter;
NBREC_LOGICAL_SWITCH_FOR_EACH(iter, nb_ctx->idl) {
if (uuid_from_string(&lport_uuid, id)) {
is_uuid = true;
lport = nbrec_logical_port_get_for_uuid(nb_ctx->idl, &lport_uuid);
- } else {
+ }
+
+ if (!lport) {
NBREC_LOGICAL_PORT_FOR_EACH(lport, nb_ctx->idl) {
if (!strcmp(lport->name, id)) {
break;