Skip to content

Commit

Permalink
Changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
MelissaFrncJrg committed Nov 15, 2023
1 parent b0f09be commit 300d760
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/xo-server/src/xo-mixins/resource-sets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,10 @@ export default class {
}

await xapi.xo.setData(vmId, 'resourceSet', resourceSetId === undefined ? null : resourceSetId)
await xapi.barrier(xapi.getObject(vmId).$ref)
// barrier function is used to ensure completion of previous asynchronous operations
// on the vmId object, guaranteeing that all modifications are considered before
// retrieving the resourceSetId value.
$defer.onFailure(() =>
xapi.xo.setData(vmId, 'resourceSet', previousResourceSetId === undefined ? null : previousResourceSetId)
)
Expand All @@ -444,9 +448,6 @@ export default class {

async shareVmResourceSet(vmId) {
const xapi = this._app.getXapi(vmId)
await xapi.barrier(xapi.getObject(vmId).$ref)
// barrier function is used to ensure completion of previous asynchronous operations
// on the vmId object, guaranteeing that all modifications are considered before retrieving the resourceSetId value.
const resourceSetId = xapi.xo.getData(vmId, 'resourceSet')
if (resourceSetId === undefined) {
throw new Error('the vm is not in a resource set')
Expand Down

0 comments on commit 300d760

Please sign in to comment.