fix(xo-server/xen-servers): fix connecting status (#3838)

This commit is contained in:
badrAZ 2019-01-09 11:51:20 +01:00 committed by Julien Fontanet
parent 20c92c668b
commit 83fe490dbb
2 changed files with 4 additions and 3 deletions

View File

@ -14,6 +14,7 @@
### Bug fixes
- [Self] Display sorted Resource Sets [#3818](https://github.com/vatesfr/xen-orchestra/issues/3818) (PR [#3823](https://github.com/vatesfr/xen-orchestra/pull/3823))
- [Servers] Correctly report connecting status (PR [#3838](https://github.com/vatesfr/xen-orchestra/pull/3838))
### Released packages

View File

@ -250,7 +250,7 @@ export default class {
async connectXenServer(id) {
const server = (await this._getXenServer(id)).properties
const xapi = new Xapi({
const xapi = (this._xapis[server.id] = new Xapi({
allowUnauthorized: Boolean(server.allowUnauthorized),
readOnly: Boolean(server.readOnly),
@ -262,7 +262,7 @@ export default class {
},
url: server.host,
watchEvents: false,
})
}))
try {
await xapi.connect()
@ -278,7 +278,6 @@ export default class {
}
serverIdsByPool[poolId] = server.id
this._xapis[server.id] = xapi
xapi.xo = (() => {
const conId = server.id
@ -377,6 +376,7 @@ export default class {
this.updateXenServer(id, { error: null })::ignoreErrors()
} catch (error) {
delete this._xapis[server.id]
xapi.disconnect()::ignoreErrors()
this.updateXenServer(id, { error: serializeError(error) })::ignoreErrors()
throw error