Fix Xen error handling (#56).

This commit is contained in:
Julien Fontanet 2015-05-05 10:24:13 +02:00
parent bcc2244fdb
commit f0b0277b9d
2 changed files with 8 additions and 8 deletions

View File

@ -259,11 +259,11 @@ export const probeNfs = coroutine(function ({
throw new Error('the call above should have thrown an error')
} catch (error) {
if (error[0] !== 'SR_BACKEND_FAILURE_101') {
if (error.code !== 'SR_BACKEND_FAILURE_101') {
throw error
}
xml = parseXml(error[3])
xml = parseXml(error.params[2])
}
const nfsExports = []
@ -396,14 +396,14 @@ export const probeIscsiIqns = coroutine(function ({
throw new Error('the call above should have thrown an error')
} catch (error) {
if (error[0] === 'SR_BACKEND_FAILURE_141') {
if (error.code === 'SR_BACKEND_FAILURE_141') {
return []
}
if (error[0] !== 'SR_BACKEND_FAILURE_96') {
if (error.code !== 'SR_BACKEND_FAILURE_96') {
throw error
}
xml = parseXml(error[3])
xml = parseXml(error.params[2])
}
const targets = []
@ -474,11 +474,11 @@ export const probeIscsiLuns = coroutine(function ({
throw new Error('the call above should have thrown an error')
} catch (error) {
if (error[0] !== 'SR_BACKEND_FAILURE_107') {
if (error.code !== 'SR_BACKEND_FAILURE_107') {
throw error
}
xml = parseXml(error[3])
xml = parseXml(error.params[2])
}
const luns = []

View File

@ -706,7 +706,7 @@ stop = $coroutine ({vm, force}) ->
try
$wait xapi.call 'VM.clean_shutdown', vm.ref
catch error
if error[0] is 'VM_MISSING_PV_DRIVERS'
if error.code is 'VM_MISSING_PV_DRIVERS'
# TODO: Improve reporting: this message is unclear.
@throw 'INVALID_PARAMS'
else