From 049026428c6b4d2f9ad3a76fdc5cd10ba08d9c58 Mon Sep 17 00:00:00 2001 From: Jing Zhang Date: Wed, 31 May 2023 10:50:56 -0500 Subject: [PATCH] Code changes verified for no-trunk OVS deployment. --- pkg/openstack/instances.go | 3 +++ pkg/openstack/openstack_test.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/openstack/instances.go b/pkg/openstack/instances.go index 6b6ccea142..f6e1367ddf 100644 --- a/pkg/openstack/instances.go +++ b/pkg/openstack/instances.go @@ -766,6 +766,9 @@ func getSubInterfaces(interfaces []attachinterfaces.Interface, network *gophercl klog.Errorf("It is not expected to see more than one trunk on a single port %s", iface.PortID) return subports, err } + if len(allTrunks) == 0 { + continue + } // Get subports attached to the trunks trunk := allTrunks[0] klog.V(5).Infof("Subports for trunk %s: %v", trunk.ID, trunk.Subports) diff --git a/pkg/openstack/openstack_test.go b/pkg/openstack/openstack_test.go index 09c6dd3abe..07270eb57f 100644 --- a/pkg/openstack/openstack_test.go +++ b/pkg/openstack/openstack_test.go @@ -935,7 +935,7 @@ func TestNodeAddressesWithSubports(t *testing.T) { "OS-EXT-IPS:type": "fixed", }, }, - "mycluster-01-vlan703_network": []interface{}{ + "mycluster-01-vlan702_network": []interface{}{ map[string]interface{}{ "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:36:b7:8f", "version": float64(4),