This is an automated email from the ASF dual-hosted git repository.

sureshanaparti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 5ffae3b047c3b10726ac5bf8e5a2023da8fd60d9
Merge: fd6b755cc1b c4c9731f0c8
Author: Suresh Kumar Anaparti <[email protected]>
AuthorDate: Mon Oct 26 12:25:30 2026 +0530

    Merge branch '4.22'

 .../subsystem/api/storage/TemplateService.java     |   2 +-
 .../java/com/cloud/storage/dao/VMTemplateDao.java  |   2 +
 .../com/cloud/storage/dao/VMTemplateDaoImpl.java   |   8 +
 .../META-INF/db/schema-42210to42300-cleanup.sql    |   9 +
 .../storage/image/TemplateServiceImpl.java         |  16 +-
 .../com/cloud/resource/SimulatorDiscoverer.java    |  27 +-
 plugins/storage/volume/linstor/CHANGELOG.md        |  11 +
 .../storage/motion/LinstorDataMotionStrategy.java  | 120 +++++--
 .../motion/LinstorDataMotionStrategyTest.java      | 356 +++++++++++++++++++++
 server/src/main/java/com/cloud/api/ApiDBUtils.java |   4 +
 .../main/java/com/cloud/api/ApiResponseHelper.java |  20 +-
 .../configuration/ConfigurationManagerImpl.java    |   9 +
 .../java/com/cloud/storage/StorageManagerImpl.java |  15 +-
 .../cloud/storage/download/DownloadListener.java   |   2 +-
 .../java/com/cloud/api/ApiResponseHelperTest.java  |  52 ++-
 .../configuration/ConfigurationManagerTest.java    |   3 +
 .../resource/SecondaryStorageDiscoverer.java       |  28 +-
 17 files changed, 593 insertions(+), 91 deletions(-)

diff --cc 
engine/schema/src/main/resources/META-INF/db/schema-42210to42300-cleanup.sql
index f8b1ac5e1c3,00000000000..e56f40ccadd
mode 100644,000000..100644
--- 
a/engine/schema/src/main/resources/META-INF/db/schema-42210to42300-cleanup.sql
+++ 
b/engine/schema/src/main/resources/META-INF/db/schema-42210to42300-cleanup.sql
@@@ -1,69 -1,0 +1,78 @@@
 +-- Licensed to the Apache Software Foundation (ASF) under one
 +-- or more contributor license agreements.  See the NOTICE file
 +-- distributed with this work for additional information
 +-- regarding copyright ownership.  The ASF licenses this file
 +-- to you under the Apache License, Version 2.0 (the
 +-- "License"); you may not use this file except in compliance
 +-- with the License.  You may obtain a copy of the License at
 +--
 +--   http://www.apache.org/licenses/LICENSE-2.0
 +--
 +-- Unless required by applicable law or agreed to in writing,
 +-- software distributed under the License is distributed on an
 +-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 +-- KIND, either express or implied.  See the License for the
 +-- specific language governing permissions and limitations
 +-- under the License.
 +
 +--;
 +-- Schema upgrade cleanup from 4.22.1.0 to 4.23.0.0
 +--;
 +
 +-- Delete stale project association entries for users that were removed
 +DELETE FROM `cloud`.`project_account` WHERE `user_id` IN (SELECT `id` FROM 
`cloud`.`user` WHERE `removed` IS NOT NULL);
 +DELETE FROM `cloud`.`project_invitations` WHERE `user_id` IN (SELECT `id` 
FROM `cloud`.`user` WHERE `removed` IS NOT NULL);
 +
 +-- Last backup usage metric published per VM and backup offering
 +CREATE TABLE IF NOT EXISTS `cloud`.`backup_usage_metric` (
 +    `id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
 +    `vm_id` bigint unsigned NOT NULL COMMENT 'VM ID',
 +    `backup_offering_id` bigint unsigned NOT NULL COMMENT 'Backup offering 
ID',
 +    `size` bigint unsigned NOT NULL COMMENT 'Backup size last published',
 +    `protected_size` bigint unsigned NOT NULL COMMENT 'Protected size last 
published',
 +    `updated` datetime NOT NULL COMMENT 'Date the metric was last published',
 +    PRIMARY KEY (`id`),
 +    UNIQUE KEY `uk_backup_usage_metric__vm_id__backup_offering_id` (`vm_id`, 
`backup_offering_id`)
 +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 +
 +-- Widen the unique key on cloud_usage.usage_volume to include vm_id, so the 
cumulative and
 +-- per-VM volume usage records introduced in 4.22.1 can coexist. See #13399.
 +CALL `cloud_usage`.`IDEMPOTENT_DROP_INDEX`('id', 'cloud_usage.usage_volume');
 +CALL `cloud_usage`.`IDEMPOTENT_ADD_UNIQUE_INDEX`('cloud_usage.usage_volume', 
'id', '(volume_id ASC, created ASC, vm_id ASC)');
 +
 +-- Reclaim VNETs belonging to Netris deleted networks
 +UPDATE op_dc_vnet_alloc a
 +    JOIN networks n ON n.broadcast_uri = CONCAT('netris://', a.vnet)
 +    SET a.account_id = NULL,
 +        a.reservation_id = NULL,
 +        a.taken = NULL
 +WHERE n.removed IS NOT NULL;
 +
 +-- Scope routed network/VPC subnets to a zone, so that the same CIDR can be 
used in more than one zone. See #14419.
 +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.ip4_guest_subnet_network_map', 
'data_center_id', 'bigint unsigned DEFAULT NULL COMMENT "zone it belongs to"');
 +
 +UPDATE `cloud`.`ip4_guest_subnet_network_map` m
 +    JOIN `cloud`.`dc_ip4_guest_subnets` p ON p.id = m.parent_id
 +    SET m.data_center_id = p.data_center_id
 +WHERE m.data_center_id IS NULL;
 +
 +UPDATE `cloud`.`ip4_guest_subnet_network_map` m
 +    JOIN `cloud`.`vpc` v ON v.id = m.vpc_id
 +    SET m.data_center_id = v.zone_id
 +WHERE m.data_center_id IS NULL;
 +
 +UPDATE `cloud`.`ip4_guest_subnet_network_map` m
 +    JOIN `cloud`.`networks` n ON n.id = m.network_id
 +    SET m.data_center_id = n.data_center_id
 +WHERE m.data_center_id IS NULL;
 +
 +CALL 
`cloud`.`IDEMPOTENT_ADD_FOREIGN_KEY`('cloud.ip4_guest_subnet_network_map', 
'fk_ip4_guest_subnet_network_map__data_center_id', '(`data_center_id`)', 
'`data_center`(`id`)');
++
++--- Add existing cross zone templates to the missing edge zones
++INSERT INTO cloud.template_zone_ref (zone_id, template_id, created, 
last_updated)
++SELECT dc.id, vt.id, NOW(), NOW()
++FROM cloud.data_center dc
++JOIN cloud.vm_template vt ON vt.cross_zones = 1 AND vt.removed IS NULL
++WHERE dc.type = 'Edge' AND dc.removed IS NULL
++  AND NOT EXISTS (SELECT 1 FROM cloud.template_zone_ref tzr
++                  WHERE tzr.zone_id = dc.id AND tzr.template_id = vt.id AND 
tzr.removed IS NULL);
diff --cc server/src/test/java/com/cloud/api/ApiResponseHelperTest.java
index c0c019f6dbd,0a9afbc224b..bbd7afcdd11
--- a/server/src/test/java/com/cloud/api/ApiResponseHelperTest.java
+++ b/server/src/test/java/com/cloud/api/ApiResponseHelperTest.java
@@@ -29,26 -37,12 +29,27 @@@ import java.util.Set
  import java.util.TimeZone;
  import java.util.UUID;
  
 +import org.junit.After;
 +import org.junit.Assert;
 +import org.junit.Before;
 +import org.junit.Test;
 +import org.junit.runner.RunWith;
 +import org.mockito.InjectMocks;
 +import org.mockito.Mock;
 +import org.mockito.MockedStatic;
 +import org.mockito.Mockito;
 +import org.mockito.Spy;
 +import org.mockito.junit.MockitoJUnitRunner;
 +import org.springframework.test.util.ReflectionTestUtils;
 +
  import org.apache.cloudstack.annotation.dao.AnnotationDao;
 +import org.apache.cloudstack.api.ResponseObject;
  import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
  import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
 +import org.apache.cloudstack.api.response.ConsoleSessionResponse;
  import org.apache.cloudstack.api.response.DirectDownloadCertificateResponse;
  import org.apache.cloudstack.api.response.GuestOSCategoryResponse;
+ import org.apache.cloudstack.api.response.IPAddressResponse;
  import org.apache.cloudstack.api.response.IpQuarantineResponse;
  import org.apache.cloudstack.api.response.NicSecondaryIpResponse;
  import org.apache.cloudstack.api.response.ResourceIconResponse;
@@@ -64,8 -69,7 +65,9 @@@ import com.cloud.capacity.Capacity
  import com.cloud.configuration.Resource;
  import com.cloud.domain.DomainVO;
  import com.cloud.host.HostVO;
+ import com.cloud.network.IpAddress;
 +import com.cloud.network.Networks;
 +import com.cloud.network.PhysicalNetworkTrafficType;
  import com.cloud.network.PublicIpQuarantine;
  import com.cloud.network.as.AutoScaleVmGroup;
  import com.cloud.network.as.AutoScaleVmGroupVO;
@@@ -95,19 -97,14 +97,21 @@@ import com.cloud.user.UserVO
  import com.cloud.user.dao.UserDataDao;
  import com.cloud.utils.net.Ip;
  import com.cloud.vm.ConsoleSessionVO;
+ import com.cloud.vm.Nic;
  import com.cloud.vm.NicSecondaryIp;
+ import com.cloud.vm.NicVO;
  import com.cloud.vm.VMInstanceVO;
+ import com.cloud.vm.VirtualMachine;
 -import org.apache.cloudstack.api.ResponseObject;
 -import org.apache.cloudstack.api.response.ConsoleSessionResponse;
 +
 +import static org.junit.Assert.assertEquals;
 +import static org.junit.Assert.assertFalse;
 +import static org.junit.Assert.assertNull;
 +import static org.junit.Assert.assertTrue;
 +import static org.mockito.ArgumentMatchers.any;
 +import static org.mockito.ArgumentMatchers.anyLong;
 +import static org.mockito.Mockito.verify;
 +import static org.mockito.Mockito.when;
  
- 
  @RunWith(MockitoJUnitRunner.class)
  public class ApiResponseHelperTest {
  

Reply via email to