bl4ko / netbox-ssot

Microservice that synces objects from multiple sources into netbox and makes it automatic SSOT.
MIT License
23 stars 4 forks source link

vmware unclustered VM #141

Closed TaLoN1x closed 2 months ago

TaLoN1x commented 2 months ago

If VM is running on a Host that is not a member of any cluster, it is failind to be added to the Netbox:

ERROR (vcenter-test): failed to sync vmware VM some-vm-in-single-node.local: unexpected status code: 400: {"device":["Must specify a cluster when assigning a host device."]}

Either a single node Cluster should be created for this use-case or host device should not be specified for that VM.

bl4ko commented 2 months ago

I have tried to create vm via webui, without assigning a host device to it (just passing its name). And I get a netbox limit of:

A virtual machine must be assigned to a site and/or cluster.

So I guess every vm need a site or cluster assigned to it. So if no cluster is assigned to it, site has to be assigned to it to be able to add it into the netbox.

bl4ko commented 2 months ago

So maybe I could fix this by just assigning the same site to vm as its host device (server)?

TaLoN1x commented 2 months ago

correct, currently ssot thus is trying to assign device, but it cannot be assigned without cluster as of netbox scheme.

TaLoN1x commented 2 months ago

So maybe I could fix this by just assigning the same site to vm as its host device (server)?

But then we cannot assign the host device to the VM. If we create a hypothetical Cluster with same name as host device, then we can assign both Site and Host device to it. :) I know it's a bit counter-logical...

bl4ko commented 2 months ago

Yeah, you are right. I think creating hypothetical cluster is the best solution here...

bl4ko commented 2 months ago

@TaLoN1x could you test this issue against 141-vmware-unclustered-vm branch?

TaLoN1x commented 2 months ago

The cluster got assigned DefaultSite, no Tenant and no hosts were added to it. Host and tenant can be worked around via mapping, but I think they should be inherited from the host device itself.

ERROR (vc-test): failed to sync vmware VM [TEST-HES-DB.energia.sise](some-vm-in-single-node.local: unexpected status code: 400: {"cluster":["The selected cluster (single-node-cluster.local) is not assigned to this site (DefaultSite)."]}

bl4ko commented 2 months ago

I think this should fix it now.

TaLoN1x commented 2 months ago

works good now!

bl4ko commented 2 months ago

:tada: This issue has been resolved in version 0.6.10 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: