diff --git a/docs/advanced.md b/docs/advanced.md index 801d5f4efcf..152cc946e55 100644 --- a/docs/advanced.md +++ b/docs/advanced.md @@ -347,7 +347,18 @@ Synchronize your pools, VMs, network interfaces and IP addresses with your [Netb - `>= 2.10` - `3.x` -- `4.x` +- `4.0` + +:::tip +For safety, XO will not synchronize your pools if it detects a Netbox version that is not supported. If you wish to change that behavior, edit you `xo-server` configuration like so: + +```toml +[netbox] +checkNetboxVersion = false +``` + +Please be aware that by doing this, a Netbox update might make XO delete some of your data in Netbox. +::: ### Netbox side diff --git a/packages/xo-server-netbox/src/index.js b/packages/xo-server-netbox/src/index.js index c61f8f0b320..b0b5113dd7f 100644 --- a/packages/xo-server-netbox/src/index.js +++ b/packages/xo-server-netbox/src/index.js @@ -16,7 +16,7 @@ import slugify from './slugify' const log = createLogger('xo:netbox') -const SUPPORTED_VERSION = '>=2.10 <5.0' +const SUPPORTED_VERSION = '>=2.10 <4.1' const CLUSTER_TYPE = 'XCP-ng Pool' const TYPES_WITH_UUID = ['virtualization.cluster', 'virtualization.virtualmachine', 'virtualization.vminterface'] const CHUNK_SIZE = 100 @@ -235,10 +235,14 @@ class Netbox { } async #checkNetboxVersion() { + if (!this.#xo.config.getOptional('netbox.checkNetboxVersion')) { + return + } + await this.#fetchNetboxVersion() if (this.#netboxVersion === undefined || !semver.satisfies(this.#netboxVersion, SUPPORTED_VERSION)) { throw new Error( - `Netbox version ${this.#netboxVersion ?? '<2.10'} not supported. Please check https://xen-orchestra.com/docs/advanced.html#netbox` + `Netbox version ${this.#netboxVersion ?? '<2.10'} not supported. Please check https://xen-orchestra.com/docs/advanced.html#supported-versions` ) } } diff --git a/packages/xo-server/config.toml b/packages/xo-server/config.toml index 3f85bdd5e47..26a0823c866 100644 --- a/packages/xo-server/config.toml +++ b/packages/xo-server/config.toml @@ -160,6 +160,9 @@ level = 'info' [logs.transport.console] +[netbox] +checkNetboxVersion = true + [plugins] lookupPaths = ['./node_modules', '../', '/usr/local/lib/node_modules']