Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
90294a6
ui,api,server: template categorization based on os
shwstppr Apr 10, 2025
7fc3865
reorganize os categories
shwstppr Apr 28, 2025
6d2c124
fixes for isoid as queryparam
shwstppr Apr 28, 2025
eda7679
tests
shwstppr Apr 30, 2025
f2e1b57
allow updating category for multiple os
shwstppr Apr 30, 2025
14cf02a
fix user template listing
shwstppr Apr 30, 2025
3ad581e
cosistent
shwstppr Apr 30, 2025
bcc64cc
ui fixes
shwstppr Apr 30, 2025
138c704
filter catedories for vnf templates
shwstppr Apr 30, 2025
d9f37ce
add review comments
shwstppr May 5, 2025
6dbc2cc
address ui comments
shwstppr May 5, 2025
01a66bd
fix issue with all category
shwstppr May 5, 2025
ce3402e
ui fix for tmplt pagination
shwstppr May 6, 2025
b25984c
fix reinstall form
shwstppr May 6, 2025
050d2f0
add tooltip, fix title overflow
shwstppr May 7, 2025
bff3d61
add userdata icon
shwstppr May 7, 2025
f23a32e
remove log
shwstppr May 7, 2025
ec23bf5
backend fixes
shwstppr May 7, 2025
fdc4cce
oscategoryid condition fix
shwstppr May 7, 2025
dac8d73
template/iso oscategoryid filter
shwstppr May 7, 2025
69e6627
fix icons
shwstppr May 7, 2025
e200b9e
fix for non-featured category
shwstppr May 8, 2025
3e7a9a1
refactor image search bar
shwstppr May 8, 2025
52a9908
add deploy button on infocard for images
shwstppr May 8, 2025
15bd888
category filter for guestos and fix bulk update
shwstppr May 8, 2025
7428baa
add showicon param for listOsCategories
shwstppr May 8, 2025
707b0ea
ui: show deploy button only if allowed
shwstppr May 8, 2025
9434391
Merge remote-tracking branch 'apache/4.20' into deployvm-improvements
shwstppr May 9, 2025
d7d970d
update help doc
shwstppr May 21, 2025
8e1786f
ui: fix guestos userdefined
shwstppr May 21, 2025
6ab7123
template type filter
shwstppr May 21, 2025
d96afd6
ui: show icon/label for more properties
shwstppr May 21, 2025
551ec47
events for os category
shwstppr May 21, 2025
52778c1
Merge remote-tracking branch 'apache/main' into deployvm-improvements
shwstppr Jun 3, 2025
b252f41
move changes to 4.21
shwstppr Jun 3, 2025
90c2ed5
fix
shwstppr Jun 3, 2025
cf522b0
fix schema
shwstppr Jun 3, 2025
75ecb4d
fix fetchdata imagedeploybtn
shwstppr Jun 3, 2025
c9aec4a
schema fix
shwstppr Jun 3, 2025
039e1ec
refactor
shwstppr Jun 4, 2025
3139ece
vm, template resource icons from category
shwstppr Jun 4, 2025
fceb522
donot pass category icons in ui
shwstppr Jun 4, 2025
e3e8ea3
fix icons
shwstppr Jun 4, 2025
a9c00ca
tests
shwstppr Jun 4, 2025
5e56234
tests
shwstppr Jun 4, 2025
ed5239f
fix
shwstppr Jun 4, 2025
c5c2f37
fix lint eof
shwstppr Jun 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions api/src/main/java/com/cloud/server/ManagementService.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@
import org.apache.cloudstack.api.command.admin.config.ListCfgGroupsByCmd;
import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
import org.apache.cloudstack.api.command.admin.config.UpdateHypervisorCapabilitiesCmd;
import org.apache.cloudstack.api.command.admin.guest.AddGuestOsCategoryCmd;
import org.apache.cloudstack.api.command.admin.guest.AddGuestOsCmd;
import org.apache.cloudstack.api.command.admin.guest.AddGuestOsMappingCmd;
import org.apache.cloudstack.api.command.admin.guest.DeleteGuestOsCategoryCmd;
import org.apache.cloudstack.api.command.admin.guest.GetHypervisorGuestOsNamesCmd;
import org.apache.cloudstack.api.command.admin.guest.ListGuestOsMappingCmd;
import org.apache.cloudstack.api.command.admin.guest.RemoveGuestOsCmd;
import org.apache.cloudstack.api.command.admin.guest.RemoveGuestOsMappingCmd;
import org.apache.cloudstack.api.command.admin.guest.UpdateGuestOsCategoryCmd;
import org.apache.cloudstack.api.command.admin.guest.UpdateGuestOsCmd;
import org.apache.cloudstack.api.command.admin.guest.UpdateGuestOsMappingCmd;
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
Expand Down Expand Up @@ -168,6 +171,12 @@ public interface ManagementService {
*/
Pair<List<? extends GuestOsCategory>, Integer> listGuestOSCategoriesByCriteria(ListGuestOsCategoriesCmd cmd);

GuestOsCategory addGuestOsCategory(AddGuestOsCategoryCmd cmd);

GuestOsCategory updateGuestOsCategory(UpdateGuestOsCategoryCmd cmd);

boolean deleteGuestOsCategory(DeleteGuestOsCategoryCmd cmd);

/**
* Obtains a list of all guest OS mappings
*
Expand Down
1 change: 1 addition & 0 deletions api/src/main/java/com/cloud/server/ResourceTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public enum ResourceObjectType {
LBStickinessPolicy(false, true),
LBHealthCheckPolicy(false, true),
SnapshotPolicy(true, true),
GuestOsCategory(false, false, true),
GuestOs(false, true),
NetworkOffering(false, true),
VpcOffering(true, false),
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/com/cloud/storage/GuestOsCategory.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ public interface GuestOsCategory extends Identity, InternalIdentity {

void setName(String name);

boolean isFeatured();

}
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ public class ApiConstants {
public static final String IS_EXTRACTABLE = "isextractable";
public static final String IS_FEATURED = "isfeatured";
public static final String IS_IMPLICIT = "isimplicit";
public static final String IS_ISO = "isiso";
public static final String IS_PORTABLE = "isportable";
public static final String IS_PUBLIC = "ispublic";
public static final String IS_PERSISTENT = "ispersistent";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.cloud.bgp.ASNumber;
import com.cloud.bgp.ASNumberRange;

import org.apache.cloudstack.api.response.GuestOSCategoryResponse;
import org.apache.cloudstack.storage.object.Bucket;
import org.apache.cloudstack.affinity.AffinityGroup;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
Expand Down Expand Up @@ -227,6 +228,7 @@
import com.cloud.server.ResourceIcon;
import com.cloud.storage.GuestOS;
import com.cloud.storage.GuestOSHypervisor;
import com.cloud.storage.GuestOsCategory;
import com.cloud.storage.ImageStore;
import com.cloud.storage.Snapshot;
import com.cloud.storage.StoragePool;
Expand Down Expand Up @@ -481,6 +483,8 @@ List<TemplateResponse> createTemplateResponses(ResponseView view, VirtualMachine

AutoScaleVmGroupResponse createAutoScaleVmGroupResponse(AutoScaleVmGroup vmGroup);

GuestOSCategoryResponse createGuestOSCategoryResponse(GuestOsCategory guestOsCategory);

GuestOSResponse createGuestOSResponse(GuestOS os);

GuestOsMappingResponse createGuestOSMappingResponse(GuestOSHypervisor osHypervisor);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// 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.

package org.apache.cloudstack.api.command.admin.guest;

import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.GuestOSCategoryResponse;

import com.cloud.storage.GuestOsCategory;
import com.cloud.user.Account;

@APICommand(name = "addOsCategory",
description = "Adds a new OS category",
responseObject = GuestOSCategoryResponse.class,
requestHasSensitiveInfo = false,
responseHasSensitiveInfo = false,
since = "4.20.1",
authorized = {RoleType.Admin})
public class AddGuestOsCategoryCmd extends BaseCmd {


/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////

@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Name of the OS category",
required = true)
private String name;

@Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN,
description = "Whether the category is featured or not")
private Boolean featured;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////

public String getName() {
return name;
}

public boolean isFeatured() {
return Boolean.TRUE.equals(featured);
}

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

@Override
public void execute() {
GuestOsCategory guestOs = _mgr.addGuestOsCategory(this);

Check warning on line 72 in api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCategoryCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCategoryCmd.java#L71-L72

Added lines #L71 - L72 were not covered by tests
if (guestOs != null) {
GuestOSCategoryResponse response = _responseGenerator.createGuestOSCategoryResponse(guestOs);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add new OS category");

Check warning on line 78 in api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCategoryCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCategoryCmd.java#L74-L78

Added lines #L74 - L78 were not covered by tests
}

}

Check warning on line 81 in api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCategoryCmd.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L81 was not covered by tests

@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}

Check warning on line 86 in api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCategoryCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCategoryCmd.java#L84-L86

Added lines #L84 - L86 were not covered by tests
}
Original file line number Diff line number Diff line change
@@ -0,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.

package org.apache.cloudstack.api.command.admin.guest;

import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.GuestOSCategoryResponse;
import org.apache.cloudstack.api.response.SuccessResponse;

import com.cloud.user.Account;


@APICommand(name = "deleteOsCategory",
description = "Deletes an OS category",
responseObject = SuccessResponse.class,
requestHasSensitiveInfo = false,
responseHasSensitiveInfo = false,
since = "4.20.1",
authorized = {RoleType.Admin})
public class DeleteGuestOsCategoryCmd extends BaseCmd {


/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////

@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOSCategoryResponse.class,
required = true, description = "ID of the OS category")
private Long id;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////

public Long getId() {
return id;
}

Check warning on line 57 in api/src/main/java/org/apache/cloudstack/api/command/admin/guest/DeleteGuestOsCategoryCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/guest/DeleteGuestOsCategoryCmd.java#L55-L57

Added lines #L55 - L57 were not covered by tests

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

@Override
public void execute() {
boolean result = _mgr.deleteGuestOsCategory(this);

Check warning on line 65 in api/src/main/java/org/apache/cloudstack/api/command/admin/guest/DeleteGuestOsCategoryCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/guest/DeleteGuestOsCategoryCmd.java#L64-L65

Added lines #L64 - L65 were not covered by tests
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove OS category");

Check warning on line 70 in api/src/main/java/org/apache/cloudstack/api/command/admin/guest/DeleteGuestOsCategoryCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/guest/DeleteGuestOsCategoryCmd.java#L67-L70

Added lines #L67 - L70 were not covered by tests
}
}

Check warning on line 72 in api/src/main/java/org/apache/cloudstack/api/command/admin/guest/DeleteGuestOsCategoryCmd.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L72 was not covered by tests

@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}

Check warning on line 77 in api/src/main/java/org/apache/cloudstack/api/command/admin/guest/DeleteGuestOsCategoryCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/guest/DeleteGuestOsCategoryCmd.java#L75-L77

Added lines #L75 - L77 were not covered by tests
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// 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.

package org.apache.cloudstack.api.command.admin.guest;

import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.GuestOSCategoryResponse;

import com.cloud.storage.GuestOsCategory;
import com.cloud.user.Account;

@APICommand(name = "updateOsCategory",
description = "Updates an OS category",
responseObject = GuestOSCategoryResponse.class,
requestHasSensitiveInfo = false,
responseHasSensitiveInfo = false,
since = "4.20.1",
authorized = {RoleType.Admin})
public class UpdateGuestOsCategoryCmd extends BaseCmd {



/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////

@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOSCategoryResponse.class,
required = true, description = "ID of the OS category")
private Long id;

@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Name for the OS category")
private String name;

@Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN,
description = "Whether the category is featured or not")
private Boolean featured;

@Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER,
description = "sort key of the OS category for listing")
private Integer sortKey;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////

public Long getId() {
return id;
}

Check warning on line 68 in api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCategoryCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCategoryCmd.java#L66-L68

Added lines #L66 - L68 were not covered by tests

public String getName() {
return name;
}

public Boolean isFeatured() {
return featured;
}

public Integer getSortKey() {
return sortKey;
}

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}

Check warning on line 89 in api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCategoryCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCategoryCmd.java#L87-L89

Added lines #L87 - L89 were not covered by tests

@Override
public void execute() {
GuestOsCategory guestOs = _mgr.updateGuestOsCategory(this);

Check warning on line 93 in api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCategoryCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCategoryCmd.java#L92-L93

Added lines #L92 - L93 were not covered by tests
if (guestOs != null) {
GuestOSCategoryResponse response = _responseGenerator.createGuestOSCategoryResponse(guestOs);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update OS category");

Check warning on line 99 in api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCategoryCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCategoryCmd.java#L95-L99

Added lines #L95 - L99 were not covered by tests
}
}

Check warning on line 101 in api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCategoryCmd.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L101 was not covered by tests
}
Loading
Loading