diff --git a/src/xapi/index.js b/src/xapi/index.js index 8221e9856..1c0d90a64 100644 --- a/src/xapi/index.js +++ b/src/xapi/index.js @@ -1603,6 +1603,10 @@ export default class Xapi extends XapiBase { type = 'user', xenstore_data = undefined } = {}) { + if (sr === NULL_REF) { + throw new Error('SR required to create VDI') + } + sr = this.getObject(sr) debug(`Creating VDI ${name_label} on ${sr.name_label}`) @@ -2152,7 +2156,7 @@ export default class Xapi extends XapiBase { return this.createTemporaryVdiOnSr(stream, pbd.SR, name_label, name_description) } - async findAvailableSharedSr (minSize) { + findAvailableSharedSr (minSize) { return find( this.objects.all, obj => obj.$type === 'sr' && obj.shared && canSrHaveNewVdiOfSize(obj, minSize) diff --git a/src/xapi/mixins/patching.js b/src/xapi/mixins/patching.js index 5795f44ed..ef2d2b065 100644 --- a/src/xapi/mixins/patching.js +++ b/src/xapi/mixins/patching.js @@ -273,7 +273,7 @@ export default { // If no hostId provided, try and find a shared SR if (!hostId) { - const sr = await this.findAvailableSharedSr(stream.length) + const sr = this.findAvailableSharedSr(stream.length) if (!sr) { return