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

[FR] Add option to exclude disk sync for specific VMs

Open Littlericket opened this issue 9 months ago • 1 comments

Feature: Add option to exclude disk sync for specific VMs #449

Problem

Currently, there's no way to exclude specific parts of VM information from synchronization. When VMs are backed up with tools like Veeam, temporary "Independent-nonpersistent" disks are attached, causing unnecessary entries in the NetBox change log when netbox-sync runs during a backup. Each backup creates two changelog entries - one for adding the disk and one for removing it.

Solution

This PR adds two new configuration options:

  1. vm_exclude_disk_sync: A regex pattern to match VM names where disk synchronization should be excluded
  2. vm_exclude_disk_sync_by_tag: A list of vCenter tags which, when assigned to a VM, will exclude it from disk synchronization

With these options, VMs will still be synchronized to NetBox with all other information (CPU, memory, interfaces, IP addresses), but changes to disk information will be ignored.

Implementation Details

  • Added new configuration options in module/sources/vmware/config.py
  • Added logic to skip disk synchronization in module/sources/vmware/connection.py
  • Updated documentation in README.md and docs/source_vmware.md

Example Usage

# Exclude backup VMs from disk synchronization by name pattern
vm_exclude_disk_sync = backup-.*, temp-.*

# Exclude VMs with specific tags from disk synchronization
vm_exclude_disk_sync_by_tag = backup-vm, veeam-job

Littlericket avatar Mar 21 '25 08:03 Littlericket

@bb-Ricardo any update on this? :) Really need that and I think this would be a great addition.

Littlericket avatar Apr 22 '25 07:04 Littlericket