-
Notifications
You must be signed in to change notification settings - Fork 89
New-NsxLoadBalancerPool does not work (including a fix) #434
Comments
Hi Stefan, i think, it will be better to push directly a PR with your fix (and we really need to add some test on Load Balancer...) |
Hi again, |
hi @neoxinth - thanks for this! Before I get into reviewing the PR, can you include the details of the error you are getting including the exact syntax of getting/creating the monitor, defining the members etc? While you are correct - the documented (and more efficient) method of crud'ing pools is via /api/4.0/edges/$EdgeId/loadbalancer/config/pools, its is also perfectly valid to modify the base edge xml as the existing LB cmdlets do. (The reason for this is historical as the LB bits of PowerNSX are pretty long in the tooth now and in sore need of attention!) I need to validate exactly what you are seeing as I've done a quick test in the lab against 633 with the current cmdlets but I can't reproduce your issue. My main reluctance around just merging #435 is that (as @alagoutte points out) we dont have test coverage for the LB cmdlets and without this, its very easy to break PowerNSX against older versions of NSX without realising it. To resolve this - we have two options. 1) wait until someone (probably me or @pandom if no one else steps up ;) ) writes some tests for LB, 2) Hope that we dont break things. At the moment I like option 1. |
I should have added - if you are up to it - feel free to have a stab at writing some LB tests - at a minimum, some basic ones around pool creation would be enough to test a merge of #435. Take a look at https://powernsx.github.io/get-started#contributing for more info. |
Hi, The commands I ran are following:
Until here everything goes well, objects are populated, I can see that monitors and poolmembers are defined.
|
What NSX release do you are using ? |
6.3.4 |
ah - ok, its a 500, not 400 :) different response to your initial query. Ok - I have repro'ed now, but the build from scratch script that uses those same cmdlets still works, so I'm missing something. Ill try to take a look next week. |
Sorry, I think the output is from an already altered module. You can see the error below (which looks pretty much the same, except for the error 500) The error I saw originally is this:
|
Hi again, As it turns out, it's in the current build not possible to create a pool with objects (as it will complain that no IP is available:
So I've also created a change on line 2796 which allows objects as poolmembers from:
to
(Note the use of the groupingObjectID, which defines a vcenter-object) I haven't done a PR on this yet, since I'm not sure whether I'm testing on the right version, since you don't get the same error and can't reproduce it? Regards |
I did a PR on this one and tested it's functionality and it looks good. Running the "start-test edge" applet didn't show any error. |
Hi neoxinth, The problem, there is no yet LB test on Edge testsuite... |
Hmm, I can see that. Is there a way to build a test-suite more or less automatically? I could help with looking into it then, but I'm absolutely not experienced with it. |
You can look on tests/integration folder |
@nmbradford is probably no longer monitoring this, but just to close this off, it's happening under a very specific conditions. That's why you couldn't recreate it. You have to already have at least one LB VIP configured to cause this issue. Why - I don't know. Maybe some bug in NSX REST API? This is how you can reproduce it. This code will succeed:
But this will fail on creating the second pool:
The way to fix it is to make sure you include the pool ID in the body of the REST call, like this: Current implementation of the New-NsxLoadBalancerPool doesn't do that. But rather than trying to figure out how to generate a pool ID (I don't know if you can do that programmatically, I just tested it manually in Postman) and use /api/4.0/edges/$EdgeId/loadbalancer/config, I think it's better to use the more specific REST API call /api/4.0/edges/$EdgeId/loadbalancer/config/pools, how @neoxinth did in this PR. It doesn't require a pool ID. |
Thanks @Nick-Andreev for explain Can you add new test and a push a fix ? or you need some help ? |
@alagoutte, this pull request goes back to 2017 and far behind the current build. Would you recommend creating a new PR? Or is there a better way to address this? |
Kept this issue and create a new PR with the fix |
When calling New-NsxLoadBalancerPool, following is returned: "invoke-nsxwebrequest : Invoke-NsxWebRequest : The NSX API response received indicates a failure. 400 : Bad Request". Also 3 times this error occours: "The property 'OwnerDocument' cannot be found on this object"
It happened for both using IP-address or VM-name as poolmembers.
Following changes was made in New-NsxLoadBalancerPool ('#' indicates the old settings) :
Source:
Official NSX 6.3 API p. 325+326
Regards
Stefan
The text was updated successfully, but these errors were encountered: