Skip to content

Commit 38eaa04

Browse files
committed
Pull changes from master into javelin
- Disables simulator plugin, breaks build, available via simulator profile - Fixes spring injections - Fix api,acl plugins, ApiServer, ApiDispatcher - Fix other merge conflicts Conflicts: docs/en-US/external-firewalls-and-load-balancers.xml plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java server/src/com/cloud/api/ApiDispatcher.java server/src/com/cloud/api/ApiServer.java server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java utils/test/com/cloud/utils/log/CglibThrowableRendererTest.java Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2 parents fdc9103 + ad063ed commit 38eaa04

40 files changed

Lines changed: 898 additions & 230 deletions

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ boolean restartNetwork(RestartNetworkCmd cmd, boolean cleanup) throws Concurrent
6060

6161
Network getNetwork(long networkId);
6262

63+
Network getNetwork(String networkUuid);
64+
6365
IpAddress getIp(long id);
6466

6567
NetworkProfile convertNetworkToNetworkProfile(long networkId);

api/src/com/cloud/user/DomainService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public interface DomainService {
3030

3131
Domain getDomain(long id);
3232

33+
Domain getDomain(String uuid);
34+
3335
/**
3436
* Return whether a domain is a child domain of a given domain.
3537
*

api/src/org/apache/cloudstack/acl/APIAccessChecker.java renamed to api/src/org/apache/cloudstack/acl/APIChecker.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@
1616
// under the License.
1717
package org.apache.cloudstack.acl;
1818

19-
import org.apache.cloudstack.acl.RoleType;
2019
import com.cloud.exception.PermissionDeniedException;
20+
import org.apache.cloudstack.acl.RoleType;
2121
import com.cloud.utils.component.Adapter;
2222

23-
/**
24-
* APIAccessChecker checks the ownership and access control to API requests
25-
*/
26-
public interface APIAccessChecker extends Adapter {
27-
// Interface for checking access to an API for an user
28-
boolean canAccessAPI(RoleType roleType, String apiCommandName) throws PermissionDeniedException;
23+
// APIChecker checks the ownership and access control to API requests
24+
public interface APIChecker extends Adapter {
25+
// Interface for checking access for a role using apiname
26+
boolean checkAccess(RoleType roleType, String apiCommandName) throws PermissionDeniedException;
2927
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ public class ApiConstants {
158158
public static final String RECEIVED_BYTES = "receivedbytes";
159159
public static final String REQUIRES_HVM = "requireshvm";
160160
public static final String RESOURCE_TYPE = "resourcetype";
161+
public static final String RESPONSE = "response";
161162
public static final String QUERY_FILTER = "queryfilter";
162163
public static final String SCHEDULE = "schedule";
163164
public static final String SCOPE = "scope";

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,6 @@ public interface ResponseGenerator {
314314

315315
StorageNetworkIpRangeResponse createStorageNetworkIpRangeResponse(StorageNetworkIpRange result);
316316

317-
/**
318-
* @param tableName TODO
319-
* @param token
320-
* @return
321-
*/
322-
Long getIdentiyId(String tableName, String token);
323-
324317
/**
325318
* @param resourceTag
326319
* @param keyValueOnly TODO

api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,9 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
147147
private List<String> securityGroupNameList;
148148

149149
@ACL(checkKeyAccess=true)
150-
@Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, entityType={Network.class,IpAddress.class},
150+
@Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, entityType={Network.class, IpAddress.class},
151151
description = "ip to network mapping. Can't be specified with networkIds parameter." +
152-
" Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].networkid=204 - requests to" +
153-
" use ip 10.10.10.11 in network id=204")
152+
" Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].networkid=uuid - requests to use ip 10.10.10.11 in network id=uuid")
154153
private Map ipToNetworkList;
155154

156155
@Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="the ip address for default vm's network")
@@ -284,7 +283,17 @@ private Map<Long, String> getIpToNetworkMap() {
284283
Iterator iter = ipsCollection.iterator();
285284
while (iter.hasNext()) {
286285
HashMap<String, String> ips = (HashMap<String, String>) iter.next();
287-
Long networkId = Long.valueOf(_responseGenerator.getIdentiyId("networks", ips.get("networkid")));
286+
Long networkId;
287+
Network network = _networkService.getNetwork(ips.get("networkid"));
288+
if (network != null) {
289+
networkId = network.getId();
290+
} else {
291+
try {
292+
networkId = Long.parseLong(ips.get("networkid"));
293+
} catch(NumberFormatException e) {
294+
throw new InvalidParameterValueException("Unable to translate and find entity with networkId: " + ips.get("networkid"));
295+
}
296+
}
288297
String requestedIp = (String) ips.get("ip");
289298
ipToNetworkMap.put(networkId, requestedIp);
290299
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public void execute(){
137137
Volume vol = _entityMgr.findById(Volume.class, id);
138138
response.setId(vol.getUuid());
139139
response.setName(vol.getName());
140-
DataCenter zone = _entityMgr.findById(DataCenter.class, id);
140+
DataCenter zone = _entityMgr.findById(DataCenter.class, zoneId);
141141
response.setZoneId(zone.getUuid());
142142
response.setZoneName(zone.getName());
143143
response.setMode(mode);

client/tomcatconf/componentContext.xml.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
<!--
1717
Configurable components
1818
-->
19-
<bean id="ManagementServerExtImpl" class ="com.cloud.server.ManagementServerExtImpl" />
20-
19+
<bean id="management-server" class ="com.cloud.server.ManagementServerExtImpl" />
20+
<bean id="configuration-server" class="com.cloud.server.ConfigurationServerImpl" />
2121

2222
<!--
2323
Network Elements

client/tomcatconf/components.xml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ under the License.
5353
<dao name="Configuration configuration server" class="com.cloud.configuration.dao.ConfigurationDaoImpl">
5454
<param name="premium">true</param>
5555
</dao>
56-
<adapters key="org.apache.cloudstack.acl.APIAccessChecker">
56+
<adapters key="org.apache.cloudstack.acl.APIChecker">
5757
<adapter name="StaticRoleBasedAPIAccessChecker" class="org.apache.cloudstack.acl.StaticRoleBasedAPIAccessChecker"/>
5858
</adapters>
5959
<adapters key="com.cloud.agent.manager.allocator.HostAllocator">

0 commit comments

Comments
 (0)