mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
libxl: Fix domain startup failure error reporting
When domain startup fails, domain cleanup calls libxlNetworkUnwindDevices, which calls virGetConnectNetwork, which is a top level API entry point, which resets the initial saved error, leading to clients seeing: error: An error occurred, but the cause is unknown This preserves the error around the entire teardown process, similar to what is done in the qemu driver. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
5f0765f90f
commit
25072c0304
@ -903,10 +903,13 @@ libxlDomainCleanup(libxlDriverPrivate *driver,
|
|||||||
virHostdevManager *hostdev_mgr = driver->hostdevMgr;
|
virHostdevManager *hostdev_mgr = driver->hostdevMgr;
|
||||||
unsigned int hostdev_flags = VIR_HOSTDEV_SP_PCI;
|
unsigned int hostdev_flags = VIR_HOSTDEV_SP_PCI;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
virErrorPtr save_err;
|
||||||
|
|
||||||
VIR_DEBUG("Cleaning up domain with id '%d' and name '%s'",
|
VIR_DEBUG("Cleaning up domain with id '%d' and name '%s'",
|
||||||
vm->def->id, vm->def->name);
|
vm->def->id, vm->def->name);
|
||||||
|
|
||||||
|
virErrorPreserveLast(&save_err);
|
||||||
|
|
||||||
hostdev_flags |= VIR_HOSTDEV_SP_USB;
|
hostdev_flags |= VIR_HOSTDEV_SP_USB;
|
||||||
|
|
||||||
/* Call hook with stopped operation. Ignore error and continue with cleanup */
|
/* Call hook with stopped operation. Ignore error and continue with cleanup */
|
||||||
@ -979,6 +982,7 @@ libxlDomainCleanup(libxlDriverPrivate *driver,
|
|||||||
VIR_HOOK_SUBOP_END, NULL));
|
VIR_HOOK_SUBOP_END, NULL));
|
||||||
|
|
||||||
virDomainObjRemoveTransientDef(vm);
|
virDomainObjRemoveTransientDef(vm);
|
||||||
|
virErrorRestore(&save_err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1240,6 +1244,7 @@ libxlDomainStartPrepare(libxlDriverPrivate *driver,
|
|||||||
{
|
{
|
||||||
virHostdevManager *hostdev_mgr = driver->hostdevMgr;
|
virHostdevManager *hostdev_mgr = driver->hostdevMgr;
|
||||||
unsigned int hostdev_flags = VIR_HOSTDEV_SP_PCI | VIR_HOSTDEV_SP_USB;
|
unsigned int hostdev_flags = VIR_HOSTDEV_SP_PCI | VIR_HOSTDEV_SP_USB;
|
||||||
|
virErrorPtr save_err;
|
||||||
|
|
||||||
if (virDomainObjSetDefTransient(driver->xmlopt, vm, NULL) < 0)
|
if (virDomainObjSetDefTransient(driver->xmlopt, vm, NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -1267,10 +1272,12 @@ libxlDomainStartPrepare(libxlDriverPrivate *driver,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
virErrorPreserveLast(&save_err);
|
||||||
libxlNetworkUnwindDevices(vm->def);
|
libxlNetworkUnwindDevices(vm->def);
|
||||||
virHostdevReAttachDomainDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME,
|
virHostdevReAttachDomainDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME,
|
||||||
vm->def, hostdev_flags);
|
vm->def, hostdev_flags);
|
||||||
virDomainObjRemoveTransientDef(vm);
|
virDomainObjRemoveTransientDef(vm);
|
||||||
|
virErrorRestore(&save_err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user