get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/812504/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 812504,
    "url": "http://patchwork.ozlabs.org/api/patches/812504/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170911172022.4738-18-eblake@redhat.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170911172022.4738-18-eblake@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-11T17:20:01",
    "name": "[v7,17/38] libqos: Use explicit QTestState for remaining libqos operations",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "f0c3edfbe80fcc08caead74554ce4526eacbf5a3",
    "submitter": {
        "id": 6591,
        "url": "http://patchwork.ozlabs.org/api/people/6591/?format=api",
        "name": "Eric Blake",
        "email": "eblake@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170911172022.4738-18-eblake@redhat.com/mbox/",
    "series": [
        {
            "id": 2534,
            "url": "http://patchwork.ozlabs.org/api/series/2534/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2534",
            "date": "2017-09-11T17:19:47",
            "name": "Preliminary libqtest cleanups",
            "version": 7,
            "mbox": "http://patchwork.ozlabs.org/series/2534/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/812504/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/812504/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)",
            "ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=eblake@redhat.com"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xrb5d4sYrz9s7F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 03:49:09 +1000 (AEST)",
            "from localhost ([::1]:59474 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1drSpX-00087N-Nq\n\tfor incoming@patchwork.ozlabs.org; Mon, 11 Sep 2017 13:49:07 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:38650)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1drSOa-0007YP-CV\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 13:21:18 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1drSOW-0001HV-L8\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 13:21:16 -0400",
            "from mx1.redhat.com ([209.132.183.28]:58915)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <eblake@redhat.com>)\n\tid 1drSOS-0001G0-Sz; Mon, 11 Sep 2017 13:21:09 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id CF09FCC98A;\n\tMon, 11 Sep 2017 17:21:07 +0000 (UTC)",
            "from red.redhat.com (ovpn-120-44.rdu2.redhat.com [10.10.120.44])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 2F64A5D9CA;\n\tMon, 11 Sep 2017 17:21:01 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com CF09FCC98A",
        "From": "Eric Blake <eblake@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Mon, 11 Sep 2017 12:20:01 -0500",
        "Message-Id": "<20170911172022.4738-18-eblake@redhat.com>",
        "In-Reply-To": "<20170911172022.4738-1-eblake@redhat.com>",
        "References": "<20170911172022.4738-1-eblake@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.14",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.25]);\n\tMon, 11 Sep 2017 17:21:08 +0000 (UTC)",
        "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]",
        "X-Received-From": "209.132.183.28",
        "Subject": "[Qemu-devel] [PATCH v7 17/38] libqos: Use explicit QTestState for\n\tremaining libqos operations",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.21",
        "Precedence": "list",
        "List-Id": "<qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Cc": "thuth@redhat.com, \"open list:IDE\" <qemu-block@nongnu.org>,\n\t\"Aneesh Kumar K.V\" <aneesh.kumar@linux.vnet.ibm.com>,\n\tJason Wang <jasowang@redhat.com>, armbru@redhat.com,\n\tAlexander Graf <agraf@suse.de>, Greg Kurz <groug@kaod.org>,\n\t\"open list:sPAPR\" <qemu-ppc@nongnu.org>,\n\tGerd Hoffmann <kraxel@redhat.com>, \n\tStefan Hajnoczi <stefanha@redhat.com>, pbonzini@redhat.com,\n\tJohn Snow <jsnow@redhat.com>, David Gibson <david@gibson.dropbear.id.au>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"
    },
    "content": "Drop one more client of global_qtest by teaching all remaining\nlibqos stragglers to pass in an explicit QTestState.  Change the\nsetting of global_qtest from being implicit in libqos' call to\nqtest_start() to instead be explicit in all clients that are\nstill relying on global_qtest.\n\nNote that qmp_execute() can be greatly simplified in the process,\nand that we also get rid of interpolation of a JSON string into a\ntemporary variable when qtest_qmp() can do it more reliably.\n\nSigned-off-by: Eric Blake <eblake@redhat.com>\n\n---\nv7: split libqos changes from test-ahci, catch more spots\n---\n tests/ahci-test.c         |  1 +\n tests/ivshmem-test.c      |  1 +\n tests/libqos/libqos-pc.c  |  2 +-\n tests/libqos/libqos.c     | 30 ++++++++++--------------------\n tests/megasas-test.c      |  5 ++++-\n tests/rtas-test.c         |  1 +\n tests/usb-hcd-uhci-test.c |  1 +\n tests/virtio-9p-test.c    |  1 +\n tests/virtio-blk-test.c   |  1 +\n tests/virtio-net-test.c   | 15 +++++++++------\n tests/virtio-scsi-test.c  | 16 +++++++++-------\n 11 files changed, 39 insertions(+), 35 deletions(-)",
    "diff": "diff --git a/tests/ahci-test.c b/tests/ahci-test.c\nindex c94d1bd712..d6696cc370 100644\n--- a/tests/ahci-test.c\n+++ b/tests/ahci-test.c\n@@ -157,6 +157,7 @@ static AHCIQState *ahci_vboot(const char *cli, va_list ap)\n\n     s = g_malloc0(sizeof(AHCIQState));\n     s->parent = qtest_pc_vboot(cli, ap);\n+    global_qtest = s->parent->qts;\n     alloc_set_flags(s->parent->alloc, ALLOC_LEAK_ASSERT);\n\n     /* Verify that we have an AHCI device present. */\ndiff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c\nindex d35c922254..d8f8530a4d 100644\n--- a/tests/ivshmem-test.c\n+++ b/tests/ivshmem-test.c\n@@ -131,6 +131,7 @@ static void setup_vm_cmd(IVState *s, const char *cmd, bool msix)\n         g_printerr(\"ivshmem-test tests are only available on x86 or ppc64\\n\");\n         exit(EXIT_FAILURE);\n     }\n+    global_qtest = s->qs->qts;\n     s->dev = get_device(s->qs->pcibus);\n\n     s->reg_bar = qpci_iomap(s->dev, 0, &barsize);\ndiff --git a/tests/libqos/libqos-pc.c b/tests/libqos/libqos-pc.c\nindex b554758802..a9c1aceaa7 100644\n--- a/tests/libqos/libqos-pc.c\n+++ b/tests/libqos/libqos-pc.c\n@@ -25,7 +25,7 @@ QOSState *qtest_pc_boot(const char *cmdline_fmt, ...)\n     qs = qtest_vboot(&qos_ops, cmdline_fmt, ap);\n     va_end(ap);\n\n-    qtest_irq_intercept_in(global_qtest, \"ioapic\");\n+    qtest_irq_intercept_in(qs->qts, \"ioapic\");\n\n     return qs;\n }\ndiff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c\nindex 40018b9c07..9798e1d027 100644\n--- a/tests/libqos/libqos.c\n+++ b/tests/libqos/libqos.c\n@@ -20,7 +20,7 @@ QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap)\n     QOSState *qs = g_new0(QOSState, 1);\n\n     cmdline = g_strdup_vprintf(cmdline_fmt, ap);\n-    qs->qts = qtest_start(cmdline);\n+    qs->qts = qtest_init(cmdline);\n     qs->ops = ops;\n     if (ops) {\n         qs->alloc = ops->init_allocator(qs->qts, ALLOC_NO_FLAGS);\n@@ -80,29 +80,21 @@ void set_context(QOSState *s)\n     global_qtest = s->qts;\n }\n\n-static QDict *qmp_execute(const char *command)\n+static QDict *qmp_execute(QTestState *qts, const char *command)\n {\n-    char *fmt;\n-    QDict *rsp;\n-\n-    fmt = g_strdup_printf(\"{ 'execute': '%s' }\", command);\n-    rsp = qmp(fmt);\n-    g_free(fmt);\n-\n-    return rsp;\n+    return qtest_qmp(qts, \"{ 'execute': %s }\", command);\n }\n\n void migrate(QOSState *from, QOSState *to, const char *uri)\n {\n     const char *st;\n-    char *s;\n     QDict *rsp, *sub;\n     bool running;\n\n     set_context(from);\n\n     /* Is the machine currently running? */\n-    rsp = qmp_execute(\"query-status\");\n+    rsp = qmp_execute(from->qts, \"query-status\");\n     g_assert(qdict_haskey(rsp, \"return\"));\n     sub = qdict_get_qdict(rsp, \"return\");\n     g_assert(qdict_haskey(sub, \"running\"));\n@@ -110,30 +102,28 @@ void migrate(QOSState *from, QOSState *to, const char *uri)\n     QDECREF(rsp);\n\n     /* Issue the migrate command. */\n-    s = g_strdup_printf(\"{ 'execute': 'migrate',\"\n-                        \"'arguments': { 'uri': '%s' } }\",\n-                        uri);\n-    rsp = qmp(s);\n-    g_free(s);\n+    rsp = qtest_qmp(from->qts,\n+                    \"{ 'execute': 'migrate', 'arguments': { 'uri': %s }}\",\n+                    uri);\n     g_assert(qdict_haskey(rsp, \"return\"));\n     QDECREF(rsp);\n\n     /* Wait for STOP event, but only if we were running: */\n     if (running) {\n-        qmp_eventwait(\"STOP\");\n+        qtest_qmp_eventwait(from->qts, \"STOP\");\n     }\n\n     /* If we were running, we can wait for an event. */\n     if (running) {\n         migrate_allocator(from->alloc, to->alloc);\n         set_context(to);\n-        qmp_eventwait(\"RESUME\");\n+        qtest_qmp_eventwait(to->qts, \"RESUME\");\n         return;\n     }\n\n     /* Otherwise, we need to wait: poll until migration is completed. */\n     while (1) {\n-        rsp = qmp_execute(\"query-migrate\");\n+        rsp = qmp_execute(from->qts, \"query-migrate\");\n         g_assert(qdict_haskey(rsp, \"return\"));\n         sub = qdict_get_qdict(rsp, \"return\");\n         g_assert(qdict_haskey(sub, \"status\"));\ndiff --git a/tests/megasas-test.c b/tests/megasas-test.c\nindex ce960e7f81..81837e14af 100644\n--- a/tests/megasas-test.c\n+++ b/tests/megasas-test.c\n@@ -15,13 +15,16 @@\n\n static QOSState *qmegasas_start(const char *extra_opts)\n {\n+    QOSState *qs;\n     const char *arch = qtest_get_arch();\n     const char *cmd = \"-drive id=hd0,if=none,file=null-co://,format=raw \"\n                       \"-device megasas,id=scsi0,addr=04.0 \"\n                       \"-device scsi-hd,bus=scsi0.0,drive=hd0 %s\";\n\n     if (strcmp(arch, \"i386\") == 0 || strcmp(arch, \"x86_64\") == 0) {\n-        return qtest_pc_boot(cmd, extra_opts ? : \"\");\n+        qs = qtest_pc_boot(cmd, extra_opts ? : \"\");\n+        global_qtest = qs->qts;\n+        return qs;\n     }\n\n     g_printerr(\"virtio-scsi tests are only available on x86 or ppc64\\n\");\ndiff --git a/tests/rtas-test.c b/tests/rtas-test.c\nindex 34a692163f..009bda6d23 100644\n--- a/tests/rtas-test.c\n+++ b/tests/rtas-test.c\n@@ -14,6 +14,7 @@ static void test_rtas_get_time_of_day(void)\n     time_t t1, t2;\n\n     qs = qtest_spapr_boot(\"-machine pseries\");\n+    global_qtest = qs->qts;\n\n     t1 = time(NULL);\n     ret = qrtas_get_time_of_day(qs->qts, qs->alloc, &tm, &ns);\ndiff --git a/tests/usb-hcd-uhci-test.c b/tests/usb-hcd-uhci-test.c\nindex 0fb7f8d223..290416d845 100644\n--- a/tests/usb-hcd-uhci-test.c\n+++ b/tests/usb-hcd-uhci-test.c\n@@ -95,6 +95,7 @@ int main(int argc, char **argv)\n                    \"available on x86 or ppc64\\n\");\n         exit(EXIT_FAILURE);\n     }\n+    global_qtest = qs->qts;\n     ret = g_test_run();\n     qtest_shutdown(qs);\n\ndiff --git a/tests/virtio-9p-test.c b/tests/virtio-9p-test.c\nindex ad33d96387..07cbb7f37c 100644\n--- a/tests/virtio-9p-test.c\n+++ b/tests/virtio-9p-test.c\n@@ -46,6 +46,7 @@ static QVirtIO9P *qvirtio_9p_start(const char *driver)\n         g_printerr(\"virtio-9p tests are only available on x86 or ppc64\\n\");\n         exit(EXIT_FAILURE);\n     }\n+    global_qtest = v9p->qs->qts;\n\n     return v9p;\n }\ndiff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c\nindex 99bb6f26cd..0cf33b6810 100644\n--- a/tests/virtio-blk-test.c\n+++ b/tests/virtio-blk-test.c\n@@ -77,6 +77,7 @@ static QOSState *pci_test_start(void)\n         g_printerr(\"virtio-blk tests are only available on x86 or ppc64\\n\");\n         exit(EXIT_FAILURE);\n     }\n+    global_qtest = qs->qts;\n     unlink(tmp_path);\n     g_free(tmp_path);\n     return qs;\ndiff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c\nindex 8b43d3dd65..acecef0a3e 100644\n--- a/tests/virtio-net-test.c\n+++ b/tests/virtio-net-test.c\n@@ -53,18 +53,21 @@ static QVirtioPCIDevice *virtio_net_pci_init(QPCIBus *bus, int slot)\n\n static QOSState *pci_test_start(int socket)\n {\n+    QOSState *qs;\n     const char *arch = qtest_get_arch();\n     const char *cmd = \"-netdev socket,fd=%d,id=hs0 -device \"\n                       \"virtio-net-pci,netdev=hs0\";\n\n     if (strcmp(arch, \"i386\") == 0 || strcmp(arch, \"x86_64\") == 0) {\n-        return qtest_pc_boot(cmd, socket);\n+        qs = qtest_pc_boot(cmd, socket);\n+    } else if (strcmp(arch, \"ppc64\") == 0) {\n+        qs = qtest_spapr_boot(cmd, socket);\n+    } else {\n+        g_printerr(\"virtio-net tests are only available on x86 or ppc64\\n\");\n+        exit(EXIT_FAILURE);\n     }\n-    if (strcmp(arch, \"ppc64\") == 0) {\n-        return qtest_spapr_boot(cmd, socket);\n-    }\n-    g_printerr(\"virtio-net tests are only available on x86 or ppc64\\n\");\n-    exit(EXIT_FAILURE);\n+    global_qtest = qs->qts;\n+    return qs;\n }\n\n static void driver_init(QVirtioDevice *dev)\ndiff --git a/tests/virtio-scsi-test.c b/tests/virtio-scsi-test.c\nindex 87a3b6e81a..4d544ddbc3 100644\n--- a/tests/virtio-scsi-test.c\n+++ b/tests/virtio-scsi-test.c\n@@ -34,20 +34,22 @@ typedef struct {\n\n static QOSState *qvirtio_scsi_start(const char *extra_opts)\n {\n+    QOSState *qs;\n     const char *arch = qtest_get_arch();\n     const char *cmd = \"-drive id=drv0,if=none,file=null-co://,format=raw \"\n                       \"-device virtio-scsi-pci,id=vs0 \"\n                       \"-device scsi-hd,bus=vs0.0,drive=drv0 %s\";\n\n     if (strcmp(arch, \"i386\") == 0 || strcmp(arch, \"x86_64\") == 0) {\n-        return qtest_pc_boot(cmd, extra_opts ? : \"\");\n+        qs = qtest_pc_boot(cmd, extra_opts ? : \"\");\n+    } else if (strcmp(arch, \"ppc64\") == 0) {\n+        qs = qtest_spapr_boot(cmd, extra_opts ? : \"\");\n+    } else {\n+        g_printerr(\"virtio-scsi tests are only available on x86 or ppc64\\n\");\n+        exit(EXIT_FAILURE);\n     }\n-    if (strcmp(arch, \"ppc64\") == 0) {\n-        return qtest_spapr_boot(cmd, extra_opts ? : \"\");\n-    }\n-\n-    g_printerr(\"virtio-scsi tests are only available on x86 or ppc64\\n\");\n-    exit(EXIT_FAILURE);\n+    global_qtest = qs->qts;\n+    return qs;\n }\n\n static void qvirtio_scsi_stop(QOSState *qs)\n",
    "prefixes": [
        "v7",
        "17/38"
    ]
}