Re: [PATCH 6/6 V4] qemu, inject-nmi: Implement the driver methods

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/10/2011 02:26 AM, Lai Jiangshan wrote:
> +int qemuMonitorJSONInjectNMI(qemuMonitorPtr mon)
> +{
> +    int ret;
> +    virJSONValuePtr cmd;
> +    virJSONValuePtr reply = NULL;
> +
> +    cmd = qemuMonitorJSONMakeCommand("inject-nmi", NULL);
> +    if (!cmd)
> +        return -1;
> +
> +    if ((ret = qemuMonitorJSONCommand(mon, cmd, &reply)) < 0)
> +        goto cleanup;
> +
> +    if (qemuMonitorJSONHasError(reply, "CommandNotFound") &&
> +        qemuMonitorCheckHMP(mon, "inject-nmi")) {
> +        VIR_DEBUG0("inject-nmi command not found, trying HMP");
> +        ret = qemuMonitorTextInjectNMI(mon);


> +
> +int qemuMonitorTextInjectNMI(qemuMonitorPtr mon)
> +{
> +    const char *cmd = "inject-nmi";
> +    char *reply = NULL;
> +
> +    if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
> +       goto fail;
> +
> +    if (strstr(reply, "unknown command") != NULL) {
> +        VIR_FREE(reply);
> +
> +        /* fallback to 'nmi' if qemu has not supported "inject-nmi" yet. */
> +        cmd = "nmi 0";
> +        reply = NULL;
> +        if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)

I just noticed that upstream qemu now has QMP 'inject-nmi' (commit
a404666), and that as a result, HMP 'nmi' command no longer takes an
integer option (commit e9b4b43).  If libvirt uses QMP, then this is not
an issue, but if libvirt uses HMP while talking to a newer qemu, is this
attempt to do 'nmi 0' going to cause a syntax error?  That is, do we
need a patch to libvirt to detect a usage error with 'nmi 0' on hmp that
falls back to trying plain 'nmi' before giving up altogether?

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]