-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mac_learning causes dvsport_group to report changes #1873
Comments
I'm not sure I following what you mean - the first task in your screenshot Perhaps this is a more understandable test case, though less minimal as it includes a loop which isn't required to demonstrate the issue.
|
@TheMysteriousX Now I run playbook again (portgroup1 was created yesterday) and both play get same result. Module is idempotent. What do you think is wrong? |
I did some further testing and it looks like there's an additional element. I'd overlooked that in the task prior to setting mac_learning, we were setting network_policy. It doesn't appear to matter if network_policy is set at the same time, or prior to setting mac_learning so I've adapted the test case to highlight both.
|
I run your code in my lab and I see that every second reconfigure action change Need to dive more thoughtfully into the module code to understand why it behaves this way. |
@mariolenz Mario, this module is terrible.
It no change any difference in current config and desired config. Just create new config (without some parts of config). This make module not idempotent. =( |
Is this still an issue? |
I haven't tested it with 5.x.x but it's still present on 4.x.x - if there's something that you think will have fixed it in the 5.x.x releases, I can try updating our plays. |
I had another look and I think this should also happen in 5.x. I guess we have to have a closer look at this part of the code: community.vmware/plugins/modules/vmware_dvs_portgroup.py Lines 766 to 776 in 6966997
BTW what version of the collection are you using? Is it the current 4.x one, that is 4.8.2? Note to myself: DVSMacLearningPolicy(vim.dvs.VmwareDistributedVirtualSwitch.MacLearningPolicy) |
I can't reproduce this. We have actually an integration test to make sure that I've added them, just to make sure. But the CI still succeeds: See #2360 for 5.x and #2361 for 4.x. I've even checked the logs to make sure that the tests were really executed. They were, and didn't report any issues with idempotency when |
I just updated to 4.8.3 to confirm and it's definitely still present. In your test case, I don't see |
Yes, this might be an explanation. I'll have another look. |
Out of curiosity, what's the setting of your dvswitch for Why I want to know this: Maybe the API call to allow MAC address learning silently overrides this. After all, it doesn't make much sense to have MAC address learning if MAC addresses can't change... does it? So my idea at the moment is:
An infinite loop. I'm not 100% sure, just guessing. Although (I hope!) it's an educated guess :-) Anyway, if you don't want to allow MAC address changes, you don't need MAC learning... or do you? BTW #2360 and #2361 fail with |
On the dvSwitch, we have the policy defined as:
On most of the port groups, we just want to pull that through with inheritance, except for a few port groups where layer 2 trickery is used for HA, and a few more where multiple MAC's sit on the port. It shouldn't be a conflict, as the use case for mac learning is to avoid having to set the "allow bad behaviour" policy flags, but I haven't explictly checked - I've just been assuming that as all our VM's are up and reachable, the config gets set correctly in spite of the 'changed' notice. I can give it a poke with powercli and see what the actual state of each port is, probably tomorrow. |
I think I understand now. There's no toggling between two configs, MAC address learning ist simply ignored. Technically, the configuration for MAC address learning is in the same place like promiscuous, forged transmits and MAC address changes: DVSMacManagementPolicy(vim.dvs.VmwareDistributedVirtualSwitch.MacManagementPolicy). This policy can be set on the portgroup or inherited from the switch. But inheriting means the whole set of policies, including the stuff for MAC address learning. You can't inherit some of them and override others. It's all or nothing. And this isn't something we have under control or can change in the module, it's how the vSphere API works. I guess we should document this somewhere 🤔 |
That makes sense, I hadn't realised the mac learning setting is also inherited. I guess a warning or error if |
It's unfortunate that
ATM I'm working on mentioning this at least in the documentation. @ihumster What do you think about the module issuing a warning in this case? But then, we should also have a warning for the other sub-options of |
SUMMARY
With the following values set in community.vmware.vmware_dvs_portgroup:
The task always appears to report a change has happened. Removing that attribute from the task makes it report 'OK'.
This is similar to the elastic/static issue, however I already had these parameters set.
ISSUE TYPE
COMPONENT NAME
vmware_dvs_portgroup
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
macOS 13.6
STEPS TO REPRODUCE
EXPECTED RESULTS
Task should report 'OK' after the initial run.
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: