@xen-orchestra/backups 0.44.0 → 0.44.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/ImportVmBackup.mjs
CHANGED
|
@@ -16,26 +16,35 @@ async function resolveUuid(xapi, cache, uuid, type) {
|
|
|
16
16
|
return cache.get(uuid)
|
|
17
17
|
}
|
|
18
18
|
export class ImportVmBackup {
|
|
19
|
-
constructor({
|
|
19
|
+
constructor({
|
|
20
|
+
adapter,
|
|
21
|
+
metadata,
|
|
22
|
+
srUuid,
|
|
23
|
+
xapi,
|
|
24
|
+
settings: { additionnalVmTag, newMacAddresses, mapVdisSrs = {} } = {},
|
|
25
|
+
}) {
|
|
20
26
|
this._adapter = adapter
|
|
21
|
-
this._importIncrementalVmSettings = { newMacAddresses, mapVdisSrs }
|
|
27
|
+
this._importIncrementalVmSettings = { additionnalVmTag, newMacAddresses, mapVdisSrs }
|
|
22
28
|
this._metadata = metadata
|
|
23
29
|
this._srUuid = srUuid
|
|
24
30
|
this._xapi = xapi
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
async #decorateIncrementalVmMetadata(backup) {
|
|
28
|
-
const { mapVdisSrs } = this._importIncrementalVmSettings
|
|
34
|
+
const { additionnalVmTag, mapVdisSrs } = this._importIncrementalVmSettings
|
|
29
35
|
const xapi = this._xapi
|
|
30
36
|
|
|
31
37
|
const cache = new Map()
|
|
32
38
|
const mapVdisSrRefs = {}
|
|
39
|
+
if (additionnalVmTag !== undefined) {
|
|
40
|
+
backup.vm.tags.push(additionnalVmTag)
|
|
41
|
+
}
|
|
33
42
|
for (const [vdiUuid, srUuid] of Object.entries(mapVdisSrs)) {
|
|
34
43
|
mapVdisSrRefs[vdiUuid] = await resolveUuid(xapi, cache, srUuid, 'SR')
|
|
35
44
|
}
|
|
36
|
-
const
|
|
45
|
+
const srRef = await resolveUuid(xapi, cache, this._srUuid, 'SR')
|
|
37
46
|
Object.values(backup.vdis).forEach(vdi => {
|
|
38
|
-
vdi.SR = mapVdisSrRefs[vdi.uuid] ??
|
|
47
|
+
vdi.SR = mapVdisSrRefs[vdi.uuid] ?? srRef
|
|
39
48
|
})
|
|
40
49
|
return backup
|
|
41
50
|
}
|
|
@@ -58,7 +58,7 @@ export const MixinXapiWriter = (BaseClass = Object) =>
|
|
|
58
58
|
)
|
|
59
59
|
}
|
|
60
60
|
const healthCheckVm = xapi.getObject(healthCheckVmRef) ?? (await xapi.waitObject(healthCheckVmRef))
|
|
61
|
-
|
|
61
|
+
await healthCheckVm.add_tag('xo:no-bak=Health Check')
|
|
62
62
|
await new HealthCheckVmBackup({
|
|
63
63
|
restoredVm: healthCheckVm,
|
|
64
64
|
xapi,
|