Skip to content

Commit

Permalink
Revert "Merge branch '4.18'"
Browse files Browse the repository at this point in the history
This reverts commit ea832bc, reversing
changes made to 0bd7462.
  • Loading branch information
DaanHoogland committed Aug 24, 2023
1 parent 7cdf864 commit 20d84f2
Show file tree
Hide file tree
Showing 69 changed files with 229 additions and 1,303 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ public interface AutoScaleVmProfile extends ControlledEntity, InternalIdentity,

String getUserData();

Long getUserDataId();

String getUserDataDetails();

public String getUuid();

public Long getZoneId();
Expand Down
17 changes: 0 additions & 17 deletions api/src/main/java/org/apache/cloudstack/api/BaseCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
Expand All @@ -44,7 +42,6 @@
import org.apache.cloudstack.query.QueryService;
import org.apache.cloudstack.storage.ImageStoreService;
import org.apache.cloudstack.usage.UsageService;
import org.apache.commons.collections.MapUtils;
import org.apache.log4j.Logger;

import com.cloud.configuration.ConfigurationService;
Expand Down Expand Up @@ -459,18 +456,4 @@ public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.None;
}

public Map<String, String> convertDetailsToMap(Map details) {
Map<String, String> detailsMap = new HashMap<String, String>();
if (MapUtils.isNotEmpty(details)) {
Collection parameterCollection = details.values();
Iterator iter = parameterCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> value = (HashMap<String, String>)iter.next();
for (Map.Entry<String,String> entry: value.entrySet()) {
detailsMap.put(entry.getKey(),entry.getValue());
}
}
}
return detailsMap;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class StopInternalLBVMCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the internal lb vm")
private Long id;

@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM (vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted). To be used if the caller knows the VM is stopped and should be marked as such.")
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM. The caller knows the VM is stopped.")
private Boolean forced;

// ///////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class StopRouterCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the router")
private Long id;

@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM (vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted). To be used if the caller knows the VM is stopped and should be marked as such.")
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM. The caller knows the VM is stopped.")
private Boolean forced;

// ///////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class StopSystemVmCmd extends BaseAsyncCmd {
description = "The ID of the system virtual machine")
private Long id;

@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM (vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted). To be used if the caller knows the VM is stopped and should be marked as such.")
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM. The caller knows the VM is stopped.")
private Boolean forced;

/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.UserDataResponse;
import org.apache.cloudstack.api.response.UserResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.context.CallContext;
Expand Down Expand Up @@ -108,12 +107,6 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd {
since = "4.18.0")
private String userData;

@Parameter(name = ApiConstants.USER_DATA_ID, type = CommandType.UUID, entityType = UserDataResponse.class, description = "the ID of the Userdata", since = "4.18.1")
private Long userDataId;

@Parameter(name = ApiConstants.USER_DATA_DETAILS, type = CommandType.MAP, description = "used to specify the parameters values for the variables in userdata.", since = "4.18.1")
private Map userDataDetails;

@Parameter(name = ApiConstants.AUTOSCALE_USER_ID,
type = CommandType.UUID,
entityType = UserResponse.class,
Expand Down Expand Up @@ -170,14 +163,6 @@ public String getUserData() {
return userData;
}

public Long getUserDataId() {
return userDataId;
}

public Map<String, String> getUserDataDetails() {
return convertDetailsToMap(userDataDetails);
}

public Long getAutoscaleUserId() {
return autoscaleUserId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.UserDataResponse;
import org.apache.cloudstack.api.response.UserResponse;
import org.apache.cloudstack.context.CallContext;

Expand Down Expand Up @@ -103,14 +102,6 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCustomIdCmd {
since = "4.18.0")
private String userData;

@Parameter(name = ApiConstants.USER_DATA_ID, type = CommandType.UUID, entityType = UserDataResponse.class, description = "the ID of the userdata",
since = "4.18.1")
private Long userDataId;

@Parameter(name = ApiConstants.USER_DATA_DETAILS, type = CommandType.MAP, description = "used to specify the parameters values for the variables in userdata.",
since = "4.18.1")
private Map userDataDetails;

@Parameter(name = ApiConstants.AUTOSCALE_USER_ID,
type = CommandType.UUID,
entityType = UserResponse.class,
Expand Down Expand Up @@ -165,14 +156,6 @@ public String getUserData() {
return userData;
}

public Long getUserDataId() {
return userDataId;
}

public Map<String, String> getUserDataDetails() {
return convertDetailsToMap(userDataDetails);
}

public Long getAutoscaleUserId() {
return autoscaleUserId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ public class CreateNetworkCmd extends BaseCmd implements UserCmd {
private Long projectId;

@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "domain ID of the account owning a network. " +
"If the account is not specified, but the acltype is Account or not specified, the network will be automatically assigned to the caller account and domain. " +
"To create a network under the domain without linking it to any account, make sure to include acltype=Domain parameter in the api call. " +
"If account is not specified, but acltype is Domain, the network will be created for the specified domain.")
"If no account is provided then network will be assigned to the caller account and domain")
private Long domainId;

@Parameter(name = ApiConstants.SUBDOMAIN_ACCESS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
@Parameter(name = ApiConstants.DOMAIN_ID,
type = CommandType.UUID,
entityType = DomainResponse.class,
description = "The domain ID of the snapshot. If used with the account parameter, specifies a domain for the account associated with the disk volume. If account is NOT provided then snapshot will be assigned to the caller account and domain.")
description = "The domain ID of the snapshot. If used with the account parameter, specifies a domain for the account associated with the disk volume.")
private Long domainId;

@Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "The ID of the disk volume")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd implements SecurityG
@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the virtual machine. Must be used with domainId.")
private String accountName;

@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used. If account is NOT provided then virtual machine will be assigned to the caller account and domain.")
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.")
private Long domainId;

//Network information
Expand Down Expand Up @@ -317,8 +317,17 @@ public ApiConstants.BootType getBootType() {
}

public Map<String, String> getDetails() {
Map<String, String> customparameterMap = convertDetailsToMap(details);

Map<String, String> customparameterMap = new HashMap<String, String>();
if (details != null && details.size() != 0) {
Collection parameterCollection = details.values();
Iterator iter = parameterCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> value = (HashMap<String, String>)iter.next();
for (Map.Entry<String,String> entry: value.entrySet()) {
customparameterMap.put(entry.getKey(),entry.getValue());
}
}
}
if (getBootType() != null) {
customparameterMap.put(getBootType().toString(), getBootMode().toString());
}
Expand Down Expand Up @@ -457,7 +466,18 @@ public Long getUserdataId() {
}

public Map<String, String> getUserdataDetails() {
return convertDetailsToMap(userdataDetails);
Map<String, String> userdataDetailsMap = new HashMap<String, String>();
if (userdataDetails != null && userdataDetails.size() != 0) {
Collection parameterCollection = userdataDetails.values();
Iterator iter = parameterCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> value = (HashMap<String, String>)iter.next();
for (Map.Entry<String,String> entry: value.entrySet()) {
userdataDetailsMap.put(entry.getKey(),entry.getValue());
}
}
}
return userdataDetailsMap;
}

public Long getZoneId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

@APICommand(name = "resetUserDataForVirtualMachine", responseObject = UserVmResponse.class, description = "Resets the UserData for virtual machine. " +
Expand Down Expand Up @@ -114,7 +117,18 @@ public Long getUserdataId() {
}

public Map<String, String> getUserdataDetails() {
return convertDetailsToMap(userdataDetails);
Map<String, String> userdataDetailsMap = new HashMap<String, String>();
if (userdataDetails != null && userdataDetails.size() != 0) {
Collection parameterCollection = userdataDetails.values();
Iterator iter = parameterCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> value = (HashMap<String, String>)iter.next();
for (Map.Entry<String,String> entry: value.entrySet()) {
userdataDetailsMap.put(entry.getKey(),entry.getValue());
}
}
}
return userdataDetailsMap;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;

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

Expand Down Expand Up @@ -96,7 +99,17 @@ public Long getServiceOfferingId() {
//it is because details.values() cannot be cast to a map.
//it gives a exception
public Map<String, String> getDetails() {
Map<String, String> customparameterMap = convertDetailsToMap(details);
Map<String, String> customparameterMap = new HashMap<String, String>();
if (details != null && details.size() != 0) {
Collection parameterCollection = details.values();
Iterator iter = parameterCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> value = (HashMap<String, String>)iter.next();
for (String key : value.keySet()) {
customparameterMap.put(key, value.get(key));
}
}
}

if (shrinkOk != null) customparameterMap.put(ApiConstants.SHRINK_OK, String.valueOf(isShrinkOk()));
if (autoMigrate != null) customparameterMap.put(ApiConstants.AUTO_MIGRATE, String.valueOf(getAutoMigrate()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public class StopVMCmd extends BaseAsyncCmd implements UserCmd {
private Long id;

@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM "
+ "(vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted)."
+ " This option is to be used if the caller knows the VM is stopped and should be marked as such.")
+ "(vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted). The caller knows the VM is stopped.")
private Boolean forced;

// ///////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

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

Expand Down Expand Up @@ -175,7 +176,18 @@ public Long getUserdataId() {
}

public Map<String, String> getUserdataDetails() {
return convertDetailsToMap(userdataDetails);
Map<String, String> userdataDetailsMap = new HashMap<String, String>();
if (userdataDetails != null && userdataDetails.size() != 0) {
Collection parameterCollection = userdataDetails.values();
Iterator iter = parameterCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> value = (HashMap<String, String>)iter.next();
for (Map.Entry<String,String> entry: value.entrySet()) {
userdataDetailsMap.put(entry.getKey(),entry.getValue());
}
}
}
return userdataDetailsMap;
}

public Boolean getDisplayVm() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import org.apache.log4j.Logger;
Expand Down Expand Up @@ -92,7 +95,17 @@ public Long getServiceOfferingId() {
}

public Map<String, String> getDetails() {
Map<String, String> customparameterMap = convertDetailsToMap(details);
Map<String, String> customparameterMap = new HashMap<String, String>();
if (details != null && details.size() != 0) {
Collection parameterCollection = details.values();
Iterator iter = parameterCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> value = (HashMap<String, String>)iter.next();
for (String key : value.keySet()) {
customparameterMap.put(key, value.get(key));
}
}
}

if (shrinkOk != null) customparameterMap.put(ApiConstants.SHRINK_OK, String.valueOf(isShrinkOk()));
if (autoMigrate != null) customparameterMap.put(ApiConstants.AUTO_MIGRATE, String.valueOf(getAutoMigrate()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd implements UserC
type = CommandType.UUID,
entityType = DomainResponse.class,
description = "the domain ID associated with the disk offering. If used with the account parameter"
+ " returns the disk volume associated with the account for the specified domain." +
"If account is NOT provided then the volume will be assigned to the caller account and domain.")
+ " returns the disk volume associated with the account for the specified domain.")
private Long domainId;

@Parameter(name = ApiConstants.DISK_OFFERING_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class UploadVolumeCmd extends BaseAsyncCmd implements UserCmd {
@Parameter(name = ApiConstants.DOMAIN_ID,
type = CommandType.UUID,
entityType = DomainResponse.class,
description = "an optional domainId. If the account parameter is used, domainId must also be used. If account is NOT provided then volume will be assigned to the caller account and domain.")
description = "an optional domainId. If the account parameter is used, domainId must also be used.")
private Long domainId;

@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional accountName. Must be used with domainId.")
Expand Down
Loading

0 comments on commit 20d84f2

Please sign in to comment.