From 7f706bdbe9c75ad0b932a07dcc9f3e7ff4094029 Mon Sep 17 00:00:00 2001 From: Pierre Donias Date: Wed, 5 Jul 2017 17:46:22 +0200 Subject: [PATCH] fix(Xapi#findAvailableSharedSr): should not be async (#584) Fixes vatesfr/xo-web#2262 --- src/xapi/index.js | 6 +++++- src/xapi/mixins/patching.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) 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