Copilot commented on code in PR #13635:
URL: https://github.com/apache/cloudstack/pull/13635#discussion_r3597728383


##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -2452,33 +2453,53 @@ public String getName() {
     public boolean start() {
         _executor.scheduleWithFixedDelay(new ExpungeTask(), _expungeInterval, 
_expungeInterval, TimeUnit.SECONDS);
         _vmIpFetchExecutor.scheduleWithFixedDelay(new VmIpFetchTask(), 
VmIpFetchWaitInterval.value(), VmIpFetchWaitInterval.value(), TimeUnit.SECONDS);
-        loadVmDetailsInMapForExternalDhcpIp();
+        _vmIpFetchExecutor.submit(this::loadVmDetailsInMapForExternalDhcpIp);
         return true;
     }
 
-    private void loadVmDetailsInMapForExternalDhcpIp() {
+    protected void loadVmDetailsInMapForExternalDhcpIp() {
+        try {
+            Profiler profiler = new Profiler();
+            profiler.start();
+
+            List<NetworkVO> networks = 
_networkDao.listByGuestType(Network.GuestType.Shared);
+            Map<Long, Boolean> offeringWithoutServices = new HashMap<>();
+            int networksScanned = 0;
+            int nicsAdded = 0;
+
+            for (NetworkVO network : networks) {
+                boolean withoutServices = 
offeringWithoutServices.computeIfAbsent(network.getNetworkOfferingId(),
+                        offeringId -> 
_networkModel.listNetworkOfferingServices(offeringId).isEmpty());
+                if (!withoutServices) {
+                    continue;
+                }
+                networksScanned++;

Review Comment:
   `loadVmDetailsInMapForExternalDhcpIp()` no longer includes GuestType.L2 
networks in the startup seeding scan (previously it scanned Shared + L2, and 
other paths still treat L2 networks as eligible for vmIdCountMap updates). This 
changes behavior and can leave the warm-start cache empty for L2 networks, 
potentially regressing external-DHCP IP fetch behavior for those networks.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to