Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions api/src/main/java/com/cloud/event/EventTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,9 @@ public class EventTypes {
public static final String EVENT_EXTERNAL_OPENDAYLIGHT_CONFIGURE_CONTROLLER = "PHYSICAL.ODLCONTROLLER.CONFIGURE";

//Guest OS related events
public static final String EVENT_GUEST_OS_CATEGORY_ADD = "GUEST.OS.CATEGORY.ADD";
public static final String EVENT_GUEST_OS_CATEGORY_DELETE = "GUEST.OS.CATEGORY.DELETE";
public static final String EVENT_GUEST_OS_CATEGORY_UPDATE = "GUEST.OS.CATEGORY.UPDATE";
public static final String EVENT_GUEST_OS_ADD = "GUEST.OS.ADD";
public static final String EVENT_GUEST_OS_REMOVE = "GUEST.OS.REMOVE";
public static final String EVENT_GUEST_OS_UPDATE = "GUEST.OS.UPDATE";
Expand Down
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
6 changes: 6 additions & 0 deletions api/src/main/java/com/cloud/server/ResourceIconManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
// under the License.
package com.cloud.server;

import java.util.Collection;
import java.util.List;
import java.util.Map;

public interface ResourceIconManager {

Expand All @@ -25,4 +27,8 @@ public interface ResourceIconManager {
boolean deleteResourceIcon(List<String> resourceIds, ResourceTag.ResourceObjectType resourceType);

ResourceIcon getByResourceTypeAndUuid(ResourceTag.ResourceObjectType type, String resourceId);

Map<Long, ResourceIcon> getByResourceTypeAndIds(ResourceTag.ResourceObjectType type, Collection<Long> resourceIds);

Map<String, ResourceIcon> getByResourceTypeAndUuids(ResourceTag.ResourceObjectType type, Collection<String> resourceUuids);
}
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
5 changes: 5 additions & 0 deletions api/src/main/java/com/cloud/storage/GuestOsCategory.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// under the License.
package com.cloud.storage;

import java.util.Date;

import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;

Expand All @@ -27,4 +29,7 @@ public interface GuestOsCategory extends Identity, InternalIdentity {

void setName(String name);

boolean isFeatured();

Date getCreated();
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public enum ApiCommandResourceType {
AffinityGroup(org.apache.cloudstack.affinity.AffinityGroup.class),
InternalLbVm(com.cloud.network.router.VirtualRouter.class),
DedicatedGuestVlanRange(com.cloud.network.GuestVlan.class),
GuestOsCategory(com.cloud.storage.GuestOsCategory.class),
GuestOs(com.cloud.storage.GuestOS.class),
GuestOsMapping(com.cloud.storage.GuestOSHypervisor.class),
Network(com.cloud.network.Network.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,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
31 changes: 19 additions & 12 deletions api/src/main/java/org/apache/cloudstack/api/ResponseGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,16 @@
import java.util.Map;
import java.util.Set;

import com.cloud.bgp.ASNumber;
import com.cloud.bgp.ASNumberRange;

import org.apache.cloudstack.storage.object.Bucket;
import org.apache.cloudstack.affinity.AffinityGroup;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.ApiConstants.HostDetails;
import org.apache.cloudstack.api.ApiConstants.VMDetails;
import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
import org.apache.cloudstack.api.response.ASNRangeResponse;
import org.apache.cloudstack.api.response.ASNumberResponse;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
import org.apache.cloudstack.api.response.AsyncJobResponse;
import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
Expand All @@ -60,10 +56,10 @@
import org.apache.cloudstack.api.response.DomainRouterResponse;
import org.apache.cloudstack.api.response.EventResponse;
import org.apache.cloudstack.api.response.ExtractResponse;
import org.apache.cloudstack.api.response.SharedFSResponse;
import org.apache.cloudstack.api.response.FirewallResponse;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.GlobalLoadBalancerResponse;
import org.apache.cloudstack.api.response.GuestOSCategoryResponse;
import org.apache.cloudstack.api.response.GuestOSResponse;
import org.apache.cloudstack.api.response.GuestOsMappingResponse;
import org.apache.cloudstack.api.response.GuestVlanRangeResponse;
Expand All @@ -73,11 +69,11 @@
import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse;
import org.apache.cloudstack.api.response.HypervisorGuestOsNamesResponse;
import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.IpQuarantineResponse;
import org.apache.cloudstack.api.response.ImageStoreResponse;
import org.apache.cloudstack.api.response.InstanceGroupResponse;
import org.apache.cloudstack.api.response.InternalLoadBalancerElementResponse;
import org.apache.cloudstack.api.response.IpForwardingRuleResponse;
import org.apache.cloudstack.api.response.IpQuarantineResponse;
import org.apache.cloudstack.api.response.IsolationMethodResponse;
import org.apache.cloudstack.api.response.LBHealthCheckResponse;
import org.apache.cloudstack.api.response.LBStickinessResponse;
Expand Down Expand Up @@ -115,6 +111,7 @@
import org.apache.cloudstack.api.response.SecurityGroupResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.ServiceResponse;
import org.apache.cloudstack.api.response.SharedFSResponse;
import org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse;
import org.apache.cloudstack.api.response.Site2SiteVpnConnectionResponse;
import org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse;
Expand Down Expand Up @@ -159,10 +156,14 @@
import org.apache.cloudstack.region.PortableIpRange;
import org.apache.cloudstack.region.Region;
import org.apache.cloudstack.secstorage.heuristics.Heuristic;
import org.apache.cloudstack.storage.sharedfs.SharedFS;
import org.apache.cloudstack.storage.object.Bucket;
import org.apache.cloudstack.storage.object.ObjectStore;
import org.apache.cloudstack.storage.sharedfs.SharedFS;
import org.apache.cloudstack.usage.Usage;
import org.apache.cloudstack.vm.UnmanagedInstanceTO;

import com.cloud.bgp.ASNumber;
import com.cloud.bgp.ASNumberRange;
import com.cloud.capacity.Capacity;
import com.cloud.configuration.ResourceCount;
import com.cloud.configuration.ResourceLimit;
Expand Down Expand Up @@ -223,10 +224,11 @@
import com.cloud.projects.ProjectInvitation;
import com.cloud.region.ha.GlobalLoadBalancerRule;
import com.cloud.resource.RollingMaintenanceManager;
import com.cloud.server.ResourceTag;
import com.cloud.server.ResourceIcon;
import com.cloud.server.ResourceTag;
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 All @@ -240,14 +242,13 @@
import com.cloud.user.UserAccount;
import com.cloud.user.UserData;
import com.cloud.uservm.UserVm;
import com.cloud.utils.net.Ip;
import com.cloud.utils.Pair;
import com.cloud.utils.net.Ip;
import com.cloud.vm.InstanceGroup;
import com.cloud.vm.Nic;
import com.cloud.vm.NicSecondaryIp;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.snapshot.VMSnapshot;
import org.apache.cloudstack.vm.UnmanagedInstanceTO;

public interface ResponseGenerator {
UserResponse createUserResponse(UserAccount user);
Expand Down Expand Up @@ -485,6 +486,10 @@ List<TemplateResponse> createTemplateResponses(ResponseView view, VirtualMachine

AutoScaleVmGroupResponse createAutoScaleVmGroupResponse(AutoScaleVmGroup vmGroup);

GuestOSCategoryResponse createGuestOSCategoryResponse(GuestOsCategory guestOsCategory);

GuestOSCategoryResponse createGuestOSCategoryResponse(GuestOsCategory guestOsCategory, boolean showIcon);

GuestOSResponse createGuestOSResponse(GuestOS os);

GuestOsMappingResponse createGuestOSMappingResponse(GuestOSHypervisor osHypervisor);
Expand Down Expand Up @@ -572,4 +577,6 @@ List<TemplateResponse> createTemplateResponses(ResponseView view, VirtualMachine
BackupRepositoryResponse createBackupRepositoryResponse(BackupRepository repository);

SharedFSResponse createSharedFSResponse(ResponseView view, SharedFS sharedFS);

void updateTemplateIsoResponsesForIcons(List<TemplateResponse> responses, ResourceTag.ResourceObjectType type);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// 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.ApiCommandResourceType;
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.21.0",
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 73 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#L72-L73

Added lines #L72 - L73 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 79 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#L75-L79

Added lines #L75 - L79 were not covered by tests
}

}

Check warning on line 82 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#L82

Added line #L82 was not covered by tests

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

Check warning on line 87 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#L85-L87

Added lines #L85 - L87 were not covered by tests

@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.GuestOsCategory;
}

Check warning on line 92 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#L90-L92

Added lines #L90 - L92 were not covered by tests
}
Loading
Loading