Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/810172/?format=api
{ "id": 810172, "url": "http://patchwork.ozlabs.org/api/patches/810172/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170905132908.30931-4-stefanha@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": "<20170905132908.30931-4-stefanha@redhat.com>", "list_archive_url": null, "date": "2017-09-05T13:29:07", "name": "[PULL,3/4] qemu-iotests: use context managers for resource cleanup in 194", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "9e16b635836c5985341887bc17cf71bb4840317e", "submitter": { "id": 17227, "url": "http://patchwork.ozlabs.org/api/people/17227/?format=api", "name": "Stefan Hajnoczi", "email": "stefanha@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170905132908.30931-4-stefanha@redhat.com/mbox/", "series": [ { "id": 1584, "url": "http://patchwork.ozlabs.org/api/series/1584/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=1584", "date": "2017-09-05T13:29:04", "name": "[PULL,1/4] qemu.py: make VM() a context manager", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/1584/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/810172/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/810172/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-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=stefanha@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 3xmndj3pS7z9t2S\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 5 Sep 2017 23:30:17 +1000 (AEST)", "from localhost ([::1]:58949 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 1dpDvj-0000tD-Ic\n\tfor incoming@patchwork.ozlabs.org; Tue, 05 Sep 2017 09:30:15 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:51285)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <stefanha@redhat.com>) id 1dpDux-0000mL-02\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 09:29:32 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <stefanha@redhat.com>) id 1dpDur-0003ti-Vf\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 09:29:26 -0400", "from mx1.redhat.com ([209.132.183.28]:55296)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <stefanha@redhat.com>) id 1dpDur-0003t2-Ln\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 09:29:21 -0400", "from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\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 A50C1C047B72;\n\tTue, 5 Sep 2017 13:29:20 +0000 (UTC)", "from localhost (ovpn-117-180.ams2.redhat.com [10.36.117.180])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id F1D75835CD;\n\tTue, 5 Sep 2017 13:29:19 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com A50C1C047B72", "From": "Stefan Hajnoczi <stefanha@redhat.com>", "To": "<qemu-devel@nongnu.org>", "Date": "Tue, 5 Sep 2017 14:29:07 +0100", "Message-Id": "<20170905132908.30931-4-stefanha@redhat.com>", "In-Reply-To": "<20170905132908.30931-1-stefanha@redhat.com>", "References": "<20170905132908.30931-1-stefanha@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tTue, 05 Sep 2017 13:29:20 +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] [PULL 3/4] qemu-iotests: use context managers for\n\tresource cleanup in 194", "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": "Peter Maydell <peter.maydell@linaro.org>,\n\tStefan Hajnoczi <stefanha@redhat.com>", "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": "Switch from atexit.register() to a more elegant idiom of declaring\nresources in a with statement:\n\n with FilePath('monitor.sock') as monitor_path,\n VM() as vm:\n ...\n\nThe files and VMs will be automatically cleaned up whether the test\npasses or fails.\n\nSigned-off-by: Stefan Hajnoczi <stefanha@redhat.com>\nMessage-id: 20170824072202.26818-4-stefanha@redhat.com\nSigned-off-by: Stefan Hajnoczi <stefanha@redhat.com>\n---\n tests/qemu-iotests/194 | 117 ++++++++++++++++++++++++-------------------------\n 1 file changed, 58 insertions(+), 59 deletions(-)", "diff": "diff --git a/tests/qemu-iotests/194 b/tests/qemu-iotests/194\nindex a3e3bad664..6449b9b64a 100755\n--- a/tests/qemu-iotests/194\n+++ b/tests/qemu-iotests/194\n@@ -19,66 +19,65 @@\n #\n # Non-shared storage migration test using NBD server and drive-mirror\n \n-import os\n-import atexit\n import iotests\n \n iotests.verify_platform(['linux'])\n \n-img_size = '1G'\n-source_img_path = os.path.join(iotests.test_dir, 'source.img')\n-dest_img_path = os.path.join(iotests.test_dir, 'dest.img')\n-iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, source_img_path, img_size)\n-iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, dest_img_path, img_size)\n-\n-iotests.log('Launching VMs...')\n-migration_sock_path = os.path.join(iotests.test_dir, 'migration.sock')\n-nbd_sock_path = os.path.join(iotests.test_dir, 'nbd.sock')\n-source_vm = iotests.VM('source').add_drive(source_img_path)\n-dest_vm = (iotests.VM('dest').add_drive(dest_img_path)\n- .add_incoming('unix:{0}'.format(migration_sock_path)))\n-source_vm.launch()\n-atexit.register(source_vm.shutdown)\n-dest_vm.launch()\n-atexit.register(dest_vm.shutdown)\n-\n-iotests.log('Launching NBD server on destination...')\n-iotests.log(dest_vm.qmp('nbd-server-start', addr={'type': 'unix', 'data': {'path': nbd_sock_path}}))\n-iotests.log(dest_vm.qmp('nbd-server-add', device='drive0', writable=True))\n-\n-iotests.log('Starting `drive-mirror` on source...')\n-iotests.log(source_vm.qmp(\n- 'drive-mirror',\n- device='drive0',\n- target='nbd+unix:///drive0?socket={0}'.format(nbd_sock_path),\n- sync='full',\n- format='raw', # always raw, the server handles the format\n- mode='existing',\n- job_id='mirror-job0'))\n-\n-iotests.log('Waiting for `drive-mirror` to complete...')\n-iotests.log(source_vm.event_wait('BLOCK_JOB_READY'),\n- filters=[iotests.filter_qmp_event])\n-\n-iotests.log('Starting migration...')\n-source_vm.qmp('migrate-set-capabilities',\n- capabilities=[{'capability': 'events', 'state': True}])\n-dest_vm.qmp('migrate-set-capabilities',\n- capabilities=[{'capability': 'events', 'state': True}])\n-iotests.log(source_vm.qmp('migrate', uri='unix:{0}'.format(migration_sock_path)))\n-\n-while True:\n- event1 = source_vm.event_wait('MIGRATION')\n- iotests.log(event1, filters=[iotests.filter_qmp_event])\n- if event1['data']['status'] in ('completed', 'failed'):\n- iotests.log('Gracefully ending the `drive-mirror` job on source...')\n- iotests.log(source_vm.qmp('block-job-cancel', device='mirror-job0'))\n- break\n-\n-while True:\n- event2 = source_vm.event_wait('BLOCK_JOB_COMPLETED')\n- iotests.log(event2, filters=[iotests.filter_qmp_event])\n- if event2['event'] == 'BLOCK_JOB_COMPLETED':\n- iotests.log('Stopping the NBD server on destination...')\n- iotests.log(dest_vm.qmp('nbd-server-stop'))\n- break\n+with iotests.FilePath('source.img') as source_img_path, \\\n+ iotests.FilePath('dest.img') as dest_img_path, \\\n+ iotests.FilePath('migration.sock') as migration_sock_path, \\\n+ iotests.FilePath('nbd.sock') as nbd_sock_path, \\\n+ iotests.VM('source') as source_vm, \\\n+ iotests.VM('dest') as dest_vm:\n+\n+ img_size = '1G'\n+ iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, source_img_path, img_size)\n+ iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, dest_img_path, img_size)\n+\n+ iotests.log('Launching VMs...')\n+ (source_vm.add_drive(source_img_path)\n+ .launch())\n+ (dest_vm.add_drive(dest_img_path)\n+ .add_incoming('unix:{0}'.format(migration_sock_path))\n+ .launch())\n+\n+ iotests.log('Launching NBD server on destination...')\n+ iotests.log(dest_vm.qmp('nbd-server-start', addr={'type': 'unix', 'data': {'path': nbd_sock_path}}))\n+ iotests.log(dest_vm.qmp('nbd-server-add', device='drive0', writable=True))\n+\n+ iotests.log('Starting `drive-mirror` on source...')\n+ iotests.log(source_vm.qmp(\n+ 'drive-mirror',\n+ device='drive0',\n+ target='nbd+unix:///drive0?socket={0}'.format(nbd_sock_path),\n+ sync='full',\n+ format='raw', # always raw, the server handles the format\n+ mode='existing',\n+ job_id='mirror-job0'))\n+\n+ iotests.log('Waiting for `drive-mirror` to complete...')\n+ iotests.log(source_vm.event_wait('BLOCK_JOB_READY'),\n+ filters=[iotests.filter_qmp_event])\n+\n+ iotests.log('Starting migration...')\n+ source_vm.qmp('migrate-set-capabilities',\n+ capabilities=[{'capability': 'events', 'state': True}])\n+ dest_vm.qmp('migrate-set-capabilities',\n+ capabilities=[{'capability': 'events', 'state': True}])\n+ iotests.log(source_vm.qmp('migrate', uri='unix:{0}'.format(migration_sock_path)))\n+\n+ while True:\n+ event1 = source_vm.event_wait('MIGRATION')\n+ iotests.log(event1, filters=[iotests.filter_qmp_event])\n+ if event1['data']['status'] in ('completed', 'failed'):\n+ iotests.log('Gracefully ending the `drive-mirror` job on source...')\n+ iotests.log(source_vm.qmp('block-job-cancel', device='mirror-job0'))\n+ break\n+\n+ while True:\n+ event2 = source_vm.event_wait('BLOCK_JOB_COMPLETED')\n+ iotests.log(event2, filters=[iotests.filter_qmp_event])\n+ if event2['event'] == 'BLOCK_JOB_COMPLETED':\n+ iotests.log('Stopping the NBD server on destination...')\n+ iotests.log(dest_vm.qmp('nbd-server-stop'))\n+ break\n", "prefixes": [ "PULL", "3/4" ] }