mirror of
https://github.com/vatesfr/xen-orchestra.git
synced 2026-09-10 22:14:48 -05:00
fix(xapi): respect the config file setting for preferNbd (#8780)
* fix(nbd-client): handle unreachable VM through nbd when the user select nbd but don't have any way to reach the storage/host of the VM (for example no NBD enabled network, or a NBD enabled network unreachable by xo/proxy it was timing out and blocking the start of the backup This error was blocking the fallback to export stream mechanism * fix(xapi): respect the config file setting for preferNbd * fix(xapi): don't close export stream if nbd failed to connect * fix(xapi):respect vhd/qcow2 when faling back to a full if delta exports fails
This commit is contained in:
committed by
GitHub
parent
6123c82d40
commit
3bc90981af
@@ -70,7 +70,9 @@ export default class MultiNbdClient {
|
||||
await _connect()
|
||||
}
|
||||
if (this.#clients.length === 0) {
|
||||
throw new Error(`Fail to connect to any Nbd client`)
|
||||
const error = new Error(`Fail to connect to any Nbd client`, { nbdInfos: this.#settings })
|
||||
error.code = 'NO_NBD_AVAILABLE'
|
||||
throw error
|
||||
}
|
||||
if (this.#clients.length < this.#nbdConcurrency) {
|
||||
warn(
|
||||
|
||||
@@ -52,7 +52,7 @@ export class XapiDiskSource extends DiskPassthrough {
|
||||
* @param {number} [params.nbdConcurrency=2]
|
||||
* @param {number} [params.blockSize=2*1024*1024]
|
||||
*/
|
||||
constructor({ xapi, vdiRef, baseRef, preferNbd = true, nbdConcurrency = 2, blockSize = 2 * 1024 * 1024 }) {
|
||||
constructor({ xapi, vdiRef, baseRef, preferNbd = xapi._preferNbd, nbdConcurrency = 2, blockSize = 2 * 1024 * 1024 }) {
|
||||
super(undefined)
|
||||
this.#baseRef = baseRef
|
||||
this.#blockSize = blockSize
|
||||
@@ -89,17 +89,15 @@ export class XapiDiskSource extends DiskPassthrough {
|
||||
source = new DiskLargerBlock(source, this.#blockSize)
|
||||
}
|
||||
} catch (err) {
|
||||
await source?.close()
|
||||
if (err.code === 'NO_NBD_AVAILABLE') {
|
||||
warn(`can't connect through NBD, fallback to stream export`)
|
||||
if (streamSource === undefined) {
|
||||
throw new Error(`Can't open stream source`)
|
||||
}
|
||||
return streamSource
|
||||
} else {
|
||||
await streamSource?.close()
|
||||
throw err
|
||||
}
|
||||
await source?.close() // this will close source and stream source
|
||||
throw err
|
||||
}
|
||||
this.#useNbd = true
|
||||
const readAhead = new ReadAhead(source)
|
||||
@@ -128,15 +126,14 @@ export class XapiDiskSource extends DiskPassthrough {
|
||||
source = new XapiQcow2StreamSource({ vdiRef, baseRef, xapi })
|
||||
}
|
||||
await source.init()
|
||||
} catch (err) {
|
||||
} catch (error) {
|
||||
await source?.close()
|
||||
if (err.code === 'VDI_CANT_DO_DELTA') {
|
||||
warn(`can't compute delta of XapiVhdStreamSource ${vdiRef} from ${baseRef}, fallBack to a full`)
|
||||
// @todo : should clear CBT status since it probably a little broken
|
||||
source = new XapiVhdStreamSource({ vdiRef, baseRef: undefined, xapi })
|
||||
await source.init()
|
||||
if (baseRef !== undefined) {
|
||||
warn(`can't compute delta ${vdiRef} from ${baseRef}, fallBack to a full`, { error })
|
||||
this.#baseRef = undefined
|
||||
return this.#openExportStream()
|
||||
} else {
|
||||
throw err
|
||||
throw error
|
||||
}
|
||||
}
|
||||
return source
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
- [Charts] Fix tooltip overflow when too close to the edge [Forum#11012](https://xcp-ng.org/forum/topic/11012/graph-in-v0.12.0-48bf9/2) (PR [#8779](https://github.com/vatesfr/xen-orchestra/pull/8779))
|
||||
|
||||
- [VM/New] Fix `Cannot read properties of undefined (reading '$ref')` when creating VM configured to PXE boot (PR [#8782](https://github.com/vatesfr/xen-orchestra/pull/8782))
|
||||
- [Backups] fix backup job getting stuck without NBD (PR [#8780](https://github.com/vatesfr/xen-orchestra/pull/8780))
|
||||
|
||||
### Packages to release
|
||||
|
||||
@@ -42,6 +43,7 @@
|
||||
|
||||
<!--packages-start-->
|
||||
|
||||
- @vates/nbd-client patch
|
||||
- @vates/types minor
|
||||
- @xen-orchestra/rest-api minor
|
||||
- @xen-orchestra/web-core minor
|
||||
|
||||
Reference in New Issue
Block a user