vcenter-netbox-sync icon indicating copy to clipboard operation
vcenter-netbox-sync copied to clipboard

Same name vm in other vcenter

Open MalfuncEddie opened this issue 5 years ago • 14 comments

Steps to Reproduce

  1. Have the same VM in 2 different vcenters (in this case a template server that you roll out)
  2. run the script
  3. VM is "updated" twice (once for cluster A and once for cluster B

Expected Behavior

The vm should be create two times, one in each cluster.

Observed Behavior

When the script searches if a vm exists it finds the VM of CLUSTER B and changes is to CLUSTER A. When the script is processing CLUSTER B and it finds the same VM the VM is updated from CLUSTER A to B

MalfuncEddie avatar Apr 22 '20 15:04 MalfuncEddie

Hello, @MalfuncEddie.

Thanks for the report. You are indeed correct we should only update the VM relevant to the vCenter it was detected on originally. I'll work on improving this behavior. Thanks for the report!

synackray avatar May 01 '20 10:05 synackray

I have merged this into develop. Thanks!

synackray avatar May 07 '20 16:05 synackray

Hi,

I juist checkt the develop branch te see the fix. but it looks like the problem is still there. The vm is create in the last cluster but it has the tags "Vcenter A" and "Vcenter B".

MalfuncEddie avatar May 11 '20 13:05 MalfuncEddie

@MalfuncEddie I am requesting the resources to test this again. Was the sync done in an already populated NetBox instance? I had to remove the second vCenter tag from the existing VM object as it had already been synced that way and I didn't see a duplication on a fresh sync, but I am going to fully retest this on my side. Thanks!

synackray avatar May 12 '20 11:05 synackray

I'll clean my setup and run the sync again. results tomorrow :)

On Tue, May 12, 2020 at 1:44 PM Raymond Beaudoin [email protected] wrote:

@MalfuncEddie https://github.com/MalfuncEddie I am requesting the resources to test this again. Was the sync done in an already populated NetBox instance? I had to remove the second vCenter tag from the existing VM object as it had already been synced that way and I didn't see a duplication on a fresh sync, but I am going to fully retest this on my side. Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/synackray/vcenter-netbox-sync/issues/93#issuecomment-627292135, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANDKCZPDB5WHKGCM64VJODRREZC3ANCNFSM4MOIO36Q .

MalfuncEddie avatar May 12 '20 15:05 MalfuncEddie

Hi,

run.py -c Did a check an there were no vm/ tag/ ...

ran run.py again: same result vm gets created vm get updated run it again vm get updated

the diff shows update 1 { "cluster": 23, "platform": 28 } to { "cluster": 29, "platform": 1 } update 2: { "cluster": 29, "platform": 1 } to { "cluster": 23, "platform": 28 }

MalfuncEddie avatar May 13 '20 15:05 MalfuncEddie

and the vm has 2 vcenter tags

MalfuncEddie avatar May 13 '20 15:05 MalfuncEddie

I didn't try it myself but can you have two virtual machines with the same name in netbox?

bb-Ricardo avatar Sep 25 '20 20:09 bb-Ricardo

No, VM name is unique

gstorme avatar Sep 25 '20 20:09 gstorme

Id and name are the primary keys. Then the only solution would be to rename both VMs in netbox with their cluster name as suffix.

bb-Ricardo avatar Sep 25 '20 21:09 bb-Ricardo

Hi,

This could be solved by adding a custom field UUID and using that as the primary key. In either case I've written a custom script that does juist that since I also had the same cluster names in different vcenters :( .

kind regards

On Fri, Sep 25, 2020 at 11:01 PM Ricardo [email protected] wrote:

Id and name are the primary keys. Then the only solution would be to rename both VMs in netbox with their cluster name as suffix.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/synackray/vcenter-netbox-sync/issues/93#issuecomment-699153263, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANDKC4O54VSCVUPZRIGTNTSHUALPANCNFSM4MOIO36Q .

MalfuncEddie avatar Sep 26 '20 06:09 MalfuncEddie

I was thinking the same.

How did you name your clusters then? Vcenter name as prefix?

bb-Ricardo avatar Sep 26 '20 06:09 bb-Ricardo

Yes I did

On Sat, Sep 26, 2020, 08:28 Ricardo [email protected] wrote:

I was thinking the same.

How did you name your clusters then? Vcenter name as prefeix?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/synackray/vcenter-netbox-sync/issues/93#issuecomment-699438362, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANDKC4VOAVCU4Y35IPD3H3SHWCYFANCNFSM4MOIO36Q .

MalfuncEddie avatar Sep 26 '20 07:09 MalfuncEddie

Just stumbled across this issue. VM and Device names are NOT unique. Here a long discussion on this topic: https://github.com/netbox-community/netbox/issues/2669

bb-Ricardo avatar Oct 08 '20 19:10 bb-Ricardo