//listVPCs without account/domainid/listAll parameter will return only VPCs belonging to the current login. That's what should happen in Instances page's VM Wizard.
//i.e. If the current login is root-admin, do not show VPCs belonging to regular-user/domain-admin in Instances page's VM Wizard.
if(typeof(args.data["affinity-groups"])=="object"&&args.data["affinity-groups"].length!=null){//args.data["affinity-groups"] is an array of string, e.g. ["2375f8cc-8a73-4b8d-9b26-50885a25ffe0", "27c60d2a-de7f-4bb7-96e5-a602cec681df","c6301d77-99b5-4e8a-85e2-3ea2ab31c342"],
}elseif(typeof(args.data["affinity-groups"])=="string"&&args.data["affinity-groups"].length>0){//args.data["affinity-groups"] is a string, e.g. "2375f8cc-8a73-4b8d-9b26-50885a25ffe0"
vardefaultNetworkId=args.data.defaultNetwork;//args.data.defaultNetwork might be equal to string "new-network" or a network ID
varcheckedNetworkIdArray;
if(typeof(args.data["my-networks"])=="object"&&args.data["my-networks"].length!=null){//args.data["my-networks"] is an array of string, e.g. ["203", "202"],
checkedNetworkIdArray=args.data["my-networks"];
}elseif(typeof(args.data["my-networks"])=="string"&&args.data["my-networks"].length>0){//args.data["my-networks"] is a string, e.g. "202"
varerrorMsg="Failed to create new network, unable to proceed to deploy VM. Error: "+parseXMLHttpResponse(XMLHttpResponse);
//alert(errorMsg);
args.response.error(errorMsg);//args.response.error(errorMsg) here doesn't show errorMsg. Waiting for Brian to fix it. use alert(errorMsg) to show errorMsg for now.
}
});
if(isCreateNetworkSuccessful==false)
return;
}
//create new network ends here
if(defaultNetworkId==null){
cloudStack.dialog.notice({
message: "Please select a default network in Network step."
if(typeof(args.data["security-groups"])=="object"&&args.data["security-groups"].length!=null){//args.data["security-groups"] is an array of string, e.g. ["2375f8cc-8a73-4b8d-9b26-50885a25ffe0", "27c60d2a-de7f-4bb7-96e5-a602cec681df","c6301d77-99b5-4e8a-85e2-3ea2ab31c342"],
}elseif(typeof(args.data["security-groups"])=="string"&&args.data["security-groups"].length>0){//args.data["security-groups"] is a string, e.g. "2375f8cc-8a73-4b8d-9b26-50885a25ffe0"