You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/01/14 19:00:34 UTC
[37/51] git commit: DeployVmCmd: Remove usage of IdentityDao,
use Network to get by id or uuid
DeployVmCmd: Remove usage of IdentityDao, use Network to get by id or uuid
Signed-off-by: Rohit Yadav <bh...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/35544f26
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/35544f26
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/35544f26
Branch: refs/heads/ui-quick-view-v2
Commit: 35544f26e57ec6eaffbc6e87e3536fefbc0dbec0
Parents: 8cdb40a
Author: Rohit Yadav <bh...@apache.org>
Authored: Fri Jan 11 15:29:15 2013 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Fri Jan 11 18:44:20 2013 -0800
----------------------------------------------------------------------
.../api/command/user/vm/DeployVMCmd.java | 17 +++++++++++---
1 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/35544f26/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
index 28bb80f..e675c83 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
@@ -147,10 +147,9 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
private List<String> securityGroupNameList;
@ACL(checkKeyAccess=true)
- @Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, entityType={Network.class,IpAddress.class},
+ @Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, entityType={Network.class, IpAddress.class},
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")
+ " Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].networkid=uuid - requests to use ip 10.10.10.11 in network id=uuid")
private Map ipToNetworkList;
@Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="the ip address for default vm's network")
@@ -284,7 +283,17 @@ 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(_responseGenerator.getIdentiyId("networks", ips.get("networkid")));
+ Long networkId;
+ Network network = _networkService.getNetwork(ips.get("networkid"));
+ if (network != null) {
+ networkId = network.getId();
+ } else {
+ try {
+ networkId = Long.parseLong(ips.get("networkid"));
+ } catch(NumberFormatException e) {
+ throw new InvalidParameterValueException("Unable to translate and find entity with networkId: " + ips.get("networkid"));
+ }
+ }
String requestedIp = (String) ips.get("ip");
ipToNetworkMap.put(networkId, requestedIp);
}