fix(Xapi#findAvailableSharedSr): should not be async (#584)

Fixes vatesfr/xo-web#2262
This commit is contained in:
Pierre Donias 2017-07-05 17:46:22 +02:00 committed by Julien Fontanet
parent b462f57060
commit 7f706bdbe9
2 changed files with 6 additions and 2 deletions

View File

@ -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)

View File

@ -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