libxl: User per-domain ctx in libxlDomainGetInfo

libxlDomainGetInfo() uses the driver-wide libxl ctx when
it would be more appropriate to use the per-domain ctx
associated with the domain.  Switch to using the per-domain
libxl ctx.
This commit is contained in:
Jim Fehlig 2013-08-30 14:36:22 -06:00
parent e1f67c90d5
commit 4147587669

View File

@ -1835,6 +1835,7 @@ libxlDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
libxlDriverPrivatePtr driver = dom->conn->privateData;
virDomainObjPtr vm;
libxl_dominfo d_info;
libxlDomainObjPrivatePtr priv;
int ret = -1;
libxlDriverLock(driver);
@ -1850,12 +1851,13 @@ libxlDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
if (virDomainGetInfoEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
priv = vm->privateData;
if (!virDomainObjIsActive(vm)) {
info->cpuTime = 0;
info->memory = vm->def->mem.cur_balloon;
info->maxMem = vm->def->mem.max_balloon;
} else {
if (libxl_domain_info(driver->ctx, &d_info, dom->id) != 0) {
if (libxl_domain_info(priv->ctx, &d_info, dom->id) != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("libxl_domain_info failed for domain '%d'"), dom->id);
goto cleanup;