From patchwork Thu Jun 9 12:15:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 69708 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp296167qgf; Thu, 9 Jun 2016 05:19:06 -0700 (PDT) X-Received: by 10.28.207.13 with SMTP id f13mr3475843wmg.53.1465474746860; Thu, 09 Jun 2016 05:19:06 -0700 (PDT) Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com. [209.132.183.25]) by mx.google.com with ESMTPS id x8si7535312wje.187.2016.06.09.05.19.06 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 09 Jun 2016 05:19:06 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u59CGTHS008869; Thu, 9 Jun 2016 08:16:29 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u59CGKZw016521 for ; Thu, 9 Jun 2016 08:16:20 -0400 Received: from colepc.redhat.com (ovpn-116-214.phx2.redhat.com [10.3.116.214]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u59CGJhC011190; Thu, 9 Jun 2016 08:16:20 -0400 From: Cole Robinson To: libvirt-list@redhat.com Date: Thu, 9 Jun 2016 08:15:53 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] qemu: More usage of qemuDomainDiskBlockJobIsActive 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: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com qemuDomainDiskBlockJobIsActive already checks if a disk has a blockjob, and if so, raises an error --- src/qemu/qemu_driver.c | 7 +------ src/qemu/qemu_hotplug.c | 6 +----- 2 files changed, 2 insertions(+), 11 deletions(-) -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e70d3ce..e251194 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13716,15 +13716,10 @@ qemuDomainSnapshotPrepare(virConnectPtr conn, for (i = 0; i < def->ndisks; i++) { virDomainSnapshotDiskDefPtr disk = &def->disks[i]; virDomainDiskDefPtr dom_disk = vm->def->disks[i]; - qemuDomainDiskPrivatePtr dom_diskPriv = QEMU_DOMAIN_DISK_PRIVATE(dom_disk); if (disk->snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_NONE && - dom_diskPriv->blockjob) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk '%s' has an active block job"), - disk->name); + qemuDomainDiskBlockJobIsActive(dom_disk)) goto cleanup; - } switch ((virDomainSnapshotLocation) disk->snapshot) { case VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL: diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 6ce0a84..8c9e7ed 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3429,12 +3429,8 @@ qemuDomainDetachDiskDevice(virQEMUDriverPtr driver, int ret = -1; qemuDomainObjPrivatePtr priv = vm->privateData; - if (detach->mirror) { - virReportError(VIR_ERR_BLOCK_COPY_ACTIVE, - _("disk '%s' is in an active block job"), - detach->dst); + if (qemuDomainDiskBlockJobIsActive(detach)) goto cleanup; - } qemuDomainMarkDeviceForRemoval(vm, &detach->info);