@xen-orchestra/backups 0.57.0 → 0.58.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/RemoteAdapter.mjs +5 -1
- package/_cleanVm.mjs +2 -1
- package/_getOldEntries.mjs +1 -1
- package/package.json +3 -3
- package/runBackupWorker.mjs +13 -1
package/README.md
CHANGED
|
@@ -12,6 +12,19 @@ Installation of the [npm package](https://npmjs.org/package/@xen-orchestra/backu
|
|
|
12
12
|
npm install --save @xen-orchestra/backups
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
## Changing the default backup configuration
|
|
18
|
+
|
|
19
|
+
This library receives a backup configuration from `xo-server` or `xo-proxy`. This configuration is split between multiple properties:
|
|
20
|
+
|
|
21
|
+
- `config` contains values related to the general backup configuration
|
|
22
|
+
- `config.defaultSettings`, `config.vm.defaultSettings` and `config.metadata.defaultSettings` contain values related to backup jobs default settings:
|
|
23
|
+
- `config.vm.defaultSettings` is related to VM backup jobs (see [DEFAULT_XAPI_VM_SETTINGS](https://github.com/vatesfr/xen-orchestra/blob/568e14f7eec7c3ddf685d324ad4733a3ef577995/%40xen-orchestra/backups/_runners/VmsRemote.mjs#L15))
|
|
24
|
+
- `config.metadata.defaultSettings` is related to metadata backup jobs (see [DEFAULT_METADATA_SETTINGS](https://github.com/vatesfr/xen-orchestra/blob/568e14f7eec7c3ddf685d324ad4733a3ef577995/%40xen-orchestra/backups/_runners/Metadata.mjs#L12))
|
|
25
|
+
- `config.defaultSettings` is related to all backup jobs (see [DEFAULT_SETTINGS](https://github.com/vatesfr/xen-orchestra/blob/568e14f7eec7c3ddf685d324ad4733a3ef577995/%40xen-orchestra/backups/_runners/_Abstract.mjs#L7))
|
|
26
|
+
- in case of duplicate value, `config.vm.defaultSettings` and `config.metadata.defaultSettings` will prevail over `config.defaultSettings`, and a defined job setting will prevail over any `defaultSettings`
|
|
27
|
+
|
|
15
28
|
## Contributions
|
|
16
29
|
|
|
17
30
|
Contributions are _very_ welcomed, either on the documentation or on
|
package/RemoteAdapter.mjs
CHANGED
|
@@ -700,7 +700,11 @@ export class RemoteAdapter {
|
|
|
700
700
|
}
|
|
701
701
|
}
|
|
702
702
|
|
|
703
|
-
async outputStream(
|
|
703
|
+
async outputStream(
|
|
704
|
+
path,
|
|
705
|
+
input,
|
|
706
|
+
{ checksum = !this._handler.isEncrypted, maxStreamLength, streamLength, validator = noop } = {}
|
|
707
|
+
) {
|
|
704
708
|
const container = watchStreamSize(input)
|
|
705
709
|
await this._handler.outputStream(path, input, {
|
|
706
710
|
checksum,
|
package/_cleanVm.mjs
CHANGED
|
@@ -133,6 +133,7 @@ export async function checkAliases(
|
|
|
133
133
|
await handler.unlink(alias)
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
+
continue
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
if (!isVhdFile(target)) {
|
|
@@ -575,7 +576,7 @@ export async function cleanVm(
|
|
|
575
576
|
if (mergedSize) {
|
|
576
577
|
// all disks are now key disk
|
|
577
578
|
metadata.isVhdDifferencing = {}
|
|
578
|
-
for (const id of Object.
|
|
579
|
+
for (const id of Object.keys(metadata.vdis ?? {})) {
|
|
579
580
|
metadata.isVhdDifferencing[`${id}.vhd`] = false
|
|
580
581
|
}
|
|
581
582
|
}
|
package/_getOldEntries.mjs
CHANGED
|
@@ -27,7 +27,7 @@ const LTR_DEFINITIONS = {
|
|
|
27
27
|
copy.date(date.date() - firstDayOfWeek)
|
|
28
28
|
// warning, the year in term of week may different from YYYY
|
|
29
29
|
// since the computation of the first week of a year is timezone dependant
|
|
30
|
-
return copy.format('gggg-
|
|
30
|
+
return copy.format('gggg-ww')
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
ancestor: 'daily',
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/vatesfr/xen-orchestra.git"
|
|
10
10
|
},
|
|
11
|
-
"version": "0.
|
|
11
|
+
"version": "0.58.1",
|
|
12
12
|
"engines": {
|
|
13
13
|
"node": ">=14.18"
|
|
14
14
|
},
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@vates/nbd-client": "^3.1.2",
|
|
29
29
|
"@vates/parse-duration": "^0.1.1",
|
|
30
30
|
"@xen-orchestra/async-map": "^0.1.2",
|
|
31
|
-
"@xen-orchestra/fs": "^4.
|
|
31
|
+
"@xen-orchestra/fs": "^4.4.0",
|
|
32
32
|
"@xen-orchestra/log": "^0.7.1",
|
|
33
33
|
"@xen-orchestra/template": "^0.1.0",
|
|
34
34
|
"app-conf": "^3.0.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"tmp": "^0.2.1"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"@xen-orchestra/xapi": "^7.
|
|
62
|
+
"@xen-orchestra/xapi": "^7.11.0"
|
|
63
63
|
},
|
|
64
64
|
"license": "AGPL-3.0-or-later",
|
|
65
65
|
"author": {
|
package/runBackupWorker.mjs
CHANGED
|
@@ -4,10 +4,22 @@ import { fork } from 'child_process'
|
|
|
4
4
|
const { warn } = createLogger('xo:backups:backupWorker')
|
|
5
5
|
|
|
6
6
|
const PATH = new URL('_backupWorker.mjs', import.meta.url).pathname
|
|
7
|
+
const DEFAULT_INSPECTOR_PORT = 9229
|
|
7
8
|
|
|
8
9
|
export function runBackupWorker(params, onLog) {
|
|
9
10
|
return new Promise((resolve, reject) => {
|
|
10
|
-
|
|
11
|
+
// run Node inspector on port+1 if --inspect or --inspect-brk
|
|
12
|
+
const inspectArg = process.execArgv.find(arg => arg.startsWith('--inspect') || arg.startsWith('--inspect-brk'))
|
|
13
|
+
const execArgv = inspectArg
|
|
14
|
+
? [
|
|
15
|
+
inspectArg.replace(/^(--inspect(-brk)?)(=([^:]+:)?(\d+))?$/, (_, prefix, brk, _fullMatch, host, port) => {
|
|
16
|
+
const basePort = port ? parseInt(port) : DEFAULT_INSPECTOR_PORT
|
|
17
|
+
return `${prefix}=${host || ''}${basePort + 1}`
|
|
18
|
+
}),
|
|
19
|
+
]
|
|
20
|
+
: []
|
|
21
|
+
|
|
22
|
+
const worker = fork(PATH, [], { execArgv })
|
|
11
23
|
|
|
12
24
|
worker.on('exit', (code, signal) => reject(new Error(`worker exited with code ${code} and signal ${signal}`)))
|
|
13
25
|
worker.on('error', reject)
|