if (qemuMonitorSetCapabilities(mon) < 0) {
VIR_DEBUG("Failed to set monitor capabilities %s",
virGetLastErrorMessage());
- ret = 0;
goto cleanup;
}
&package) < 0) {
VIR_DEBUG("Failed to query monitor version %s",
virGetLastErrorMessage());
- ret = 0;
goto cleanup;
}
if (qemuMonitorSetCapabilities(mon) < 0) {
VIR_DEBUG("Failed to set monitor capabilities %s",
virGetLastErrorMessage());
- ret = 0;
goto cleanup;
}
{
qemuProcessQMPPtr proc = NULL;
int ret = -1;
- int rc;
if (!(proc = qemuProcessQMPNew(qemuCaps->binary, libDir,
runUid, runGid, qmperr, onlyTCG)))
goto cleanup;
- if ((rc = qemuProcessQMPRun(proc)) != 0) {
- if (rc == 1)
- ret = 0;
+ if (qemuProcessQMPRun(proc) < 0)
goto cleanup;
- }
if (onlyTCG)
ret = virQEMUCapsInitQMPMonitorTCG(qemuCaps, proc->mon);
goto error;
}
- if (!qemuCaps->usedQMP) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to probe QEMU binary with QMP: %s"),
- qmperr ? qmperr : _("unknown error"));
- virQEMUCapsLogProbeFailure(binary);
- goto error;
- }
-
qemuCaps->libvirtCtime = virGetSelfLastChanged();
qemuCaps->libvirtVersion = LIBVIR_VERSION_NUMBER;
}
-/* Returns -1 on fatal error,
- * 0 on success,
- * 1 when probing QEMU failed
- */
int
qemuProcessQMPRun(qemuProcessQMPPtr proc)
{
const char *machine;
int status = 0;
int ret = -1;
+ int rc;
if (proc->forceTCG)
machine = "none,accel=tcg";
virCommandSetErrorBuffer(proc->cmd, proc->qmperr);
- /* Log, but otherwise ignore, non-zero status. */
if (virCommandRun(proc->cmd, &status) < 0)
goto cleanup;
if (status != 0) {
- VIR_DEBUG("QEMU %s exited with status %d: %s",
- proc->binary, status, *proc->qmperr);
- goto ignore;
+ VIR_DEBUG("QEMU %s exited with status %d", proc->binary, status);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to start QEMU binary %s for probing: %s"),
+ proc->binary,
+ *proc->qmperr ? *proc->qmperr : _("unknown error"));
+ goto cleanup;
}
- if (virPidFileReadPath(proc->pidfile, &proc->pid) < 0) {
- VIR_DEBUG("Failed to read pidfile %s", proc->pidfile);
- goto ignore;
+ if ((rc = virPidFileReadPath(proc->pidfile, &proc->pid)) < 0) {
+ virReportSystemError(-rc, _("Failed to read pidfile %s"), proc->pidfile);
+ goto cleanup;
}
if (!(xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL, NULL, NULL)) ||
if (!(proc->mon = qemuMonitorOpen(proc->vm, &proc->config, true, true,
0, &callbacks, NULL)))
- goto ignore;
+ goto cleanup;
virObjectLock(proc->mon);
virObjectUnref(xmlopt);
return ret;
-
- ignore:
- ret = 1;
- goto cleanup;
}