|
277 | 277 | $networkStep.find("#from_vpc_tier").show(); |
278 | 278 | } |
279 | 279 | else { //from Instance page |
280 | | - step5ContainerType = 'select-network'; |
281 | | - $networkStep.find("#from_instance_page_1").show(); |
282 | | - $networkStep.find("#from_instance_page_2").show(); |
283 | | - $networkStep.find("#from_vpc_tier").text(""); |
284 | | - $networkStep.find("#from_vpc_tier").hide(); |
| 280 | + if(selectedZoneObj.securitygroupsenabled != true) { // Advanced SG-disabled zone |
| 281 | + step5ContainerType = 'select-network'; |
| 282 | + $networkStep.find("#from_instance_page_1").show(); |
| 283 | + $networkStep.find("#from_instance_page_2").show(); |
| 284 | + $networkStep.find("#from_vpc_tier").text(""); |
| 285 | + $networkStep.find("#from_vpc_tier").hide(); |
| 286 | + } |
| 287 | + else { // Advanced SG-enabled zone |
| 288 | + step5ContainerType = 'select-security-group'; |
| 289 | + } |
285 | 290 | } |
286 | 291 | } |
287 | 292 | else { //Basic zone. Show securigy group list or nothing(when no SecurityGroup service in guest network) |
|
320 | 325 | var networkData = { |
321 | 326 | zoneId: args.currentData.zoneid |
322 | 327 | }; |
323 | | - |
| 328 | + |
| 329 | + // step5ContainerType of Advanced SG-enabled zone is 'select-security-group', so won't come into this block |
| 330 | + /* |
| 331 | + if(selectedZoneObj.networktype == 'Advanced' && selectedZoneObj.securitygroupsenabled == true) { |
| 332 | + $.extend(networkData, { |
| 333 | + type: 'Shared' |
| 334 | + }); |
| 335 | + } |
| 336 | + */ |
| 337 | + |
324 | 338 | if (!(cloudStack.context.projects && cloudStack.context.projects[0])) { |
325 | 339 | networkData.domainid = g_domainid; |
326 | 340 | networkData.account = g_account; |
|
532 | 546 |
|
533 | 547 | if(checkedSecurityGroupIdArray.length > 0) |
534 | 548 | array1.push("&securitygroupids=" + checkedSecurityGroupIdArray.join(",")); |
| 549 | + |
| 550 | + if(selectedZoneObj.networktype == "Advanced" && selectedZoneObj.securitygroupsenabled == true) { // Advanced SG-enabled zone |
| 551 | + var networkData = { |
| 552 | + zoneId: selectedZoneObj.id, |
| 553 | + type: 'Shared', |
| 554 | + supportedServices: 'SecurityGroup' |
| 555 | + }; |
| 556 | + if (!(cloudStack.context.projects && cloudStack.context.projects[0])) { |
| 557 | + networkData.domainid = g_domainid; |
| 558 | + networkData.account = g_account; |
| 559 | + } |
| 560 | + |
| 561 | + var selectedNetworkObj = null; |
| 562 | + $.ajax({ |
| 563 | + url: createURL('listNetworks'), |
| 564 | + data: networkData, |
| 565 | + async: false, |
| 566 | + success: function(json) { |
| 567 | + var networks = json.listnetworksresponse.network; |
| 568 | + if(networks != null && networks.length > 0) { |
| 569 | + selectedNetworkObj = networks[0]; //each Advanced SG-enabled zone has only one guest network that is Shared and has SecurityGroup service |
| 570 | + } |
| 571 | + } |
| 572 | + }); |
| 573 | + if(selectedNetworkObj != null) { |
| 574 | + array1.push("&networkIds=" + selectedNetworkObj.id); |
| 575 | + } |
| 576 | + else { |
| 577 | + alert('unable to find any Shared network with SecurityGroup service. Therefore, unable to deploy VM in this Advanced SecurityGroup-enabled zone.'); |
| 578 | + return; |
| 579 | + } |
| 580 | + } |
535 | 581 | } |
536 | 582 | else if (step5ContainerType == 'nothing-to-select') { |
537 | 583 | if(args.context.networks != null) { //from VPC tier |
|
0 commit comments