cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

UI: Fix VPC network offerings listing on VPC tier creation

Open nvazquez opened this issue 1 year ago • 22 comments

Description

This PR fixes the VPC network offerings listing on VPC tiers creation Fixes: #8023

Types of changes

  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] New feature (non-breaking change which adds functionality)
  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] Enhancement (improves an existing feature and functionality)
  • [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
  • [ ] build/CI
  • [ ] test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • [ ] Major
  • [x] Minor

Bug Severity

  • [ ] BLOCKER
  • [ ] Critical
  • [ ] Major
  • [x] Minor
  • [ ] Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Create VPC offering with Lb as supported service and VpcVirtualRouter as provider Create VPC with the selected VPC offering VPC -> Add new network tier -> verify available network offerings

How did you try to break this feature and the system with this change?

nvazquez avatar Aug 20 '24 14:08 nvazquez

@blueorangutan ui

nvazquez avatar Aug 20 '24 14:08 nvazquez

@nvazquez a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

blueorangutan avatar Aug 20 '24 14:08 blueorangutan

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 15.08%. Comparing base (3d8d487) to head (f07c7df). Report is 31 commits behind head on 4.19.

Additional details and impacted files
@@             Coverage Diff              @@
##               4.19    #9557      +/-   ##
============================================
- Coverage     15.08%   15.08%   -0.01%     
  Complexity    11184    11184              
============================================
  Files          5406     5406              
  Lines        472908   472921      +13     
  Branches      60405    61613    +1208     
============================================
- Hits          71345    71342       -3     
- Misses       393619   393635      +16     
  Partials       7944     7944              
Flag Coverage Δ
uitests 4.30% <ø> (-0.01%) :arrow_down:
unittests 15.80% <ø> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 20 '24 14:08 codecov[bot]

UI build: :heavy_check_mark: Live QA URL: https://qa.cloudstack.cloud/simulator/pr/9557 (QA-JID-428)

blueorangutan avatar Aug 20 '24 14:08 blueorangutan

@nvazquez , as discussed off-line; I still see both types image not sure what the functional solution should be (let alone the implementation) but can you expand on how you solved it and why ?

thanks

DaanHoogland avatar Aug 21 '24 06:08 DaanHoogland

Thanks for reviewing @DaanHoogland @weizhouapache - before the fix the network offerings listing was passing supportedServices=SourceNat, and the solution I found was passing supportedServices=SourceNat,Lb in case the VPC offering supports the Lb service. Maybe this is the wrong approach, what do you think/suggest?

nvazquez avatar Aug 21 '24 10:08 nvazquez

Thanks for reviewing @DaanHoogland @weizhouapache - before the fix the network offerings listing was passing supportedServices=SourceNat, and the solution I found was passing supportedServices=SourceNat,Lb in case the VPC offering supports the Lb service. Maybe this is the wrong approach, what do you think/suggest?

as I understand

  • good: VPC uses public LB (it supports internal LB as well), network uses internal LB
  • good: VPC uses public LB (it supports internal LB as well), network uses public LB
  • good: VPC uses public LB (it supports internal LB as well), network does not use LB
  • not good: VPC uses internal LB, network uses public LB
  • good: VPC uses internal LB, network uses internal LB
  • good: VPC uses internal LB, network does not use LB

I think network offerings should be filtered by the LB service provider (VpcVirtualRouter or InternalLbVm) instead of service (Lb).

weizhouapache avatar Aug 21 '24 11:08 weizhouapache

@DaanHoogland @weizhouapache I've revisited the logic and got the following results:

For Public LB VPC: Screenshot 2024-08-22 at 01 17 44

For Internal LB VPC: Screenshot 2024-08-22 at 01 18 43

Can you please review the latest changes?

nvazquez avatar Aug 22 '24 04:08 nvazquez

@blueorangutan ui

nvazquez avatar Aug 22 '24 04:08 nvazquez

@nvazquez a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

blueorangutan avatar Aug 22 '24 04:08 blueorangutan

UI build: :heavy_check_mark: Live QA URL: https://qa.cloudstack.cloud/simulator/pr/9557 (QA-JID-430)

blueorangutan avatar Aug 22 '24 04:08 blueorangutan

@DaanHoogland @weizhouapache I've revisited the logic and got the following results:

For Public LB VPC: Screenshot 2024-08-22 at 01 17 44

For Internal LB VPC: Screenshot 2024-08-22 at 01 18 43

Can you please review the latest changes?

@nvazquez does the env have the network offering DefaultIsolatedNetworkOfferingForVpcNetworksNoLB (Offering for Isolated Vpc networks with Source Nat service enabled and LB service Disabled) ?

if yes, I think it should be in the list as well.

weizhouapache avatar Aug 22 '24 07:08 weizhouapache

@DaanHoogland @weizhouapache I've revisited the logic and got the following results: For Public LB VPC: Screenshot 2024-08-22 at 01 17 44 For Internal LB VPC: Screenshot 2024-08-22 at 01 18 43 Can you please review the latest changes?

@nvazquez does the env have the network offering DefaultIsolatedNetworkOfferingForVpcNetworksNoLB (Offering for Isolated Vpc networks with Source Nat service enabled and LB service Disabled) ?

if yes, I think it should be in the list as well.

@weizhouapache

The vpc networks are created from vpc offerings which have LB of either vpcvrouter and internalLBVM

Screenshot 2024-08-22 at 3 57 12 PM

so i believe "DefaultIsolatedNetworkOfferingForVpcNetworksNoLB" should not be displayed

kiranchavala avatar Aug 22 '24 10:08 kiranchavala

so i believe "DefaultIsolatedNetworkOfferingForVpcNetworksNoLB" should not be displayed

@kiranchavala @nvazquez You can try to create a vpc tier without LB using the network offering

weizhouapache avatar Aug 22 '24 11:08 weizhouapache

Thanks @weizhouapache I tried it from the API and it fails for public LB VPC but works for the internal LB VPC:

(localcloud) 🐱 > list networkofferings name=DefaultIsolatedNetworkOfferingForVpcNetworksNoLB filter=id,name
{
  "count": 1,
  "networkoffering": [
    {
      "id": "34af5716-09e9-44d9-8cc5-c84d8478be2a",
      "name": "DefaultIsolatedNetworkOfferingForVpcNetworksNoLB"
    }
  ]
}

For public LB VPC:

(localcloud) 🐱 > create network vpcid=6f4d9f18-4e02-4cca-a981-6b2580e9db20 networkofferingid=34af5716-09e9-44d9-8cc5-c84d8478be2a name=testNoLB zoneid=16220919-8e96-48e2-bfb0-b9fc63bc3efc gateway=10.20.1.1 netmask=255.255.255.240
🙈 Error: (HTTP 431, error code 4350) Service/provider combination Dhcp/VpcVirtualRouter is not supported by VPC [VPC [6-VPC-PublicLB]

For internal LB VPC:

(localcloud) 🐱 > create network vpcid=89ebb044-a2ea-46db-9f4c-9dc0b39a0091 networkofferingid=34af5716-09e9-44d9-8cc5-c84d8478be2a name=testilb-newtier zoneid=16220919-8e96-48e2-bfb0-b9fc63bc3efc gateway=10.30.1.33 netmask=255.255.255.240
{
  "network": {
    ....
    "networkofferingdisplaytext": "Offering for Isolated Vpc networks with Source Nat service enabled and LB service Disabled",
    "networkofferingid": "34af5716-09e9-44d9-8cc5-c84d8478be2a",
    "networkofferingname": "DefaultIsolatedNetworkOfferingForVpcNetworksNoLB",
    ....
    "service": [
      {
        "capability": [
          {
            "canchooseservicecapability": false,
            "name": "SupportedVpnTypes",
            "value": "pptp,l2tp,ipsec"
          },
          {
            "canchooseservicecapability": false,
            "name": "VpnTypes",
            "value": "s2svpn"
          }
        ],
        "name": "Vpn",
        "provider": [
          {
            "name": "VpcVirtualRouter"
          }
        ]
      },
      {
        "capability": [
          {
            "canchooseservicecapability": false,
            "name": "SupportedProtocols",
            "value": "tcp,udp,icmp"
          }
        ],
        "name": "NetworkACL",
        "provider": [
          {
            "name": "VpcVirtualRouter"
          }
        ]
      },
      {
        "capability": [
          {
            "canchooseservicecapability": true,
            "name": "SupportedSourceNatTypes",
            "value": "peraccount"
          },
          {
            "canchooseservicecapability": true,
            "name": "RedundantRouter",
            "value": "false"
          }
        ],
        "name": "SourceNat",
        "provider": [
          {
            "name": "VpcVirtualRouter"
          }
        ]
      },
      {
        "capability": [],
        "name": "UserData",
        "provider": [
          {
            "name": "VpcVirtualRouter"
          }
        ]
      },
      {
        "capability": [
          {
            "canchooseservicecapability": false,
            "name": "DhcpAccrossMultipleSubnets",
            "value": "true"
          }
        ],
        "name": "Dhcp",
        "provider": [
          {
            "name": "VpcVirtualRouter"
          }
        ]
      },
      {
        "capability": [
          {
            "canchooseservicecapability": false,
            "name": "AllowDnsSuffixModification",
            "value": "true"
          }
        ],
        "name": "Dns",
        "provider": [
          {
            "name": "VpcVirtualRouter"
          }
        ]
      },
      {
        "capability": [
          {
            "canchooseservicecapability": false,
            "name": "SupportedProtocols",
            "value": "tcp,udp"
          }
        ],
        "name": "PortForwarding",
        "provider": [
          {
            "name": "VpcVirtualRouter"
          }
        ]
      },
      {
        "capability": [
          {
            "canchooseservicecapability": false,
            "name": "ElasticIp",
            "value": "false"
          },
          {
            "canchooseservicecapability": false,
            "name": "AssociatePublicIP",
            "value": "true"
          }
        ],
        "name": "StaticNat",
        "provider": [
          {
            "name": "VpcVirtualRouter"
          }
        ]
      }
    ],
    ....
  }
}

I didn't find this intuitive, will refactor the logic to support this case also

nvazquez avatar Aug 22 '24 11:08 nvazquez

For public LB VPC:

(localcloud) 🐱 > create network vpcid=6f4d9f18-4e02-4cca-a981-6b2580e9db20 networkofferingid=34af5716-09e9-44d9-8cc5-c84d8478be2a name=testNoLB zoneid=16220919-8e96-48e2-bfb0-b9fc63bc3efc gateway=10.20.1.1 netmask=255.255.255.240
🙈 Error: (HTTP 431, error code 4350) Service/provider combination Dhcp/VpcVirtualRouter is not supported by VPC [VPC [6-VPC-PublicLB]

thanks @nvazquez for the testing

regarding the error above, it seems to be caused by Dhcp of the VPC offering, not LB. Can you create a new VPC offering with Dhcp/Dns (and other serivces) with Public LB, and retry ?

weizhouapache avatar Aug 22 '24 11:08 weizhouapache

@weizhouapache you are right, it got created properly. Sorry I wasn't aware of this behavior, will refactor accordingly

nvazquez avatar Aug 22 '24 13:08 nvazquez

@weizhouapache @kiranchavala I've refactored the logic, can you have a final review? Many thanks

@blueorangutan ui

nvazquez avatar Aug 22 '24 13:08 nvazquez

@nvazquez a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

blueorangutan avatar Aug 22 '24 13:08 blueorangutan

UI build: :heavy_check_mark: Live QA URL: https://qa.cloudstack.cloud/simulator/pr/9557 (QA-JID-431)

blueorangutan avatar Aug 22 '24 14:08 blueorangutan

@weizhouapache does this lgty now?

DaanHoogland avatar Aug 28 '24 06:08 DaanHoogland

@DaanHoogland code lgtm. not tested yet

this needs re-testing as there are some changes after last testing by @kiranchavala

weizhouapache avatar Aug 28 '24 07:08 weizhouapache

@DaanHoogland @kiranchavala could you if its looking good after the latest changes?

nvazquez avatar Sep 11 '24 01:09 nvazquez

@blueorangutan ui

kiranchavala avatar Sep 13 '24 10:09 kiranchavala

@kiranchavala a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

blueorangutan avatar Sep 13 '24 10:09 blueorangutan

UI build: :heavy_check_mark: Live QA URL: https://qa.cloudstack.cloud/simulator/pr/9557 (QA-JID-447)

blueorangutan avatar Sep 13 '24 11:09 blueorangutan