From b422ca1264d466d69a1e04a144a8aeb01e750f0c Mon Sep 17 00:00:00 2001 From: fuwei Date: Fri, 26 May 2023 15:27:05 +0800 Subject: [PATCH] [sugon_sdn]Fix large api call when create vm nic --- .../sugonSdnController/controller/api/ApiConnectorImpl.java | 2 +- .../controller/neutronClient/TfPortClient.java | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/plugin/sugonSdnController/src/main/java/org/zstack/sugonSdnController/controller/api/ApiConnectorImpl.java b/plugin/sugonSdnController/src/main/java/org/zstack/sugonSdnController/controller/api/ApiConnectorImpl.java index 6232c857c1..e04fede1f7 100644 --- a/plugin/sugonSdnController/src/main/java/org/zstack/sugonSdnController/controller/api/ApiConnectorImpl.java +++ b/plugin/sugonSdnController/src/main/java/org/zstack/sugonSdnController/controller/api/ApiConnectorImpl.java @@ -611,7 +611,7 @@ class ApiConnectorImpl implements ApiConnector { @Override public synchronized List list(Class cls, List parent) throws IOException { final String typename = _apiBuilder.getTypename(cls); - final HttpResponse response = execute(HttpGet.METHOD_NAME, '/' + typename + 's', null); + final HttpResponse response = execute(HttpGet.METHOD_NAME, '/' + typename + "s?detail=true", null); if (response == null || response.getStatusLine() == null) { return null; diff --git a/plugin/sugonSdnController/src/main/java/org/zstack/sugonSdnController/controller/neutronClient/TfPortClient.java b/plugin/sugonSdnController/src/main/java/org/zstack/sugonSdnController/controller/neutronClient/TfPortClient.java index 448639f20f..29bf9efe89 100644 --- a/plugin/sugonSdnController/src/main/java/org/zstack/sugonSdnController/controller/neutronClient/TfPortClient.java +++ b/plugin/sugonSdnController/src/main/java/org/zstack/sugonSdnController/controller/neutronClient/TfPortClient.java @@ -67,11 +67,9 @@ public class TfPortClient { VirtualMachineInterface.class, Arrays.asList("default-domain", tenantId)); for (VirtualMachineInterface port : ports) { - VirtualMachineInterface byId = (VirtualMachineInterface) apiConnector.findById( - VirtualMachineInterface.class, port.getUuid()); MacAddressesType macAddressesType = null; - if (byId != null && byId.getMacAddresses() != null) { - macAddressesType = byId.getMacAddresses(); + if (port != null && port.getMacAddresses() != null) { + macAddressesType = port.getMacAddresses(); List macAddresses = macAddressesType.getMacAddress(); for (String macAddress : macAddresses) { if (macAddress.equals(mac)) { -- Gitee