@@ -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 }
0 commit comments