Skip to content

Commit 262352a

Browse files
committed
Another merge from master to bring over fixes to bugs that broke the bvt
2 parents cbca4bb + 6ea38bf commit 262352a

99 files changed

Lines changed: 6257 additions & 970 deletions

File tree

Some content is hidden

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

api/src/com/cloud/network/PhysicalNetwork.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public enum IsolationMethod {
3939
GRE,
4040
STT,
4141
VNS,
42-
MIDO;
42+
MIDO,
43+
SSP;
4344
}
4445

4546
public enum BroadcastDomainRange {

api/src/com/cloud/storage/Storage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public static enum FileSystem {
8585
}
8686

8787
public static enum TemplateType {
88+
ROUTING, // Router template
8889
SYSTEM, /* routing, system vm template */
8990
BUILTIN, /* buildin template */
9091
PERHOST, /* every host has this template, don't need to install it in secondary storage */

api/src/com/cloud/vm/VmDiskStats.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
public interface VmDiskStats {
2020
// vm related disk stats
2121

22-
public Long getIORead();
22+
public long getIORead();
2323

24-
public Long getIOWrite();
24+
public long getIOWrite();
2525

26-
public Long getBytesRead();
26+
public long getBytesRead();
2727

28-
public Long getBytesWrite();
28+
public long getBytesWrite();
2929

3030
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ public class ApiConstants {
511511
public static final String ACL_ID = "aclid";
512512
public static final String NUMBER = "number";
513513
public static final String IS_DYNAMICALLY_SCALABLE = "isdynamicallyscalable";
514+
public static final String ROUTING = "isrouting";
514515

515516
public enum HostDetails {
516517
all, capacity, events, stats, min;

api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
5858
@Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, description = "true if template/ISO contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
5959
private Boolean isDynamicallyScalable;
6060

61+
@Parameter(name = ApiConstants.ROUTING, type = CommandType.BOOLEAN, description = "true if the template type is routing i.e., if template is used to deploy router")
62+
protected Boolean isRoutingType;
63+
6164
/////////////////////////////////////////////////////
6265
/////////////////// Accessors ///////////////////////
6366
/////////////////////////////////////////////////////
@@ -97,4 +100,8 @@ public Integer getSortKey() {
97100
public Boolean isDynamicallyScalable() {
98101
return isDynamicallyScalable;
99102
}
103+
104+
public Boolean isRoutingType() {
105+
return isRoutingType;
106+
}
100107
}

api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@
4545
import com.cloud.exception.InsufficientAddressCapacityException;
4646
import com.cloud.exception.InsufficientCapacityException;
4747
import com.cloud.exception.InvalidParameterValueException;
48+
import com.cloud.exception.PermissionDeniedException;
4849
import com.cloud.exception.ResourceAllocationException;
4950
import com.cloud.exception.ResourceUnavailableException;
5051
import com.cloud.network.IpAddress;
5152
import com.cloud.network.Network;
5253
import com.cloud.network.vpc.Vpc;
54+
import com.cloud.projects.Project;
5355
import com.cloud.user.Account;
5456

5557
@APICommand(name = "associateIpAddress", description="Acquires and associates a public IP to an account.", responseObject=IPAddressResponse.class)
@@ -195,6 +197,18 @@ public long getEntityOwnerId() {
195197
if (accountName != null && domainId != null) {
196198
Account account = _accountService.finalizeOwner(caller, accountName, domainId, projectId);
197199
return account.getId();
200+
} else if (projectId != null) {
201+
Project project = _projectService.getProject(projectId);
202+
if (project != null) {
203+
if (project.getState() == Project.State.Active) {
204+
return project.getProjectAccountId();
205+
} else {
206+
throw new PermissionDeniedException("Can't add resources to the project with specified projectId in state="
207+
+ project.getState() + " as it's no longer active");
208+
}
209+
} else {
210+
throw new InvalidParameterValueException("Unable to find project by id");
211+
}
198212
} else if (networkId != null){
199213
Network network = _networkService.getNetwork(networkId);
200214
return network.getAccountId();

api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ public class RegisterTemplateCmd extends BaseCmd {
118118
@Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, description = "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
119119
protected Boolean isDynamicallyScalable;
120120

121+
@Parameter(name = ApiConstants.ROUTING, type = CommandType.BOOLEAN, description = "true if the template type is routing i.e., if template is used to deploy router")
122+
protected Boolean isRoutingType;
123+
121124
/////////////////////////////////////////////////////
122125
/////////////////// Accessors ///////////////////////
123126
/////////////////////////////////////////////////////
@@ -209,6 +212,10 @@ public Boolean isDynamicallyScalable() {
209212
return isDynamicallyScalable == null ? false : isDynamicallyScalable;
210213
}
211214

215+
public Boolean isRoutingType() {
216+
return isRoutingType == null ? false : isRoutingType;
217+
}
218+
212219
/////////////////////////////////////////////////////
213220
/////////////// API Implementation///////////////////
214221
/////////////////////////////////////////////////////

api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public void execute(){
7171
if (result != null) {
7272
TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(result);
7373
response.setObjectName("template");
74+
response.setTemplateType(result.getTemplateType().toString());//Template can be either USER or ROUTING type
7475
response.setResponseName(getCommandName());
7576
this.setResponseObject(response);
7677
} else {

api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
8080
@Parameter(name=ApiConstants.DISPLAY_VOLUME, type=CommandType.BOOLEAN, description="an optional field, whether to display the volume to the end user or not.")
8181
private Boolean displayVolume;
8282

83-
/////////////////////////////////////////////////////
83+
/////////////////////////////////////////////////////
8484
/////////////////// Accessors ///////////////////////
8585
/////////////////////////////////////////////////////
8686

@@ -118,7 +118,7 @@ private Long getProjectId() {
118118
}
119119

120120
public Boolean getDisplayVolume() {
121-
return displayVolume != null ? displayVolume : Boolean.TRUE;
121+
return displayVolume;
122122
}
123123

124124
/////////////////////////////////////////////////////
@@ -133,6 +133,7 @@ public static String getResultObjectName() {
133133
return "volume";
134134
}
135135

136+
@Override
136137
public ApiCommandJobType getInstanceType() {
137138
return ApiCommandJobType.Volume;
138139
}
@@ -160,10 +161,10 @@ public String getEventDescription() {
160161
@Override
161162
public void create() throws ResourceAllocationException{
162163

163-
Volume volume = this._volumeService.allocVolume(this);
164+
Volume volume = _volumeService.allocVolume(this);
164165
if (volume != null) {
165-
this.setEntityId(volume.getId());
166-
this.setEntityUuid(volume.getUuid());
166+
setEntityId(volume.getId());
167+
setEntityUuid(volume.getUuid());
167168
} else {
168169
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create volume");
169170
}
@@ -189,7 +190,7 @@ public void execute(){
189190
}
190191
}
191192
response.setResponseName(getCommandName());
192-
this.setResponseObject(response);
193+
setResponseObject(response);
193194
} else {
194195
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a volume");
195196
}

0 commit comments

Comments
 (0)