fix(Xapi#findAvailableSharedSr): should not be async (#584)
Fixes vatesfr/xo-web#2262
This commit is contained in:
parent
b462f57060
commit
7f706bdbe9
@ -1603,6 +1603,10 @@ export default class Xapi extends XapiBase {
|
|||||||
type = 'user',
|
type = 'user',
|
||||||
xenstore_data = undefined
|
xenstore_data = undefined
|
||||||
} = {}) {
|
} = {}) {
|
||||||
|
if (sr === NULL_REF) {
|
||||||
|
throw new Error('SR required to create VDI')
|
||||||
|
}
|
||||||
|
|
||||||
sr = this.getObject(sr)
|
sr = this.getObject(sr)
|
||||||
debug(`Creating VDI ${name_label} on ${sr.name_label}`)
|
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)
|
return this.createTemporaryVdiOnSr(stream, pbd.SR, name_label, name_description)
|
||||||
}
|
}
|
||||||
|
|
||||||
async findAvailableSharedSr (minSize) {
|
findAvailableSharedSr (minSize) {
|
||||||
return find(
|
return find(
|
||||||
this.objects.all,
|
this.objects.all,
|
||||||
obj => obj.$type === 'sr' && obj.shared && canSrHaveNewVdiOfSize(obj, minSize)
|
obj => obj.$type === 'sr' && obj.shared && canSrHaveNewVdiOfSize(obj, minSize)
|
||||||
|
@ -273,7 +273,7 @@ export default {
|
|||||||
|
|
||||||
// If no hostId provided, try and find a shared SR
|
// If no hostId provided, try and find a shared SR
|
||||||
if (!hostId) {
|
if (!hostId) {
|
||||||
const sr = await this.findAvailableSharedSr(stream.length)
|
const sr = this.findAvailableSharedSr(stream.length)
|
||||||
|
|
||||||
if (!sr) {
|
if (!sr) {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user