From nobody Fri Dec 19 19:20:14 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1561391876; cv=none; d=zoho.com; s=zohoarc; b=RhQK8rrTbnOF3dF/Gb/OhNwgsDOggXNGgRz5lBY41T/+i3f0cmYm2ovs/uzUTTERwv/8v37YyhrO8YZW+tCJRRf1w1Molui7k4H78Y7osuQ/Dj9diD9y4y9AYkYgdSTgMoAhMquhrx4WGQG2xZzPHHmOx74+3xXsNGtjsVPuT8g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561391876; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=wHx6wMlQSLAUhzVawBNm80ItncQxdqa/nWCPEtQQaQM=; b=hsY3bzCxrKACbVwdR8s+ECX8gEvtcvyiIFRWuVhkcRiNefIC1TZWG0xlq5Zcs+8IyyzcwtBnFo7MNe0xp8mnqMLmMJqL1XBQFZmzobJVZ8SVfKGscVDsCMU5qPE++ENlbnofjZ5GJNGNycWqVtAgTolmMnYirdPUIeel61RXZVc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1561391876995394.3923397640766; Mon, 24 Jun 2019 08:57:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 66C66307D983; Mon, 24 Jun 2019 15:57:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3E9D25C25A; Mon, 24 Jun 2019 15:57:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 030D11806B1B; Mon, 24 Jun 2019 15:57:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5OFt3uN014589 for ; Mon, 24 Jun 2019 11:55:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id E15CF1001DE9; Mon, 24 Jun 2019 15:55:03 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 680971001DEA for ; Mon, 24 Jun 2019 15:55:03 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 24 Jun 2019 17:54:52 +0200 Message-Id: <95e54f541034c36268c579b4e5603ea36ab00243.1561391499.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/9] qemu: monitor: Add support for 'job-cancel' command X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 24 Jun 2019 15:57:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This belongs to the new job management API which can manage also non-block based jobs. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_monitor.c | 12 ++++++++++++ src/qemu/qemu_monitor.h | 4 ++++ src/qemu/qemu_monitor_json.c | 22 ++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 4 ++++ tests/qemumonitorjsontest.c | 2 ++ 5 files changed, 44 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index d9196434ba..815ce58b69 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3475,6 +3475,18 @@ qemuMonitorJobDismiss(qemuMonitorPtr mon, } +int +qemuMonitorJobCancel(qemuMonitorPtr mon, + const char *jobname) +{ + VIR_DEBUG("jobname=3D%s", jobname); + + QEMU_CHECK_MONITOR(mon); + + return qemuMonitorJSONJobCancel(mon, jobname); +} + + int qemuMonitorSetBlockIoThrottle(qemuMonitorPtr mon, const char *drivealias, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 56c68683f5..b306ff0314 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -991,6 +991,10 @@ int qemuMonitorJobDismiss(qemuMonitorPtr mon, const char *jobname) ATTRIBUTE_NONNULL(2); +int qemuMonitorJobCancel(qemuMonitorPtr mon, + const char *jobname) + ATTRIBUTE_NONNULL(2); + int qemuMonitorOpenGraphics(qemuMonitorPtr mon, const char *protocol, int fd, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 2ef2299a68..84b5c30577 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5088,6 +5088,28 @@ qemuMonitorJSONJobDismiss(qemuMonitorPtr mon, } +int +qemuMonitorJSONJobCancel(qemuMonitorPtr mon, + const char *jobname) +{ + VIR_AUTOPTR(virJSONValue) cmd =3D NULL; + VIR_AUTOPTR(virJSONValue) reply =3D NULL; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("job-cancel", + "s:id", jobname, + NULL))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + return -1; + + if (qemuMonitorJSONBlockJobError(cmd, reply, jobname) < 0) + return -1; + + return 0; +} + + int qemuMonitorJSONOpenGraphics(qemuMonitorPtr mon, const char *protocol, const char *fdname, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 1719509ec8..aeaf332943 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -332,6 +332,10 @@ int qemuMonitorJSONJobDismiss(qemuMonitorPtr mon, const char *jobname) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); +int qemuMonitorJSONJobCancel(qemuMonitorPtr mon, + const char *jobname) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + int qemuMonitorJSONSetLink(qemuMonitorPtr mon, const char *name, virDomainNetInterfaceLinkState state); diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index e872f93490..eabd834861 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1341,6 +1341,7 @@ GEN_TEST_FUNC(qemuMonitorJSONAddBitmap, "node", "bitm= ap", true) GEN_TEST_FUNC(qemuMonitorJSONEnableBitmap, "node", "bitmap") GEN_TEST_FUNC(qemuMonitorJSONDeleteBitmap, "node", "bitmap") GEN_TEST_FUNC(qemuMonitorJSONJobDismiss, "jobname") +GEN_TEST_FUNC(qemuMonitorJSONJobCancel, "jobname") static int testQemuMonitorJSONqemuMonitorJSONNBDServerStart(const void *opaque) @@ -3059,6 +3060,7 @@ mymain(void) DO_TEST_GEN(qemuMonitorJSONEnableBitmap); DO_TEST_GEN(qemuMonitorJSONDeleteBitmap); DO_TEST_GEN(qemuMonitorJSONJobDismiss); + DO_TEST_GEN(qemuMonitorJSONJobCancel); DO_TEST(qemuMonitorJSONGetBalloonInfo); DO_TEST(qemuMonitorJSONGetBlockInfo); DO_TEST(qemuMonitorJSONGetAllBlockStatsInfo); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list