Skip to content
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

limit scope of finding VMs by MAC address to cluster level and not NetBox wide #167

Open
jhammond-git opened this issue Apr 6, 2022 · 8 comments
Labels
enhancement New feature or request
Milestone

Comments

@jhammond-git
Copy link

I am sync'ing multiple clusters that are very similar, just in different locations. Every now and then, I see a VM get renamed and moved around to different clusters such as this:

2022-04-06 14:46:17,662 - INFO: Virtual machine 'TEST_VM_LOC1' attribute 'name' changed from 'TEST_VM_LOC1' to 'TEST_VM_LOC2'

There are subsequent logs for updating the interfaces, IPs, etc... This happens on every run.

@bb-Ricardo
Copy link
Owner

Can you use -l DEBUG2 and see why the script tries to rename the VM. It must be finding a NetBox object due to some parameters. Do the VMs have the same MAC address?

@jhammond-git
Copy link
Author

Oh man, that's a lot of spam.

Yes, the logs now show that it's matching on the MAC address. However, it's matching to a VM in a completely different cluster in a different location with a different name.

@jhammond-git
Copy link
Author

Can the search for an existing VM be isolated the current cluster it's working on?

@bb-Ricardo bb-Ricardo changed the title VM's in different clusters get renamed and moved around limit scope of finding VMs by MAC address to cluster level and not NetBox wide Apr 7, 2022
@bb-Ricardo bb-Ricardo added the enhancement New feature or request label Apr 7, 2022
@bb-Ricardo bb-Ricardo added this to the 1.3.0 milestone Apr 7, 2022
@bb-Ricardo
Copy link
Owner

mmhhhh, good point.

Will have a look into it to narrow it down to the same cluster.

@bb-Ricardo bb-Ricardo modified the milestones: 1.3.0, 1.4.0 Aug 24, 2022
@bb-Ricardo bb-Ricardo modified the milestones: 1.4.0, 1.5.0 Jan 12, 2023
@patschi
Copy link

patschi commented Jun 4, 2023

I'm not sure if that's the best way. The MAC address is supposed to be unique within the entire vCenter system (based on the vCenter instance ID). Also, when using VRF/NSX to create independent virtualized networks, MAC addresses can be identical within the same cluster without any issues.

Maybe it might be more useful to isolate MAC address matching using Netbox VRF instances or so?

@bb-Ricardo
Copy link
Owner

Just curious how the scoping should work. Usually you would try to adapt the VMs which are already configured in your NetBox.

This would also result in a quite complex search strategy. Which implies that the existing NetBox configuration is already quite adequate.

  • get the interface VRF from IP or VLAN
  • get all interfaces which belong to this VRF
  • find a VM with same matching multiple interface configuration and matching MAC addresses

Could also be that this is a way to complex approach.

I would assume 48 bit are enough to form a unique address within a vCenter instance.

@bb-Ricardo
Copy link
Owner

@patschi,

Would be interested in your input on this.

@bb-Ricardo bb-Ricardo modified the milestones: 1.5.0, 1.6.0 Jun 19, 2023
@patschi
Copy link

patschi commented Jun 21, 2023

I think it's quite difficult to make it working right for everybody, as it might also depend on the use-case.

So within a vCenter instance, the MAC address should be unique (00:50:56:xx:yy) across the vCenter system - the 4th block will depend on the vCenter ID set. It should be unique even across clusters on different physical sites, connected to the same vCenter instance (which is not uncommon). [Just a small additional read: https://kb.vmware.com/s/article/1024025]

If you add standalone ESXi installations (without any vCenter), the VMs will have the MAC address 00:00c:29:xx. In this instance I'd say conflicting MAC addresses are fine, as long as they aren't on the same broadcast domain obviously.

But the ESXi hosts might be all added to netbox and cause MAC address conflicts. I'm new to netbox, so not sure how we this can be managed in the best possible way, to fit everybody.

@bb-Ricardo bb-Ricardo modified the milestones: 1.6.0, 1.7.0 Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants