From 9d6ec8845215707cab17db3dddce5a6226ef043b Mon Sep 17 00:00:00 2001 From: Florent Beauchamp Date: Wed, 15 Mar 2023 15:58:06 +0100 Subject: [PATCH] feat(@xen-orchestra/xapi): make nbd use configurable --- @xen-orchestra/xapi/index.js | 2 ++ @xen-orchestra/xapi/vdi.js | 4 ++-- packages/xo-server/config.toml | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/@xen-orchestra/xapi/index.js b/@xen-orchestra/xapi/index.js index 67eece466a8..3592738510b 100644 --- a/@xen-orchestra/xapi/index.js +++ b/@xen-orchestra/xapi/index.js @@ -134,6 +134,7 @@ class Xapi extends Base { constructor({ callRetryWhenTooManyPendingTasks = { delay: 5e3, tries: 10 }, maxUncoalescedVdis, + preferNbd, syncHookSecret, syncHookTimeout, vdiDestroyRetryWhenInUse = { delay: 5e3, tries: 10 }, @@ -148,6 +149,7 @@ class Xapi extends Base { this._maxUncoalescedVdis = maxUncoalescedVdis this._syncHookSecret = syncHookSecret this._syncHookTimeout = syncHookTimeout + this._preferNbd = preferNbd this._vdiDestroyRetryWhenInUse = { ...vdiDestroyRetryWhenInUse, onRetry, diff --git a/@xen-orchestra/xapi/vdi.js b/@xen-orchestra/xapi/vdi.js index 4e080599565..a90e052f46a 100644 --- a/@xen-orchestra/xapi/vdi.js +++ b/@xen-orchestra/xapi/vdi.js @@ -62,7 +62,7 @@ class Vdi { }) } - async exportContent(ref, { baseRef, cancelToken = CancelToken.none, format, preferNbd = true }) { + async exportContent(ref, { baseRef, cancelToken = CancelToken.none, format }) { const query = { format, vdi: ref, @@ -72,7 +72,7 @@ class Vdi { } let nbdClient try { - if (preferNbd) { + if (this._preferNbd) { const nbdInfos = await this.call('VDI.get_nbd_info', ref) if (nbdInfos.length > 0) { // a little bit of randomization to spread the load diff --git a/packages/xo-server/config.toml b/packages/xo-server/config.toml index 5d3701ae0c3..912aa332e60 100644 --- a/packages/xo-server/config.toml +++ b/packages/xo-server/config.toml @@ -178,6 +178,7 @@ vmSnapshotConcurrency = 2 poolMarkingInterval = '6 hours' poolMarkingMaxAge = '48 hours' poolMarkingPrefix = 'xo:clientInfo:' +preferNbd = true [xo-proxy] callTimeout = '1 min'