Skip to content

Commit

Permalink
remove_from_blocked_operations on fixed migrate operations, removed c…
Browse files Browse the repository at this point in the history
…oncurrency value
  • Loading branch information
stephane-m-dev committed Nov 27, 2024
1 parent a13f9ee commit 54496e4
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions packages/xo-server/src/api/host.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,15 @@ export async function setMaintenanceMode({ host, maintenance, vmsToForceMigrate
const xapi = this.getXapi(host)

if (vmsToForceMigrate) {
await asyncEach(
vmsToForceMigrate,
async vmUuid => {
const record = await xapi.getRecordByUuid('VM', vmUuid)
const ref = record.$ref
const blockedOperations = record.blocked_operations
await Promise.all(
Object.keys(blockedOperations)
.filter(operation => ['pool_migrate', 'migrate_send'].includes(operation))
.map(async operation => await xapi.call('VM.remove_from_blocked_operations', ref, operation))
await asyncEach(vmsToForceMigrate, async vmUuid => {
const record = await xapi.getRecordByUuid('VM', vmUuid)
const ref = record.$ref
await Promise.all(
['pool_migrate', 'migrate_send'].map(
async operation => await xapi.call('VM.remove_from_blocked_operations', ref, operation)
)
},
{
concurrency: 4,
}
)
)
})
}

return maintenance ? xapi.clearHost(xapi.getObject(host)) : xapi.enableHost(host._xapiId)
Expand Down

0 comments on commit 54496e4

Please sign in to comment.