Skip to content

Commit 37fcbca

Browse files
Merge branch 'master' into http_handler
2 parents 6877246 + 597df24 commit 37fcbca

67 files changed

Lines changed: 1519 additions & 400 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.

agent/conf/agent.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,7 @@ hypervisor.type=kvm
176176
# vm.rng.rate.period=1000
177177
# The number of milliseconds in which the guest is allowed to obtain the bytes
178178
# specified above.
179+
180+
# router.aggregation.command.each.timeout=600
181+
# timeout value for aggregation commands send to virtual router
182+
#

agent/conf/cloudstack-agent.logrotate

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
/var/log/cloudstack/agent/cloudstack-agent.out
19-
/var/log/cloudstack/agent/cloudstack-agent.err
18+
@AGENTLOG@
19+
/var/log/cloudstack/agent/security_group.log
2020
{
2121
copytruncate
2222
daily

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

Lines changed: 102 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@
1616
// under the License.
1717
package com.cloud.network;
1818

19-
import java.util.List;
20-
19+
import com.cloud.exception.CloudException;
20+
import com.cloud.utils.Pair;
21+
import com.cloud.utils.StringUtils;
2122
import org.apache.cloudstack.api.Identity;
2223
import org.apache.cloudstack.api.InternalIdentity;
2324

24-
import com.cloud.utils.Pair;
25+
import java.util.HashSet;
26+
import java.util.List;
27+
import java.util.Objects;
28+
import java.util.Set;
2529

2630
/**
2731
*
@@ -32,8 +36,101 @@ public enum State {
3236
Disabled, Enabled;
3337
}
3438

35-
public enum IsolationMethod {
36-
VLAN, L3, GRE, STT, BCF_SEGMENT, MIDO, SSP, VXLAN, ODL, L3VPN, VSP, VCS;
39+
public class IsolationMethod {
40+
protected static final String UNKNOWN_PROVIDER = "Unknown";
41+
static Set<IsolationMethod> registeredIsolationMethods = new HashSet<>();
42+
43+
String methodPrefix;
44+
String provider;
45+
46+
public IsolationMethod(String prfx) {
47+
this(prfx, UNKNOWN_PROVIDER);
48+
}
49+
50+
public IsolationMethod(String prfx, String prvdr) {
51+
methodPrefix = prfx;
52+
provider = StringUtils.isNotBlank(prvdr)? prvdr : UNKNOWN_PROVIDER;
53+
registeredIsolationMethods.add(this);
54+
}
55+
56+
/**
57+
* gets a IsolationMethod object that defines this prefix and if any it returns the first one found that has a known provider. If none has a known provider
58+
* it will return the one with the unknown provider. if none is found it return null.
59+
*
60+
* @param prfx
61+
* @return
62+
*/
63+
public static IsolationMethod getIsolationMethod(String prfx) throws IsolationMethodNotRegistered {
64+
IsolationMethod rc = null;
65+
for (IsolationMethod method: registeredIsolationMethods) {
66+
if (method.methodPrefix.equals(prfx)) {
67+
rc = method;
68+
if(! rc.getProvider().equals(UNKNOWN_PROVIDER)) {
69+
break;
70+
}
71+
}
72+
}
73+
if (rc == null) {
74+
throw new IsolationMethodNotRegistered("No registration of prefix '" + prfx + "' found.");
75+
}
76+
return rc;
77+
}
78+
79+
public static IsolationMethod getIsolationMethod(String prfx, String provider) throws IsolationMethodNotRegistered {
80+
for (IsolationMethod method: registeredIsolationMethods) {
81+
if (method.methodPrefix.equals(prfx) && method.provider.equals(provider)) {
82+
return method;
83+
}
84+
}
85+
throw new IsolationMethodNotRegistered("No registration of prefix '" + prfx + "' for provider '" + provider + "' found.");
86+
}
87+
88+
static class IsolationMethodNotRegistered extends CloudException {
89+
IsolationMethodNotRegistered (String message) {
90+
super(message);
91+
}
92+
}
93+
94+
public String getMethodPrefix() {
95+
return methodPrefix;
96+
}
97+
98+
public String getProvider() {
99+
return provider;
100+
}
101+
102+
@Override
103+
public boolean equals(Object o) {
104+
if (this == o)
105+
return true;
106+
if (o == null || getClass() != o.getClass())
107+
return false;
108+
IsolationMethod that = (IsolationMethod)o;
109+
return Objects.equals(methodPrefix, that.methodPrefix) && Objects.equals(provider, that.provider);
110+
}
111+
112+
@Override
113+
public int hashCode() {
114+
return Objects.hash(methodPrefix, provider);
115+
}
116+
117+
@Override
118+
public String toString() {
119+
return methodPrefix;
120+
}
121+
122+
public static boolean remove(String prfx, String prvdr) {
123+
prvdr = StringUtils.isNotBlank(prvdr)? prvdr : UNKNOWN_PROVIDER;
124+
125+
try {
126+
return remove(getIsolationMethod(prfx, prvdr));
127+
} catch (IsolationMethodNotRegistered isolationMethodNotRegistered) {
128+
return false;
129+
}
130+
}
131+
public static boolean remove(IsolationMethod method) {
132+
return registeredIsolationMethods.remove(method);
133+
}
37134
}
38135

39136
public enum BroadcastDomainRange {

api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public long getEntityOwnerId() {
184184
@Override
185185
public void execute() {
186186
validateParams();
187-
CallContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getDomainId());
187+
CallContext.current().setEventDetails("Account Name: " + getUsername() + ", Domain Id:" + getDomainId());
188188
UserAccount userAccount =
189189
_accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(), getRoleId(),
190190
getDomainId(), getNetworkDomain(), getDetails(), getAccountUUID(), getUserUUID());

api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/ChangeOutOfBandManagementPasswordCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE
7474
CallContext.current().setEventDetails("Host Id: " + host.getId() + " Password: " + getPassword().charAt(0) + "****");
7575
CallContext.current().putContextParameter(Host.class, host.getUuid());
7676

77-
final OutOfBandManagementResponse response = outOfBandManagementService.changeOutOfBandManagementPassword(host, getPassword());
77+
final OutOfBandManagementResponse response = outOfBandManagementService.changePassword(host, getPassword());
7878
response.setResponseName(getCommandName());
7979
setResponseObject(response);
8080
}

api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/ConfigureOutOfBandManagementCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE
8383
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find host by ID: " + getHostId());
8484
}
8585
CallContext.current().putContextParameter(Host.class, host.getUuid());
86-
final OutOfBandManagementResponse response = outOfBandManagementService.configureOutOfBandManagement(host, getHostPMOptions());
86+
final OutOfBandManagementResponse response = outOfBandManagementService.configure(host, getHostPMOptions());
8787
response.setId(host.getUuid());
8888
response.setResponseName(getCommandName());
8989
setResponseObject(response);

api/src/org/apache/cloudstack/api/command/admin/outofbandmanagement/IssueOutOfBandManagementPowerActionCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE
8080
CallContext.current().setEventDetails("Host Id: " + host.getId() + " Action: " + powerOperation.toString());
8181
CallContext.current().putContextParameter(Host.class, host.getUuid());
8282

83-
final OutOfBandManagementResponse response = outOfBandManagementService.executeOutOfBandManagementPowerOperation(host, powerOperation, getActionTimeout());
83+
final OutOfBandManagementResponse response = outOfBandManagementService.executePowerOperation(host, powerOperation, getActionTimeout());
8484
response.setResponseName(getCommandName());
8585
setResponseObject(response);
8686
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
import com.cloud.projects.Project;
5858
import com.cloud.user.Account;
5959

60-
@APICommand(name = "associateIpAddress", description = "Acquires and associates a public IP to an account.", responseObject = IPAddressResponse.class, responseView = ResponseView.Restricted,
60+
@APICommand(name = "associateIpAddress", description = "Acquires and associates a public IP to an account. Either of the parameters are required, i.e. either zoneId, or networkId, or vpcId ", responseObject = IPAddressResponse.class, responseView = ResponseView.Restricted,
6161
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
6262
public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
6363
public static final Logger s_logger = Logger.getLogger(AssociateIPAddrCmd.class.getName());

api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ public Long getId() {
9292
}
9393

9494
public List<Long> getAffinityGroupIdList() {
95-
if (affinityGroupNameList != null && affinityGroupIdList != null) {
96-
throw new InvalidParameterValueException("affinitygroupids parameter is mutually exclusive with affinitygroupnames parameter");
97-
}
98-
9995
// transform group names to ids here
10096
if (affinityGroupNameList != null) {
10197
List<Long> affinityGroupIds = new ArrayList<Long>();
@@ -138,6 +134,14 @@ public long getEntityOwnerId() {
138134

139135
@Override
140136
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException {
137+
if (affinityGroupNameList != null && affinityGroupIdList != null) {
138+
throw new InvalidParameterValueException("affinitygroupids parameter is mutually exclusive with affinitygroupnames parameter");
139+
}
140+
141+
if (affinityGroupNameList == null && affinityGroupIdList == null) {
142+
throw new InvalidParameterValueException("affinitygroupids parameter or affinitygroupnames parameter must be given");
143+
}
144+
141145
CallContext.current().setEventDetails("VM ID: " + getId());
142146
UserVm result = _affinityGroupService.updateVMAffinityGroups(getId(), getAffinityGroupIdList());
143147
ArrayList<VMDetails> dc = new ArrayList<VMDetails>();

api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,16 @@
1616
// under the License.
1717
package org.apache.cloudstack.api.response;
1818

19-
import java.util.Date;
20-
import java.util.Map;
21-
19+
import com.cloud.serializer.Param;
20+
import com.cloud.storage.StoragePool;
21+
import com.cloud.storage.StoragePoolStatus;
2222
import com.google.gson.annotations.SerializedName;
23-
2423
import org.apache.cloudstack.api.ApiConstants;
2524
import org.apache.cloudstack.api.BaseResponse;
2625
import org.apache.cloudstack.api.EntityReference;
2726

28-
import com.cloud.serializer.Param;
29-
import com.cloud.storage.StoragePool;
30-
import com.cloud.storage.StoragePoolStatus;
27+
import java.util.Date;
28+
import java.util.Map;
3129

3230
@EntityReference(value = StoragePool.class)
3331
public class StoragePoolResponse extends BaseResponse {
@@ -119,6 +117,10 @@ public class StoragePoolResponse extends BaseResponse {
119117
@Param(description = "true if this pool is suitable to migrate a volume," + " false otherwise")
120118
private Boolean suitableForMigration;
121119

120+
@SerializedName("provider")
121+
@Param(description = "Storage provider for this pool")
122+
private String provider;
123+
122124
@SerializedName(ApiConstants.STORAGE_CAPABILITIES)
123125
@Param(description = "the storage pool capabilities")
124126
private Map<String, String> caps;
@@ -317,4 +319,12 @@ public String getOverProvisionFactor() {
317319
public Boolean getSuitableForMigration() {
318320
return suitableForMigration;
319321
}
322+
323+
public String getProvider() {
324+
return provider;
325+
}
326+
327+
public void setProvider(String provider) {
328+
this.provider = provider;
329+
}
320330
}

0 commit comments

Comments
 (0)