提交 ca588a34 编写于 作者: P Peter Krempa

qemu: domain: Store vcpu halted state as a tristate

Since it may be possible that the state is unknown in some cases we
should store it as a tristate so that other code using it can determine
whether the state was updated.
上级 2222548b
......@@ -8737,7 +8737,8 @@ qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver,
for (i = 0; i < maxvcpus; i++) {
vcpu = virDomainDefGetVcpu(vm->def, i);
vcpupriv = QEMU_DOMAIN_VCPU_PRIVATE(vcpu);
vcpupriv->halted = virBitmapIsBitSet(haltedmap, vcpupriv->qemu_id);
vcpupriv->halted = virTristateBoolFromBool(virBitmapIsBitSet(haltedmap,
vcpupriv->qemu_id));
}
ret = 0;
......
......@@ -399,7 +399,7 @@ struct _qemuDomainVcpuPrivate {
int enable_id; /* order in which the vcpus were enabled in qemu */
int qemu_id; /* ID reported by qemu as 'CPU' in query-cpus */
char *alias;
bool halted;
virTristateBool halted;
/* information for hotpluggable cpus */
char *type;
......
......@@ -19659,7 +19659,6 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver,
char param_name[VIR_TYPED_PARAM_FIELD_LENGTH];
virVcpuInfoPtr cpuinfo = NULL;
unsigned long long *cpuwait = NULL;
bool vcpuhalted = false;
if (virTypedParamsAddUInt(&record->params,
&record->nparams,
......@@ -19679,15 +19678,11 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver,
VIR_ALLOC_N(cpuwait, virDomainDefGetVcpus(dom->def)) < 0)
goto cleanup;
if (HAVE_JOB(privflags) && virDomainObjIsActive(dom)) {
if (qemuDomainRefreshVcpuHalted(driver, dom,
QEMU_ASYNC_JOB_NONE) < 0) {
if (HAVE_JOB(privflags) && virDomainObjIsActive(dom) &&
qemuDomainRefreshVcpuHalted(driver, dom, QEMU_ASYNC_JOB_NONE) < 0) {
/* it's ok to be silent and go ahead, because halted vcpu info
* wasn't here from the beginning */
virResetLastError();
} else {
vcpuhalted = true;
}
}
if (qemuDomainHelperGetVcpus(dom, cpuinfo, cpuwait,
......@@ -19735,14 +19730,14 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver,
vcpupriv = QEMU_DOMAIN_VCPU_PRIVATE(vcpu);
if (vcpuhalted) {
if (vcpupriv->halted != VIR_TRISTATE_BOOL_ABSENT) {
snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
"vcpu.%u.halted", cpuinfo[i].number);
if (virTypedParamsAddBoolean(&record->params,
&record->nparams,
maxparams,
param_name,
vcpupriv->halted) < 0)
vcpupriv->halted == VIR_TRISTATE_BOOL_YES) < 0)
goto cleanup;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册