Skip to content

Commit e926904

Browse files
committed
Merge remote-tracking branch 'origin/main' into 4.19-list-network-protocols
2 parents 2a81a31 + d3cad42 commit e926904

File tree

163 files changed

+11478
-456
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+11478
-456
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ jobs:
9393
smoke/test_nic
9494
smoke/test_nic_adapter_type
9595
smoke/test_non_contigiousvlan
96+
smoke/test_object_stores
9697
smoke/test_outofbandmanagement
9798
smoke/test_outofbandmanagement_nestedplugin
9899
smoke/test_over_provisioning

api/src/main/java/com/cloud/event/EventTypes.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import org.apache.cloudstack.api.response.ZoneResponse;
3030
import org.apache.cloudstack.config.Configuration;
3131
import org.apache.cloudstack.ha.HAConfig;
32+
import org.apache.cloudstack.storage.object.Bucket;
33+
import org.apache.cloudstack.storage.object.ObjectStore;
3234
import org.apache.cloudstack.usage.Usage;
3335
import org.apache.cloudstack.vm.schedule.VMSchedule;
3436

@@ -714,6 +716,16 @@ public class EventTypes {
714716
// SystemVM
715717
public static final String EVENT_LIVE_PATCH_SYSTEMVM = "LIVE.PATCH.SYSTEM.VM";
716718

719+
// OBJECT STORE
720+
public static final String EVENT_OBJECT_STORE_CREATE = "OBJECT.STORE.CREATE";
721+
public static final String EVENT_OBJECT_STORE_DELETE = "OBJECT.STORE.DELETE";
722+
public static final String EVENT_OBJECT_STORE_UPDATE = "OBJECT.STORE.UPDATE";
723+
724+
// BUCKETS
725+
public static final String EVENT_BUCKET_CREATE = "BUCKET.CREATE";
726+
public static final String EVENT_BUCKET_DELETE = "BUCKET.DELETE";
727+
public static final String EVENT_BUCKET_UPDATE = "BUCKET.UPDATE";
728+
717729
static {
718730

719731
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
@@ -1151,6 +1163,16 @@ public class EventTypes {
11511163
entityEventDetails.put(EVENT_IMAGE_STORE_DATA_MIGRATE, ImageStore.class);
11521164
entityEventDetails.put(EVENT_IMAGE_STORE_OBJECT_DOWNLOAD, ImageStore.class);
11531165
entityEventDetails.put(EVENT_LIVE_PATCH_SYSTEMVM, "SystemVMs");
1166+
1167+
//Object Store
1168+
entityEventDetails.put(EVENT_OBJECT_STORE_CREATE, ObjectStore.class);
1169+
entityEventDetails.put(EVENT_OBJECT_STORE_UPDATE, ObjectStore.class);
1170+
entityEventDetails.put(EVENT_OBJECT_STORE_DELETE, ObjectStore.class);
1171+
1172+
//Buckets
1173+
entityEventDetails.put(EVENT_BUCKET_CREATE, Bucket.class);
1174+
entityEventDetails.put(EVENT_BUCKET_UPDATE, Bucket.class);
1175+
entityEventDetails.put(EVENT_BUCKET_DELETE, Bucket.class);
11541176
}
11551177

11561178
public static String getEntityForEvent(String eventName) {

api/src/main/java/com/cloud/server/ResourceTag.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ public enum ResourceObjectType {
6969
GuestOs(false, true),
7070
NetworkOffering(false, true),
7171
VpcOffering(true, false),
72-
Domain(false, false, true);
72+
Domain(false, false, true),
73+
ObjectStore(false, false, true);
7374

7475

7576
ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) {

api/src/main/java/com/cloud/storage/DataStoreRole.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import com.cloud.utils.exception.CloudRuntimeException;
2222

2323
public enum DataStoreRole {
24-
Primary("primary"), Image("image"), ImageCache("imagecache"), Backup("backup");
24+
Primary("primary"), Image("image"), ImageCache("imagecache"), Backup("backup"), Object("object");
2525

2626
public boolean isImageStore() {
2727
return (role.equalsIgnoreCase("image") || role.equalsIgnoreCase("imagecache")) ? true : false;
@@ -45,6 +45,8 @@ public static DataStoreRole getRole(String role) {
4545
return ImageCache;
4646
} else if (role.equalsIgnoreCase("backup")) {
4747
return Backup;
48+
} else if (role.equalsIgnoreCase("object")) {
49+
return Object;
4850
} else {
4951
throw new CloudRuntimeException("can't identify the role");
5052
}

api/src/main/java/com/cloud/storage/StorageService.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,23 @@
2424
import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd;
2525
import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
2626
import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd;
27+
import org.apache.cloudstack.api.command.admin.storage.DeleteObjectStoragePoolCmd;
2728
import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd;
2829
import org.apache.cloudstack.api.command.admin.storage.DeleteSecondaryStagingStoreCmd;
2930
import org.apache.cloudstack.api.command.admin.storage.SyncStoragePoolCmd;
31+
import org.apache.cloudstack.api.command.admin.storage.UpdateObjectStoragePoolCmd;
3032
import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd;
3133

3234
import com.cloud.exception.DiscoveryException;
3335
import com.cloud.exception.InsufficientCapacityException;
3436
import com.cloud.exception.InvalidParameterValueException;
3537
import com.cloud.exception.ResourceInUseException;
3638
import com.cloud.exception.ResourceUnavailableException;
39+
import org.apache.cloudstack.api.command.admin.storage.heuristics.CreateSecondaryStorageSelectorCmd;
40+
import org.apache.cloudstack.api.command.admin.storage.heuristics.RemoveSecondaryStorageSelectorCmd;
41+
import org.apache.cloudstack.api.command.admin.storage.heuristics.UpdateSecondaryStorageSelectorCmd;
42+
import org.apache.cloudstack.secstorage.heuristics.Heuristic;
43+
import org.apache.cloudstack.storage.object.ObjectStore;
3744

3845
public interface StorageService {
3946
/**
@@ -109,4 +116,15 @@ public interface StorageService {
109116

110117
StoragePool syncStoragePool(SyncStoragePoolCmd cmd);
111118

119+
Heuristic createSecondaryStorageHeuristic(CreateSecondaryStorageSelectorCmd cmd);
120+
121+
Heuristic updateSecondaryStorageHeuristic(UpdateSecondaryStorageSelectorCmd cmd);
122+
123+
void removeSecondaryStorageHeuristic(RemoveSecondaryStorageSelectorCmd cmd);
124+
125+
ObjectStore discoverObjectStore(String name, String url, String providerName, Map details) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
126+
127+
boolean deleteObjectStore(DeleteObjectStoragePoolCmd cmd);
128+
129+
ObjectStore updateObjectStore(Long id, UpdateObjectStoragePoolCmd cmd);
112130
}

api/src/main/java/org/apache/cloudstack/annotation/AnnotationService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ enum EntityType {
4545
SERVICE_OFFERING(false), DISK_OFFERING(false), NETWORK_OFFERING(false),
4646
ZONE(false), POD(false), CLUSTER(false), HOST(false), DOMAIN(false),
4747
PRIMARY_STORAGE(false), SECONDARY_STORAGE(false), VR(false), SYSTEM_VM(false),
48-
AUTOSCALE_VM_GROUP(true), MANAGEMENT_SERVER(false),;
48+
AUTOSCALE_VM_GROUP(true), MANAGEMENT_SERVER(false), OBJECT_STORAGE(false);
4949

5050
private final boolean usersAllowed;
5151

@@ -78,6 +78,7 @@ static public List<EntityType> getNotAllowedTypesForNonAdmins(RoleType roleType)
7878
list.add(EntityType.VR);
7979
list.add(EntityType.SYSTEM_VM);
8080
list.add(EntityType.MANAGEMENT_SERVER);
81+
list.add(EntityType.OBJECT_STORAGE);
8182
if (roleType != RoleType.DomainAdmin) {
8283
list.add(EntityType.DOMAIN);
8384
list.add(EntityType.SERVICE_OFFERING);

api/src/main/java/org/apache/cloudstack/api/ApiCommandResourceType.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ public enum ApiCommandResourceType {
7878
VmSnapshot(com.cloud.vm.snapshot.VMSnapshot.class),
7979
Role(org.apache.cloudstack.acl.Role.class),
8080
VpnCustomerGateway(com.cloud.network.Site2SiteCustomerGateway.class),
81-
ManagementServer(org.apache.cloudstack.management.ManagementServerHost.class);
81+
ManagementServer(org.apache.cloudstack.management.ManagementServerHost.class),
82+
ObjectStore(org.apache.cloudstack.storage.object.ObjectStore.class),
83+
Bucket(org.apache.cloudstack.storage.object.Bucket.class);
8284

8385
private final Class<?> clazz;
8486

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,10 +1050,20 @@ public class ApiConstants {
10501050
public static final String MTU = "mtu";
10511051
public static final String AUTO_ENABLE_KVM_HOST = "autoenablekvmhost";
10521052
public static final String LIST_APIS = "listApis";
1053+
public static final String OBJECT_STORAGE_ID = "objectstorageid";
1054+
public static final String VERSIONING = "versioning";
1055+
public static final String OBJECT_LOCKING = "objectlocking";
1056+
public static final String ENCRYPTION = "encryption";
1057+
public static final String QUOTA = "quota";
1058+
public static final String ACCESS_KEY = "accesskey";
10531059

10541060
public static final String SOURCE_NAT_IP = "sourcenatipaddress";
10551061
public static final String SOURCE_NAT_IP_ID = "sourcenatipaddressid";
10561062
public static final String HAS_RULES = "hasrules";
1063+
public static final String OBJECT_STORAGE = "objectstore";
1064+
1065+
public static final String HEURISTIC_RULE = "heuristicrule";
1066+
public static final String HEURISTIC_TYPE_VALID_OPTIONS = "Valid options are: ISO, SNAPSHOT, TEMPLATE and VOLUME.";
10571067

10581068
public static final String MANAGEMENT = "management";
10591069
public static final String IS_VNF = "isvnf";

api/src/main/java/org/apache/cloudstack/api/BaseCmd.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerService;
4343
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMService;
4444
import org.apache.cloudstack.query.QueryService;
45+
import org.apache.cloudstack.storage.object.BucketApiService;
4546
import org.apache.cloudstack.storage.ImageStoreService;
4647
import org.apache.cloudstack.storage.template.VnfTemplateManager;
4748
import org.apache.cloudstack.usage.UsageService;
@@ -216,6 +217,9 @@ public static enum CommandType {
216217
public Ipv6Service ipv6Service;
217218
@Inject
218219
public VnfTemplateManager vnfTemplateManager;
220+
@Inject
221+
public BucketApiService _bucketService;
222+
219223

220224
public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
221225
ResourceAllocationException, NetworkRuleConflictException;

api/src/main/java/org/apache/cloudstack/api/ResponseGenerator.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.util.Map;
2323
import java.util.Set;
2424

25+
import org.apache.cloudstack.storage.object.Bucket;
2526
import org.apache.cloudstack.affinity.AffinityGroup;
2627
import org.apache.cloudstack.affinity.AffinityGroupResponse;
2728
import org.apache.cloudstack.api.ApiConstants.HostDetails;
@@ -37,6 +38,7 @@
3738
import org.apache.cloudstack.api.response.BackupOfferingResponse;
3839
import org.apache.cloudstack.api.response.BackupResponse;
3940
import org.apache.cloudstack.api.response.BackupScheduleResponse;
41+
import org.apache.cloudstack.api.response.BucketResponse;
4042
import org.apache.cloudstack.api.response.CapacityResponse;
4143
import org.apache.cloudstack.api.response.ClusterResponse;
4244
import org.apache.cloudstack.api.response.ConditionResponse;
@@ -82,6 +84,7 @@
8284
import org.apache.cloudstack.api.response.NetworkResponse;
8385
import org.apache.cloudstack.api.response.NicResponse;
8486
import org.apache.cloudstack.api.response.NicSecondaryIpResponse;
87+
import org.apache.cloudstack.api.response.ObjectStoreResponse;
8588
import org.apache.cloudstack.api.response.OvsProviderResponse;
8689
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
8790
import org.apache.cloudstack.api.response.PodResponse;
@@ -101,6 +104,7 @@
101104
import org.apache.cloudstack.api.response.RollingMaintenanceResponse;
102105
import org.apache.cloudstack.api.response.RouterHealthCheckResultResponse;
103106
import org.apache.cloudstack.api.response.SSHKeyPairResponse;
107+
import org.apache.cloudstack.api.response.SecondaryStorageHeuristicsResponse;
104108
import org.apache.cloudstack.api.response.SecurityGroupResponse;
105109
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
106110
import org.apache.cloudstack.api.response.ServiceResponse;
@@ -145,6 +149,8 @@
145149
import org.apache.cloudstack.region.PortableIp;
146150
import org.apache.cloudstack.region.PortableIpRange;
147151
import org.apache.cloudstack.region.Region;
152+
import org.apache.cloudstack.secstorage.heuristics.Heuristic;
153+
import org.apache.cloudstack.storage.object.ObjectStore;
148154
import org.apache.cloudstack.usage.Usage;
149155

150156
import com.cloud.capacity.Capacity;
@@ -532,5 +538,11 @@ List<TemplateResponse> createTemplateResponses(ResponseView view, VirtualMachine
532538

533539
FirewallResponse createIpv6FirewallRuleResponse(FirewallRule acl);
534540

541+
SecondaryStorageHeuristicsResponse createSecondaryStorageSelectorResponse(Heuristic heuristic);
542+
535543
IpQuarantineResponse createQuarantinedIpsResponse(PublicIpQuarantine publicIp);
544+
545+
ObjectStoreResponse createObjectStoreResponse(ObjectStore os);
546+
547+
BucketResponse createBucketResponse(Bucket bucket);
536548
}

0 commit comments

Comments
 (0)