CS-14512: fixed deployVm with ipToNetworkList when uuid is used for networkIds

This commit is contained in:
Alena Prokharchyk 2012-04-16 15:42:39 -07:00
parent 03b7db2d99
commit e351182455
4 changed files with 18 additions and 4 deletions

View File

@ -269,4 +269,11 @@ public interface ResponseGenerator {
LDAPConfigResponse createLDAPConfigResponse(String hostname, Integer port, Boolean useSSL, String queryFilter, String baseSearch, String dn);
StorageNetworkIpRangeResponse createStorageNetworkIpRangeResponse(StorageNetworkIpRange result);
/**
* @param tableName TODO
* @param token
* @return
*/
Long getIdentiyId(String tableName, String token);
}

View File

@ -118,7 +118,6 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
@Parameter(name=ApiConstants.SECURITY_GROUP_NAMES, type=CommandType.LIST, collectionType=CommandType.STRING, description="comma separated list of security groups names that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupids parameter")
private List<String> securityGroupNameList;
@IdentityMapper(entityTableName="networks")
@Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, description = "ip to network mapping. Can't be specified with networkIds parameter. Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].networkid=204 - requests to use ip 10.10.10.11 in network id=204")
private Map ipToNetworkList;
@ -250,9 +249,8 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
Iterator iter = ipsCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> ips = (HashMap<String, String>) iter.next();
Long networkId = Long.valueOf(ips.get("networkid"));
Long networkId = Long.valueOf(_responseGenerator.getIdentiyId("networks", ips.get("networkid")));
String requestedIp = (String) ips.get("ip");
ipToNetworkMap.put(networkId, requestedIp);
}
}

View File

@ -397,6 +397,10 @@ public class ApiDispatcher {
}
clazz = clazz.getSuperclass();
} while (clazz != Object.class && clazz != null);
}
public static Long getIdentiyId(String tableName, String token) {
return s_instance._identityDao.getIdentityId(tableName, token);
}
}

View File

@ -3350,6 +3350,11 @@ public class ApiResponseHelper implements ResponseGenerator {
response.setGateway(result.getGateway());
response.setObjectName("storagenetworkiprange");
return response;
}
@Override
public Long getIdentiyId(String tableName, String token) {
return ApiDispatcher.getIdentiyId(tableName, token);
}
}