From nobody Sat May 4 21:18:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1606129175; cv=none; d=zohomail.com; s=zohoarc; b=fC8JXhqxPHJmzgLMajBnGGvU6jznnVgA14K0qAPf5ibtfcdwA7+GAsu9k4DQbg/MronLt74b6EPpn7/XLdb2NdVw3zjg3lJZPIk8LZCqCKb4JdJB2M3+t9ZCPVGyp6KXQePzCidtKYXiaY19LqFcDTNK0hY8AaXYDO6TAGjYP4Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606129175; 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; bh=fn6Aqat92yBMiIrOfCsljytfqMorcYPf4jKhrRGZcF8=; b=RW/0dX2h0tL5H7FUlIoyb36DQpAFzExzB/gM6MblHx34r8YZBRFCRmIkoCwIS28ZbV8I5NoRZJ0y9pvzx1Vy9Hx+D3xXGcK7mue8R2vtJaA4mKEm6ybdX5t4TB5hlPF0Bn3lFQ6AaehLbFrM+eeLDyhjcXIRj7RlAqNPPERl+5c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 160612917582378.58648355499122; Mon, 23 Nov 2020 02:59:35 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-13-OtU66nv9OWGLWWvlOdzKCQ-1; Mon, 23 Nov 2020 05:59:32 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0EBA39CC09; Mon, 23 Nov 2020 10:59:26 +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 D65325D9E3; Mon, 23 Nov 2020 10:59:25 +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 9CA7B180954D; Mon, 23 Nov 2020 10:59:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ANAxMVF004018 for ; Mon, 23 Nov 2020 05:59:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 849C25D9E2; Mon, 23 Nov 2020 10:59:22 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 924045D9CC for ; Mon, 23 Nov 2020 10:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606129174; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=fn6Aqat92yBMiIrOfCsljytfqMorcYPf4jKhrRGZcF8=; b=XJaN1CVQv3LPbZpY5Rb46EbFDmWre2RSH5NLBzQ7Cx3yPEbr56oUm8g5gEJR3fateVsiV4 L5NjCRzYXtR+cIgMn3gxgFk0tYYRScV+vd/ahJRVI3s4OYHzEN3qWWLXXkTJ5wuJvw4htH 2a1hCKzp75WDbN8MUOT0ePvoUa8p4D8= X-MC-Unique: OtU66nv9OWGLWWvlOdzKCQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/5] virCommandAddArg: Don't abort on invalid input Date: Mon, 23 Nov 2020 11:59:12 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Commit 912c6b22fc622cd7c7d29c7f8eaeb816b266daac added abort() when the 'val' parameter is NULL along with setting the error variable for the command. We don't want to abort in this case, just set the error. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/vircommand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 9a4f3d7f32..5117467c1d 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -1503,7 +1503,7 @@ virCommandAddArg(virCommandPtr cmd, const char *val) if (val =3D=3D NULL) { cmd->has_error =3D EINVAL; - abort(); + return; } arg =3D g_strdup(val); --=20 2.28.0 From nobody Sat May 4 21:18:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1606129180; cv=none; d=zohomail.com; s=zohoarc; b=ZTQE8fXnQEP+hRiMg+MLHUVffAEfm0+YFbs1AFT8REJfAAo+nk+CUHUGNG3vGDnv1OK3L93cY7TM/lwvbRb2BMUX3/nvwF4c7qbty4P18Oben/voiZSN0aDTYMWO+2lkBBhg1D5qa2IgZEAGsKV/fvGpnSkIrZOPssPXbWSVLOA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606129180; 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; bh=q0/ujl7FwP+bahaSqqb8cWPu2W7Q4IAhZlmXPRRq3Ak=; b=FU+wce3i2OznXwTsXsXfRWx2NxGNBI6b7fhviYv9+ywBI6jHvsOpuzMgVznQqOJbG0SaCx8SWlgSEL0Va0anyxSGFi/fz+usrv1M76zT+619yo478qNiV1emQyKNfEyYNBwNjoquzmFBPNy89JEaX/9z/9K6Y2tLLPOVFbWtnqo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1606129180918529.6034432247029; Mon, 23 Nov 2020 02:59:40 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-465-6272INY2OmqBNrAq52lZ8w-1; Mon, 23 Nov 2020 05:59:37 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EA0A09CC12; Mon, 23 Nov 2020 10:59:30 +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 88EB05D9E3; Mon, 23 Nov 2020 10:59:30 +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 72A6D1809CA1; Mon, 23 Nov 2020 10:59:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ANAxQIw004036 for ; Mon, 23 Nov 2020 05:59:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 762DE5D9CC; Mon, 23 Nov 2020 10:59:26 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD7F85D9E2 for ; Mon, 23 Nov 2020 10:59:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606129179; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=q0/ujl7FwP+bahaSqqb8cWPu2W7Q4IAhZlmXPRRq3Ak=; b=EZHHjnSMU3kmLqOv4pMzYil08WA9miKvMFVMKqzKZRh5ivWs/QAsKqiGc7LmDQAnXvB/9F 6EEWslChlhGam7nhgbnhPHC30jQsS3DQiiqnByknkHO8FSklwahAXwbcsTsjxhleMJu0wH hALUk6oA6rCT2EvOpV8D06sCVjeExP8= X-MC-Unique: 6272INY2OmqBNrAq52lZ8w-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/5] virDomainDiskTranslateSourcePool: Don't break error message in half Date: Mon, 23 Nov 2020 11:59:13 +0100 Message-Id: <1de1206d0b772438d84125d299f51cdee39dee2a.1606129084.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2393bf6a37..b1534dcc1e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -32847,8 +32847,7 @@ virDomainDiskTranslateSourcePool(virDomainDiskDefPt= r def) if (def->startupPolicy !=3D 0 && virStorageSourceGetActualType(def->src) !=3D VIR_STORAGE_TYPE_FILE= ) { virReportError(VIR_ERR_XML_ERROR, "%s", - _("'startupPolicy' is only valid for " - "'file' type volume")); + _("'startupPolicy' is only valid for 'file' type vo= lume")); return -1; } --=20 2.28.0 From nobody Sat May 4 21:18:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1606129181; cv=none; d=zohomail.com; s=zohoarc; b=i0NTy8RIvUghY5Icf08U3pI+HFU2PFce7f848Tr6a8EjUYSljOxd5vnWpgfPItWwjqkfbLJ+DJzF6hhR73AA018EEmQ9LOf5pifVYBIuwEAeZsxpL6jy5I1Ia8ejqx6eKUpTEW8C/GSP2vXqwY2UVGx5g8OerAIVSk1/AP+tIDA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606129181; 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; bh=g4bTLoPaGLhfCnaAyGULn4J/5GmYdh30uJ3ynMvHdWA=; b=YlfXvN+rDeKGngnDB+058CSvDvwsiExfiaAKgk+MZh3gV1hPd1jetMQWywUMRq3/s0KZQzcnzIqDUq/fk/gUmjd2KkfrchA8seVqf2nm4JEzuGq/7qzCkB+sZXtWTacNWxcWhADQl2JFekSMWxEcUiSwYJRDGYbv+MylPqj7JaU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606129181742334.137673777709; Mon, 23 Nov 2020 02:59:41 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-294-ozYtpKncPU6KgL_cKXUmHA-1; Mon, 23 Nov 2020 05:59:38 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 17C93106F6F2; Mon, 23 Nov 2020 10:59:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ADA6F4D; Mon, 23 Nov 2020 10:59:30 +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 69E274E58F; Mon, 23 Nov 2020 10:59:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ANAxROP004045 for ; Mon, 23 Nov 2020 05:59:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 830955D9E2; Mon, 23 Nov 2020 10:59:27 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id E4A2E5D9CC for ; Mon, 23 Nov 2020 10:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606129180; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=g4bTLoPaGLhfCnaAyGULn4J/5GmYdh30uJ3ynMvHdWA=; b=IrGZ8aI7XrRTGMHI27ZUbOiM9e5aE9qdOe39ejnWCbh9Hi3TQRT8HBlWDGMs5ePSZfFphu oVUUwerLGiewxS9MNw9d5dniaQUXsZFB4SPSRwTb0Q8oNOZW+7eKu9kBid/Mu6UrcAZaEp +ESLHevb55g+7GL8EHSUn5HsIVLVIuI= X-MC-Unique: ozYtpKncPU6KgL_cKXUmHA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/5] qemuDomainSnapshotForEachQcow2Raw: Avoid a level of indentation Date: Mon, 23 Nov 2020 11:59:14 +0100 Message-Id: <4c4722344688b6b0b2c4185c62a76c2a2323bf45.1606129084.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" 'continue' the loop if the device is not a disk. Saving the level makes one of the error messages fit on a single line. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 73 +++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1a80aa4c69..c8f721b00d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6501,49 +6501,48 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriverPtr = driver, for (i =3D 0; i < ndisks; i++) { g_autoptr(virCommand) cmd =3D virCommandNewArgList(qemuimgbin, "sn= apshot", op, name, NULL); + int format =3D virDomainDiskGetFormat(def->disks[i]); /* FIXME: we also need to handle LVM here */ - if (def->disks[i]->device =3D=3D VIR_DOMAIN_DISK_DEVICE_DISK) { - int format =3D virDomainDiskGetFormat(def->disks[i]); + if (def->disks[i]->device !=3D VIR_DOMAIN_DISK_DEVICE_DISK) + continue; - if (format > 0 && format !=3D VIR_STORAGE_FILE_QCOW2) { - if (try_all) { - /* Continue on even in the face of error, since other - * disks in this VM may have the same snapshot name. - */ - VIR_WARN("skipping snapshot action on %s", - def->disks[i]->dst); - skipped =3D true; - continue; - } else if (STREQ(op, "-c") && i) { - /* We must roll back partial creation by deleting - * all earlier snapshots. */ - qemuDomainSnapshotForEachQcow2Raw(driver, def, name, - "-d", false, i); - } - virReportError(VIR_ERR_OPERATION_INVALID, - _("Disk device '%s' does not support" - " snapshotting"), - def->disks[i]->dst); - return -1; + if (format > 0 && format !=3D VIR_STORAGE_FILE_QCOW2) { + if (try_all) { + /* Continue on even in the face of error, since other + * disks in this VM may have the same snapshot name. + */ + VIR_WARN("skipping snapshot action on %s", + def->disks[i]->dst); + skipped =3D true; + continue; + } else if (STREQ(op, "-c") && i) { + /* We must roll back partial creation by deleting + * all earlier snapshots. */ + qemuDomainSnapshotForEachQcow2Raw(driver, def, name, + "-d", false, i); } + virReportError(VIR_ERR_OPERATION_INVALID, + _("Disk device '%s' does not support snapshotti= ng"), + def->disks[i]->dst); + return -1; + } - virCommandAddArg(cmd, virDomainDiskGetSource(def->disks[i])); - - if (virCommandRun(cmd, NULL) < 0) { - if (try_all) { - VIR_WARN("skipping snapshot action on %s", - def->disks[i]->dst); - skipped =3D true; - continue; - } else if (STREQ(op, "-c") && i) { - /* We must roll back partial creation by deleting - * all earlier snapshots. */ - qemuDomainSnapshotForEachQcow2Raw(driver, def, name, - "-d", false, i); - } - return -1; + virCommandAddArg(cmd, virDomainDiskGetSource(def->disks[i])); + + if (virCommandRun(cmd, NULL) < 0) { + if (try_all) { + VIR_WARN("skipping snapshot action on %s", + def->disks[i]->dst); + skipped =3D true; + continue; + } else if (STREQ(op, "-c") && i) { + /* We must roll back partial creation by deleting + * all earlier snapshots. */ + qemuDomainSnapshotForEachQcow2Raw(driver, def, name, + "-d", false, i); } + return -1; } } --=20 2.28.0 From nobody Sat May 4 21:18:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1606129182; cv=none; d=zohomail.com; s=zohoarc; b=SaKEf/KTy+ARxESlmIrg3cCa2pA0WUHId+CvoqPOxNlVGTT1S2WD3TfdbqZZ99yCOLBp/VKCIbN3SjAXN03ShoftLVwenUFrbk1FNEBqcwE3UAO+rld6uN6td52yQ1W2xyWyAioQekwPc8m+LH/YvlSUiPU+o4l2y+5B/t6qGhY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606129182; 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; bh=UesiNbNC0LcPJK244zUBW5V5brPk/fAhEi4cumdpfrI=; b=e98ZA3WSIETmOLPMM6y4bP9AtLzAJrfuC6yGiPdeEZKeuQXW7Bqz+ZR4A9Uifzo6aHMd/QW+CYcQ//7u+2HL7KJv1hhS8Qvhmqzis25vpSKinxovaJ+Qy/cJ8VyQnzOuLBzZMcMD42argA+qmolA3tbm+VSG9Q5b+M7hG1xA1YY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606129182971685.8092657041145; Mon, 23 Nov 2020 02:59:42 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-366-9UlVm2hyPRCc2oKcRutEAw-1; Mon, 23 Nov 2020 05:59:39 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 848B9106F6EC; Mon, 23 Nov 2020 10:59:32 +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 5EAF95D6DC; Mon, 23 Nov 2020 10:59:32 +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 24FFD1809CA2; Mon, 23 Nov 2020 10:59:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ANAxS0I004051 for ; Mon, 23 Nov 2020 05:59:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 91B0D5D9E2; Mon, 23 Nov 2020 10:59:28 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id E371D5D9CC for ; Mon, 23 Nov 2020 10:59:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606129181; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=UesiNbNC0LcPJK244zUBW5V5brPk/fAhEi4cumdpfrI=; b=OcpQeOFHxuWz+aH8Gajgrx3dWBywVHly3S+NoVgXlPGxqZLIfS5DWQCIiYe57f5mIZyohD k6HRyDufObxUbX/OpFx4fU2wDOqrfQb5M+1OzUsEwoEUNxRMqeU+xOJnuD5lOZowe6i/aT dSGnOYIWZFT8HJdytfTCJq8L5/l8hBo= X-MC-Unique: 9UlVm2hyPRCc2oKcRutEAw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/5] qemuDomainSnapshotForEachQcow2Raw: Lock out operation on unsupported storage Date: Mon, 23 Nov 2020 11:59:15 +0100 Message-Id: <853b0fee6a9e4d2aaf696d45220be18b7ac5fc98.1606129084.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Don't try to manipulate snapshots on network or unresolved volume backed storage. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c8f721b00d..c782810839 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6507,6 +6507,13 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriverPtr d= river, if (def->disks[i]->device !=3D VIR_DOMAIN_DISK_DEVICE_DISK) continue; + if (!virStorageSourceIsLocalStorage(def->disks[i]->src)) { + virReportError(VIR_ERR_OPERATION_INVALID, + _("can't manipulate inactive snapshots of disk = '%s'"), + def->disks[i]->dst); + return -1; + } + if (format > 0 && format !=3D VIR_STORAGE_FILE_QCOW2) { if (try_all) { /* Continue on even in the face of error, since other --=20 2.28.0 From nobody Sat May 4 21:18:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1606129185; cv=none; d=zohomail.com; s=zohoarc; b=H7QMz8kVNunBXSAXlNWA/N3ai07MjmyItXvxnhrV+o2S/sFGBmMbzgFHUdx5GXOAsPoUzvbevW0ktG4O31hGxEOgNtWsY1+jazKd7n/G7CYDklgXYia+Eu40J2M+feLkYqH9syv2ZfLnh/a4hswxgG9WnIJUvZu5/jIAS052kYM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606129185; 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; bh=qy0VG29Xthqpzo6L7Lx51lrKnnVVTjuTZscn+bwE39E=; b=FBDa0FGzhPVao3fA8SUoDus6KHvtXpFwFNCHH/M44g5i+Dd3EAylZOLnbqN39vaNsJ3dkISPgwwFqhG86KdWV8Q5Utgwxm7W4uOU/FPa3PrAfKQJWTJU2hwhJN/d0g7jsqbDiCogPk4UyUocmy/0BK+YBk28Buy3zrRae3+5eYY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 160612918566437.43947666012173; Mon, 23 Nov 2020 02:59:45 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-561-mRJIeIOePxeEW_vugB9Dhg-1; Mon, 23 Nov 2020 05:59:41 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3C8D0100C611; Mon, 23 Nov 2020 10:59:35 +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 176095D9CC; Mon, 23 Nov 2020 10:59:35 +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 CFBEB1809CA5; Mon, 23 Nov 2020 10:59:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ANAxTlw004062 for ; Mon, 23 Nov 2020 05:59:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id B066F5D9E2; Mon, 23 Nov 2020 10:59:29 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B1E65D9CC for ; Mon, 23 Nov 2020 10:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606129184; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=qy0VG29Xthqpzo6L7Lx51lrKnnVVTjuTZscn+bwE39E=; b=aGzuOgk/gonIY1CXoKbWxdC8X/Fx4ywg/DJGUAYDTew5xxT8gFbZ9VgKjlviNkN5dpBwQ+ vzFtzIRxZh/X3x53vxVwr8ZjDnvntcnRGqVb4128XucQ8gqmfa/ME4FaXU+HxWEmcvjSFY Px+NTQDrQMJBu5vhsdrH0c/HCbuKJDI= X-MC-Unique: mRJIeIOePxeEW_vugB9Dhg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/5] qemuDomainSnapshotForEachQcow2: Pass in 'def' rather than selecting it internally Date: Mon, 23 Nov 2020 11:59:16 +0100 Message-Id: <90ffb20fd450c477b6a9e8474e49d1c8f31722b6.1606129084.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In some cases such as when creating an internal inactive snapshot we know that the domain definition in the snapshot is equivalent to the current definition. Additionally we set up the current definition for the snapshotting but not the one contained in the snapshot. Thus in some cases the caller knows better which def to use. Make qemuDomainSnapshotForEachQcow2 take the definition by the caller and copy the logic for selecting the definition to callers where we don't know for sure that the above claim applies. This fixes internal inactive snapshots when is used as we translate the pool/vol combo only in the current def. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/97 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 22 +++++++++++----------- src/qemu/qemu_domain.h | 2 +- src/qemu/qemu_snapshot.c | 16 +++++++++++++--- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c782810839..663c0af867 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6560,18 +6560,11 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriverPtr = driver, * failure, 1 if we skipped a disk due to try_all. */ int qemuDomainSnapshotForEachQcow2(virQEMUDriverPtr driver, - virDomainObjPtr vm, + virDomainDefPtr def, virDomainMomentObjPtr snap, const char *op, bool try_all) { - /* Prefer action on the disks in use at the time the snapshot was - * created; but fall back to current definition if dealing with a - * snapshot created prior to libvirt 0.9.5. */ - virDomainDefPtr def =3D snap->def->dom; - - if (!def) - def =3D vm->def; return qemuDomainSnapshotForEachQcow2Raw(driver, def, snap->def->name, op, try_all, def->ndisks); } @@ -6592,9 +6585,16 @@ qemuDomainSnapshotDiscard(virQEMUDriverPtr driver, if (!metadata_only) { if (!virDomainObjIsActive(vm)) { /* Ignore any skipped disks */ - if (qemuDomainSnapshotForEachQcow2(driver, vm, snap, "-d", - true) < 0) - return -1; + + /* Prefer action on the disks in use at the time the snapshot = was + * created; but fall back to current definition if dealing wit= h a + * snapshot created prior to libvirt 0.9.5. */ + virDomainDefPtr def =3D snap->def->dom; + + if (!def) + def =3D vm->def; + + return qemuDomainSnapshotForEachQcow2(driver, def, snap, "-d",= true); } else { priv =3D vm->privateData; qemuDomainObjEnterMonitor(driver, vm); diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 6b75b828c0..010bae285d 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -613,7 +613,7 @@ int qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm, const char *snapshotDir); int qemuDomainSnapshotForEachQcow2(virQEMUDriverPtr driver, - virDomainObjPtr vm, + virDomainDefPtr def, virDomainMomentObjPtr snap, const char *op, bool try_all); diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 057b94e5b8..1c58ac8acf 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -138,7 +138,7 @@ qemuSnapshotCreateInactiveInternal(virQEMUDriverPtr dri= ver, virDomainObjPtr vm, virDomainMomentObjPtr snap) { - return qemuDomainSnapshotForEachQcow2(driver, vm, snap, "-c", false); + return qemuDomainSnapshotForEachQcow2(driver, vm->def, snap, "-c", fal= se); } @@ -1813,9 +1813,19 @@ qemuSnapshotRevertInactive(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainMomentObjPtr snap) { + /* Prefer action on the disks in use at the time the snapshot was + * created; but fall back to current definition if dealing with a + * snapshot created prior to libvirt 0.9.5. */ + virDomainDefPtr def =3D snap->def->dom; + + if (!def) + def =3D vm->def; + /* Try all disks, but report failure if we skipped any. */ - int ret =3D qemuDomainSnapshotForEachQcow2(driver, vm, snap, "-a", tru= e); - return ret > 0 ? -1 : ret; + if (qemuDomainSnapshotForEachQcow2(driver, def, snap, "-a", true) !=3D= 0) + return -1; + + return 0; } --=20 2.28.0