[ovs-dev] [PATCH] ovn-nbctl: Allow names that look like UUIDs.
Russell Bryant
rbryant at redhat.com
Tue Mar 31 02:07:04 UTC 2015
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 at redhat.com>
---
ovn/ovn-nbctl.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/ovn/ovn-nbctl.c b/ovn/ovn-nbctl.c
index eade156..b470e9f 100644
--- a/ovn/ovn-nbctl.c
+++ b/ovn/ovn-nbctl.c
@@ -91,7 +91,9 @@ lswitch_by_name_or_uuid(struct nbctl_context *nb_ctx, const char *id)
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) {
@@ -225,7 +227,9 @@ lport_by_name_or_uuid(struct nbctl_context *nb_ctx, const char *id)
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;
--
2.1.0
More information about the dev
mailing list