Skip to content

Commit b252f41

Browse files
committed
move changes to 4.21
Signed-off-by: Abhishek Kumar <[email protected]>
1 parent 52778c1 commit b252f41

File tree

10 files changed

+103
-103
lines changed

10 files changed

+103
-103
lines changed

api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCategoryCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
responseObject = GuestOSCategoryResponse.class,
3636
requestHasSensitiveInfo = false,
3737
responseHasSensitiveInfo = false,
38-
since = "4.20.1",
38+
since = "4.21.0",
3939
authorized = {RoleType.Admin})
4040
public class AddGuestOsCategoryCmd extends BaseCmd {
4141

api/src/main/java/org/apache/cloudstack/api/command/admin/guest/DeleteGuestOsCategoryCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
responseObject = SuccessResponse.class,
3737
requestHasSensitiveInfo = false,
3838
responseHasSensitiveInfo = false,
39-
since = "4.20.1",
39+
since = "4.21.0",
4040
authorized = {RoleType.Admin})
4141
public class DeleteGuestOsCategoryCmd extends BaseCmd {
4242

api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCategoryCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
responseObject = GuestOSCategoryResponse.class,
3636
requestHasSensitiveInfo = false,
3737
responseHasSensitiveInfo = false,
38-
since = "4.20.1",
38+
since = "4.21.0",
3939
authorized = {RoleType.Admin})
4040
public class UpdateGuestOsCategoryCmd extends BaseCmd {
4141

api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class UpdateGuestOsCmd extends BaseAsyncCmd {
6060
private Boolean display;
6161

6262
@Parameter(name = ApiConstants.OS_CATEGORY_ID, type = CommandType.UUID, entityType = GuestOSCategoryResponse.class,
63-
description = "the ID of the OS category", since = "4.20.1")
63+
description = "the ID of the OS category", since = "4.21.0")
6464
private Long osCategoryId;
6565

6666

api/src/main/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ public class ListGuestOsCategoriesCmd extends BaseListCmd {
5050
@Parameter(name = ApiConstants.IS_FEATURED,
5151
type = CommandType.BOOLEAN,
5252
description = "List available OS categories by featured or not",
53-
since = "4.20.1")
53+
since = "4.21.0")
5454
private Boolean featured;
5555

5656
@Parameter(name = ApiConstants.IS_ISO,
5757
type = CommandType.BOOLEAN,
5858
description = "List OS categories for which an ISO is available",
59-
since = "4.20.1")
59+
since = "4.21.0")
6060
private Boolean iso;
6161

6262
@Parameter(name = ApiConstants.IS_VNF, type = CommandType.BOOLEAN,
@@ -68,19 +68,19 @@ public class ListGuestOsCategoriesCmd extends BaseListCmd {
6868
type = CommandType.UUID,
6969
entityType = ZoneResponse.class,
7070
description = "List available OS categories types for the zone",
71-
since = "4.20.1")
71+
since = "4.21.0")
7272
private Long zoneId;
7373

7474
@Parameter(name = ApiConstants.ARCH,
7575
type = CommandType.STRING,
7676
description = "List OS categories types available for given CPU architecture",
77-
since = "4.20.1")
77+
since = "4.21.0")
7878
private String arch;
7979

8080
@Parameter(name = ApiConstants.SHOW_RESOURCE_ICON,
8181
type = CommandType.BOOLEAN,
8282
description = "flag to display the resource image for the OS category",
83-
since = "4.20.1")
83+
since = "4.21.0")
8484
private Boolean showIcon;
8585

8686
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd implements UserCmd {
9999

100100
@Parameter(name = ApiConstants.OS_CATEGORY_ID, type = CommandType.UUID, entityType= GuestOSCategoryResponse.class,
101101
description = "the ID of the OS category for the ISO",
102-
since = "4.20.1")
102+
since = "4.21.0")
103103
private Long osCategoryId;
104104

105105
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd implements User
115115

116116
@Parameter(name = ApiConstants.OS_CATEGORY_ID, type = CommandType.UUID, entityType= GuestOSCategoryResponse.class,
117117
description = "the ID of the OS category for the template",
118-
since = "4.20.1")
118+
since = "4.21.0")
119119
private Long osCategoryId;
120120

121121
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/response/GuestOSCategoryResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ public class GuestOSCategoryResponse extends BaseResponse implements SetResource
3838
private String name;
3939

4040
@SerializedName(ApiConstants.IS_FEATURED)
41-
@Param(description = "Whether the OS category is featured", since = "4.20.1")
41+
@Param(description = "Whether the OS category is featured", since = "4.21.0")
4242
private Boolean featured;
4343

4444
@SerializedName(ApiConstants.RESOURCE_ICON)
45-
@Param(description = "Base64 string representation of the resource icon", since = "4.20.1")
45+
@Param(description = "Base64 string representation of the resource icon", since = "4.21.0")
4646
private ResourceIconResponse resourceIconResponse;
4747

4848
@SerializedName(ApiConstants.CREATED)

engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -131,93 +131,3 @@ CALL `cloud`.`IDEMPOTENT_UPDATE_API_PERMISSION`('Support Admin - Default', 'vali
131131

132132
-- Re-apply VPC: update default network offering for vpc tier to conserve_mode=1 (#8309)
133133
UPDATE `cloud`.`network_offerings` SET conserve_mode=1 WHERE name='DefaultIsolatedNetworkOfferingForVpcNetworks';
134-
135-
-- Add featured column for guest_os_category
136-
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.guest_os_category', 'featured', 'tinyint(1) NOT NULL DEFAULT 0 COMMENT "whether the category is featured or not" AFTER `uuid`');
137-
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.guest_os_category', 'sort_key', 'int NOT NULL DEFAULT 0 COMMENT "sort key used for customising sort method" AFTER `featured`');
138-
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.guest_os_category', 'created', 'date COMMENT "date on which the category was created" AFTER `sort_key`');
139-
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.guest_os_category', 'removed', 'date COMMENT "date removed if not null" AFTER `created`');
140-
UPDATE `cloud`.`guest_os_category` SET `featured` = 1 WHERE `name` NOT IN ('Novel', 'None');
141-
142-
-- Begin: Changes for Guest OS category cleanup
143-
-- Add new OS categories if not present
144-
DROP PROCEDURE IF EXISTS `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`;
145-
CREATE PROCEDURE `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`(IN os_name VARCHAR(255))
146-
BEGIN
147-
IF NOT EXISTS ((SELECT 1 FROM `cloud`.`guest_os_category` WHERE name = os_name))
148-
THEN
149-
INSERT INTO `cloud`.`guest_os_category` (name, uuid)
150-
VALUES (os_name, UUID())
151-
; END IF
152-
; END;
153-
154-
CALL `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`('Fedora');
155-
CALL `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`('Rocky Linux');
156-
CALL `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`('Alma Linux');
157-
158-
-- Move existing guest OS to new categories
159-
DROP PROCEDURE IF EXISTS `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`;
160-
CREATE PROCEDURE `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`(IN category_name VARCHAR(255), IN os_name VARCHAR(255))
161-
BEGIN
162-
DECLARE category_id BIGINT
163-
; SELECT `id` INTO category_id
164-
FROM `cloud`.`guest_os_category`
165-
WHERE `name` = category_name
166-
LIMIT 1
167-
; IF category_id IS NULL THEN
168-
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Category not found'
169-
; END IF
170-
; UPDATE `cloud`.`guest_os`
171-
SET `category_id` = category_id
172-
WHERE `display_name` LIKE CONCAT('%', os_name, '%')
173-
; END;
174-
CALL `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`('Rocky Linux', 'Rocky Linux');
175-
CALL `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`('Alma Linux', 'Alma Linux');
176-
CALL `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`('Fedora', 'Fedora');
177-
178-
-- Move existing guest OS whose category will be deleted to Other category
179-
DROP PROCEDURE IF EXISTS `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`;
180-
CREATE PROCEDURE `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`(IN to_category_name VARCHAR(255), IN from_category_name VARCHAR(255))
181-
BEGIN
182-
DECLARE done INT DEFAULT 0
183-
; DECLARE to_category_id BIGINT
184-
; SELECT id INTO to_category_id
185-
FROM `cloud`.`guest_os_category`
186-
WHERE `name` = to_category_name
187-
LIMIT 1
188-
; IF to_category_id IS NULL THEN
189-
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'ToCategory not found'
190-
; END IF
191-
; UPDATE `cloud`.`guest_os`
192-
SET `category_id` = to_category_id
193-
WHERE `category_id` = (SELECT `id` FROM `cloud`.`guest_os_category` WHERE `name` = from_category_name)
194-
; UPDATE `cloud`.`guest_os_category` SET `removed``=now() WHERE `name` = from_category_name
195-
; END;
196-
CALL `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`('Other', 'Novel');
197-
CALL `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`('Other', 'None');
198-
CALL `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`('Other', 'Unix');
199-
CALL `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`('Other', 'Mac');
200-
201-
-- Add featured column for cloud.guest_os_category
202-
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.guest_os_category', 'featured', 'tinyint(1) NOT NULL DEFAULT 0 COMMENT "whether the category is featured or not" AFTER `uuid`');
203-
UPDATE `cloud`.`guest_os_category` SET featured = 1;
204-
-- Add sort_key column for cloud.guest_os_category
205-
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.guest_os_category', 'sort_key', 'int NOT NULL DEFAULT 0 COMMENT "sort key used for customising sort method" AFTER `featured`');
206-
207-
-- Update sort order for all guest OS categories
208-
UPDATE `cloud`.`guest_os_category`
209-
SET `sort_key` = CASE
210-
WHEN `name` = 'Ubuntu' THEN 1
211-
WHEN `name` = 'Debian' THEN 2
212-
WHEN `name` = 'Fedora' THEN 3
213-
WHEN `name` = 'CentOS' THEN 4
214-
WHEN `name` = 'Rocky Linux' THEN 5
215-
WHEN `name` = 'Alma Linux' THEN 6
216-
WHEN `name` = 'Oracle' THEN 7
217-
WHEN `name` = 'RedHat' THEN 8
218-
WHEN `name` = 'SUSE' THEN 9
219-
WHEN `name` = 'Windows' THEN 10
220-
WHEN `name` = 'Other' THEN 11
221-
ELSE `sort_key`
222-
END;
223-
-- End: Changes for Guest OS category cleanup

engine/schema/src/main/resources/META-INF/db/schema-42010to42100.sql

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,93 @@ CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.host', 'storage_access_groups', 'var
8080
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.cluster', 'storage_access_groups', 'varchar(255) DEFAULT NULL COMMENT "storage access groups for the hosts in the cluster"');
8181
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.host_pod_ref', 'storage_access_groups', 'varchar(255) DEFAULT NULL COMMENT "storage access groups for the hosts in the pod"');
8282
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.data_center', 'storage_access_groups', 'varchar(255) DEFAULT NULL COMMENT "storage access groups for the hosts in the zone"');
83+
84+
-- Add featured column for guest_os_category
85+
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.guest_os_category', 'featured', 'tinyint(1) NOT NULL DEFAULT 0 COMMENT "whether the category is featured or not" AFTER `uuid`');
86+
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.guest_os_category', 'sort_key', 'int NOT NULL DEFAULT 0 COMMENT "sort key used for customising sort method" AFTER `featured`');
87+
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.guest_os_category', 'created', 'date COMMENT "date on which the category was created" AFTER `sort_key`');
88+
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.guest_os_category', 'removed', 'date COMMENT "date removed if not null" AFTER `created`');
89+
UPDATE `cloud`.`guest_os_category` SET `featured` = 1 WHERE `name` NOT IN ('Novel', 'None');
90+
91+
-- Begin: Changes for Guest OS category cleanup
92+
-- Add new OS categories if not present
93+
DROP PROCEDURE IF EXISTS `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`;
94+
CREATE PROCEDURE `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`(IN os_name VARCHAR(255))
95+
BEGIN
96+
IF NOT EXISTS ((SELECT 1 FROM `cloud`.`guest_os_category` WHERE name = os_name))
97+
THEN
98+
INSERT INTO `cloud`.`guest_os_category` (name, uuid)
99+
VALUES (os_name, UUID())
100+
; END IF
101+
; END;
102+
103+
CALL `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`('Fedora');
104+
CALL `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`('Rocky Linux');
105+
CALL `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`('Alma Linux');
106+
107+
-- Move existing guest OS to new categories
108+
DROP PROCEDURE IF EXISTS `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`;
109+
CREATE PROCEDURE `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`(IN category_name VARCHAR(255), IN os_name VARCHAR(255))
110+
BEGIN
111+
DECLARE category_id BIGINT
112+
; SELECT `id` INTO category_id
113+
FROM `cloud`.`guest_os_category`
114+
WHERE `name` = category_name
115+
LIMIT 1
116+
; IF category_id IS NULL THEN
117+
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Category not found'
118+
; END IF
119+
; UPDATE `cloud`.`guest_os`
120+
SET `category_id` = category_id
121+
WHERE `display_name` LIKE CONCAT('%', os_name, '%')
122+
; END;
123+
CALL `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`('Rocky Linux', 'Rocky Linux');
124+
CALL `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`('Alma Linux', 'Alma Linux');
125+
CALL `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`('Fedora', 'Fedora');
126+
127+
-- Move existing guest OS whose category will be deleted to Other category
128+
DROP PROCEDURE IF EXISTS `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`;
129+
CREATE PROCEDURE `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`(IN to_category_name VARCHAR(255), IN from_category_name VARCHAR(255))
130+
BEGIN
131+
DECLARE done INT DEFAULT 0
132+
; DECLARE to_category_id BIGINT
133+
; SELECT id INTO to_category_id
134+
FROM `cloud`.`guest_os_category`
135+
WHERE `name` = to_category_name
136+
LIMIT 1
137+
; IF to_category_id IS NULL THEN
138+
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'ToCategory not found'
139+
; END IF
140+
; UPDATE `cloud`.`guest_os`
141+
SET `category_id` = to_category_id
142+
WHERE `category_id` = (SELECT `id` FROM `cloud`.`guest_os_category` WHERE `name` = from_category_name)
143+
; UPDATE `cloud`.`guest_os_category` SET `removed``=now() WHERE `name` = from_category_name
144+
; END;
145+
CALL `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`('Other', 'Novel');
146+
CALL `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`('Other', 'None');
147+
CALL `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`('Other', 'Unix');
148+
CALL `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`('Other', 'Mac');
149+
150+
-- Add featured column for cloud.guest_os_category
151+
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.guest_os_category', 'featured', 'tinyint(1) NOT NULL DEFAULT 0 COMMENT "whether the category is featured or not" AFTER `uuid`');
152+
UPDATE `cloud`.`guest_os_category` SET featured = 1;
153+
-- Add sort_key column for cloud.guest_os_category
154+
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.guest_os_category', 'sort_key', 'int NOT NULL DEFAULT 0 COMMENT "sort key used for customising sort method" AFTER `featured`');
155+
156+
-- Update sort order for all guest OS categories
157+
UPDATE `cloud`.`guest_os_category`
158+
SET `sort_key` = CASE
159+
WHEN `name` = 'Ubuntu' THEN 1
160+
WHEN `name` = 'Debian' THEN 2
161+
WHEN `name` = 'Fedora' THEN 3
162+
WHEN `name` = 'CentOS' THEN 4
163+
WHEN `name` = 'Rocky Linux' THEN 5
164+
WHEN `name` = 'Alma Linux' THEN 6
165+
WHEN `name` = 'Oracle' THEN 7
166+
WHEN `name` = 'RedHat' THEN 8
167+
WHEN `name` = 'SUSE' THEN 9
168+
WHEN `name` = 'Windows' THEN 10
169+
WHEN `name` = 'Other' THEN 11
170+
ELSE `sort_key`
171+
END;
172+
-- End: Changes for Guest OS category cleanup

0 commit comments

Comments
 (0)