fix(backups): block start_on operation on replicated VMs (#5852)
This commit is contained in:
parent
4bed8eb86f
commit
c6f22f4d75
@ -201,6 +201,7 @@ exports.importDeltaVm = defer(async function importDeltaVm(
|
|||||||
blocked_operations: {
|
blocked_operations: {
|
||||||
...vmRecord.blocked_operations,
|
...vmRecord.blocked_operations,
|
||||||
start: 'Importing…',
|
start: 'Importing…',
|
||||||
|
start_on: 'Importing…',
|
||||||
},
|
},
|
||||||
ha_always_run: false,
|
ha_always_run: false,
|
||||||
is_a_template: false,
|
is_a_template: false,
|
||||||
|
@ -111,9 +111,11 @@ exports.DeltaReplicationWriter = class DeltaReplicationWriter extends MixinRepli
|
|||||||
targetVm.ha_restart_priority !== '' &&
|
targetVm.ha_restart_priority !== '' &&
|
||||||
Promise.all([targetVm.set_ha_restart_priority(''), targetVm.add_tags('HA disabled')]),
|
Promise.all([targetVm.set_ha_restart_priority(''), targetVm.add_tags('HA disabled')]),
|
||||||
targetVm.set_name_label(`${vm.name_label} - ${job.name} - (${formatFilenameDate(timestamp)})`),
|
targetVm.set_name_label(`${vm.name_label} - ${job.name} - (${formatFilenameDate(timestamp)})`),
|
||||||
|
asyncMap(['start', 'start_on'], op =>
|
||||||
targetVm.update_blocked_operations(
|
targetVm.update_blocked_operations(
|
||||||
'start',
|
op,
|
||||||
'Start operation for this vm is blocked, clone it if you want to use it.'
|
'Start operation for this vm is blocked, clone it if you want to use it.'
|
||||||
|
)
|
||||||
),
|
),
|
||||||
targetVm.update_other_config({
|
targetVm.update_other_config({
|
||||||
'xo:backup:sr': srUuid,
|
'xo:backup:sr': srUuid,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const ignoreErrors = require('promise-toolbox/ignoreErrors.js')
|
const ignoreErrors = require('promise-toolbox/ignoreErrors.js')
|
||||||
const { asyncMapSettled } = require('@xen-orchestra/async-map')
|
const { asyncMap, asyncMapSettled } = require('@xen-orchestra/async-map')
|
||||||
const { formatDateTime } = require('@xen-orchestra/xapi')
|
const { formatDateTime } = require('@xen-orchestra/xapi')
|
||||||
|
|
||||||
const { formatFilenameDate } = require('../_filenameDate.js')
|
const { formatFilenameDate } = require('../_filenameDate.js')
|
||||||
@ -64,9 +64,11 @@ exports.FullReplicationWriter = class FullReplicationWriter extends MixinReplica
|
|||||||
const targetVm = await xapi.getRecord('VM', targetVmRef)
|
const targetVm = await xapi.getRecord('VM', targetVmRef)
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
asyncMap(['start', 'start_on'], op =>
|
||||||
targetVm.update_blocked_operations(
|
targetVm.update_blocked_operations(
|
||||||
'start',
|
op,
|
||||||
'Start operation for this vm is blocked, clone it if you want to use it.'
|
'Start operation for this vm is blocked, clone it if you want to use it.'
|
||||||
|
)
|
||||||
),
|
),
|
||||||
targetVm.update_other_config({
|
targetVm.update_other_config({
|
||||||
'xo:backup:sr': srUuid,
|
'xo:backup:sr': srUuid,
|
||||||
|
@ -77,7 +77,11 @@ ${cliName} v${pkg.version}
|
|||||||
'xo:backup:sr': tgtSr.uuid,
|
'xo:backup:sr': tgtSr.uuid,
|
||||||
'xo:copy_of': srcSnapshotUuid,
|
'xo:copy_of': srcSnapshotUuid,
|
||||||
}),
|
}),
|
||||||
tgtVm.update_blocked_operations('start', 'Start operation for this vm is blocked, clone it if you want to use it.'),
|
Promise.all(
|
||||||
|
['start', 'start_on'].map(op =>
|
||||||
|
tgtVm.update_blocked_operations(op, 'Start operation for this vm is blocked, clone it if you want to use it.')
|
||||||
|
)
|
||||||
|
),
|
||||||
Promise.all(
|
Promise.all(
|
||||||
userDevices.map(userDevice => {
|
userDevices.map(userDevice => {
|
||||||
const srcDisk = srcDisks[userDevice]
|
const srcDisk = srcDisks[userDevice]
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
||||||
|
|
||||||
- [VM/disks] Fix `an error has occured` when self service user was on VM disk view (PR [#5841](https://github.com/vatesfr/xen-orchestra/pull/5841))
|
- [VM/disks] Fix `an error has occured` when self service user was on VM disk view (PR [#5841](https://github.com/vatesfr/xen-orchestra/pull/5841))
|
||||||
|
- [Backup] Protect replicated VMs from being started on specific hosts (PR [#5852](https://github.com/vatesfr/xen-orchestra/pull/5852))
|
||||||
|
|
||||||
### Packages to release
|
### Packages to release
|
||||||
|
|
||||||
@ -35,5 +36,8 @@
|
|||||||
>
|
>
|
||||||
> In case of conflict, the highest (lowest in previous list) `$version` wins.
|
> In case of conflict, the highest (lowest in previous list) `$version` wins.
|
||||||
|
|
||||||
|
- @xen-orchestra/backups patch
|
||||||
|
- @xen-orchestra/proxy patch
|
||||||
- xo-server-netbox minor
|
- xo-server-netbox minor
|
||||||
|
- xo-server patch
|
||||||
- xo-web minor
|
- xo-web minor
|
||||||
|
@ -727,6 +727,7 @@ export default class Xapi extends XapiBase {
|
|||||||
blocked_operations: {
|
blocked_operations: {
|
||||||
...delta.vm.blocked_operations,
|
...delta.vm.blocked_operations,
|
||||||
start: 'Importing…',
|
start: 'Importing…',
|
||||||
|
start_on: 'Importing…',
|
||||||
},
|
},
|
||||||
ha_always_run: false,
|
ha_always_run: false,
|
||||||
is_a_template: false,
|
is_a_template: false,
|
||||||
@ -851,9 +852,11 @@ export default class Xapi extends XapiBase {
|
|||||||
delta.vm.ha_always_run && vm.set_ha_always_run(true),
|
delta.vm.ha_always_run && vm.set_ha_always_run(true),
|
||||||
vm.set_name_label(name_label),
|
vm.set_name_label(name_label),
|
||||||
// FIXME: move
|
// FIXME: move
|
||||||
|
asyncMap(['start', 'start_on'], op =>
|
||||||
vm.update_blocked_operations(
|
vm.update_blocked_operations(
|
||||||
'start',
|
op,
|
||||||
disableStartAfterImport ? 'Do not start this VM, clone it if you want to use it.' : null
|
disableStartAfterImport ? 'Do not start this VM, clone it if you want to use it.' : null
|
||||||
|
)
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
|
|
||||||
@ -1097,7 +1100,7 @@ export default class Xapi extends XapiBase {
|
|||||||
$defer.onFailure(() => this.VM_destroy(vm.$ref))
|
$defer.onFailure(() => this.VM_destroy(vm.$ref))
|
||||||
// Disable start and change the VM name label during import.
|
// Disable start and change the VM name label during import.
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
vm.update_blocked_operations('start', 'OVA import in progress...'),
|
asyncMapSettled(['start', 'start_on'], op => vm.update_blocked_operations(op, 'OVA import in progress...')),
|
||||||
vm.set_name_label(`[Importing...] ${nameLabel}`),
|
vm.set_name_label(`[Importing...] ${nameLabel}`),
|
||||||
])
|
])
|
||||||
|
|
||||||
@ -1169,7 +1172,7 @@ export default class Xapi extends XapiBase {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Enable start and restore the VM name label after import.
|
// Enable start and restore the VM name label after import.
|
||||||
await Promise.all([vm.update_blocked_operations('start', null), vm.set_name_label(nameLabel)])
|
await Promise.all([vm.update_blocked_operations({ start: null, start_on: null }), vm.set_name_label(nameLabel)])
|
||||||
return vm
|
return vm
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1303,7 +1306,7 @@ export default class Xapi extends XapiBase {
|
|||||||
log.debug(`Starting VM ${vm.name_label}`)
|
log.debug(`Starting VM ${vm.name_label}`)
|
||||||
|
|
||||||
if (force) {
|
if (force) {
|
||||||
await vm.update_blocked_operations('start', null)
|
await vm.update_blocked_operations({ start: null, start_on: null })
|
||||||
}
|
}
|
||||||
|
|
||||||
return hostId === undefined
|
return hostId === undefined
|
||||||
|
Loading…
Reference in New Issue
Block a user