From nobody Tue Apr 7 20:09:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773245310; cv=none; d=zohomail.com; s=zohoarc; b=c7H/WL3r/UEgePZmlvxGxghOjRRdmUO2YN2wDUpgdPva0lSeb6akzb23dCIBvYqvL61g33tDwSm/dmOtGNQdIgbcInS9d/FtkDKjdzuUuIa6KKKZSFxcee3PLxzGnfstLBoIfQjUcwcBFucz3K86EQBi4C8ui5GRyJN2dEyhq0o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773245310; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=g8nAERr/lqwzZ66zzq6bUdpBFGK1YHDQGeIptE1RzBE=; b=M+N0KR+QPd4D+Ndo91jC/qWiqwelHX2CbBe+whwa4/x1r35Nl5N+JW5aO6NufL5HEmnIAq1t7i+EceygDlZ5tm6xwYkfT4/9s8mqcvhjrCmlorZFpGfjC3tS64x5hKADo9j8tE74L70f0tlIVnvwmqUWXh/fEggCNdQ8SfvGdzU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773245310211480.5419619703928; Wed, 11 Mar 2026 09:08:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0M5R-0004J9-Me; Wed, 11 Mar 2026 12:07:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w0M5D-00041t-1V for qemu-devel@nongnu.org; Wed, 11 Mar 2026 12:06:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w0M57-0005kx-2Y for qemu-devel@nongnu.org; Wed, 11 Mar 2026 12:06:50 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-213-vfMSZsPVMAa09EcI7irBAg-1; Wed, 11 Mar 2026 12:06:40 -0400 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4837b6f6b93so117626895e9.3 for ; Wed, 11 Mar 2026 09:06:39 -0700 (PDT) Received: from localhost (p200300cfd737d0216f12b1cbc4c9e6fd.dip0.t-ipconnect.de. [2003:cf:d737:d021:6f12:b1cb:c4c9:e6fd]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48541ab9f9esm168369045e9.4.2026.03.11.09.06.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 09:06:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773245201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g8nAERr/lqwzZ66zzq6bUdpBFGK1YHDQGeIptE1RzBE=; b=cvmhPcgXjA81T7OZeYc059R5pMal8vFx7XfAh6phb+x43wxGWtWltK/XiZTyPGQMYyaRTz M/4SullZfLdwChnLCMnRpmdAjk86OmpOwh50jbphtJOhTeCEQmAOUqonEGmqwVomZX6drF 33931CbYraNiZFylMDAitQvsNFhu5rU= X-MC-Unique: vfMSZsPVMAa09EcI7irBAg-1 X-Mimecast-MFC-AGG-ID: vfMSZsPVMAa09EcI7irBAg_1773245198 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1773245198; x=1773849998; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=g8nAERr/lqwzZ66zzq6bUdpBFGK1YHDQGeIptE1RzBE=; b=Qn8eZMReO9ypktkOeh/avqCzkZcE8V0vba6NHgTgWNNoRUsGyWopL5X1pGfWMQ+b4m NdEvWoB7/nDM+7ry47qtAyGdaEtcy2M/iho1KT+vXfhgJZ75wsGoIr4a0tzoe3RK5aH8 RwdqgYczZqwstwhiujrsqueaSuKrcTjismYUUQyTV6y/aAmBK+kdBMWyKU7/nAKdS4+T TLyyF6AgQFLdsa6DS12zsy5ULbNGv/G9UPfj+Mh3oWBBinneweMoyDDFcz919hR5hg+f /G20GJiEQaIajWdPuwbrMKZyqr0Sefx/NVpgharNPHwFwp1jHxfeD69p+cblGS0uABSN 5WeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773245198; x=1773849998; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=g8nAERr/lqwzZ66zzq6bUdpBFGK1YHDQGeIptE1RzBE=; b=cNOsdwxRgwZxytUhZTm35MDH+KrupoS2GZdde8ZuVyi268iCuYx0nvqgOyXahcwa82 LYgqDVRoSO/GrGLpdHnoKcKsOa03XAMRrYURK3XWz2Cq8Lyca9NJGuuoneqB/awuooe1 a4U3rUDNBZcXiVAeelEslXP6m3jEsstmAK+JKu8e+x/e0jeaa1pwsmOv0yEq3njdG6q8 LyuPeC0ADeIf57oNZ3Prg9kh7glwtXwKrjxUl7CgOFWZ/HvbA1yAmmyYsHEBzWnA4fz/ 3a5PhqEOnp01on/uLdtpcweNL7TPRJAq4C/yrhrJviHvnJC6+mweG5ixGLQuehiAlaCG zaBA== X-Gm-Message-State: AOJu0YxZcZvMzBj+FFs8I5WMsgX5CLuCCPw0p5XqWDsS0aVuZPO+R9VT 42rzqqntjQjQvuaZO0q0RWABgiZ0PyUDG/Gs2tEpXy1wl3EHVwjz+z2kohgq31qojOZnGgrmvOF 6zvnFQIrljGPCRfgJr9K4UZZhugdM+pTyyq4Agc735Wou0pm8LbMeFIrJ X-Gm-Gg: ATEYQzyxCchEri3xqPMXWoeAQHNLuGluTrqb11ACTvSHU1PbDRDBpkYG477mY1CSjEj YkxZCEz/I3rCD/XDxZImtvNhUZaP69BPsTcR8pS3BF74XpZVwArWfGVw3PEvsZphzJgPfB0C7lE brTqv5TzJPBSjIRzo4u/jSoOFjH8Zp5xbo1k+32QbDcW8LnujIQSOFfOEeeERYrcfMcjjcIsNTp 1p8M5RC+194/T0v0aKSLGLoatGGwE7v1sJWROuUiLUshh0rBqI1qTXOMCkPsULwQkcuW1YtdnQX RAjWgXpBERv4AZzAAC4kxoesvDpTgEwfCKmK42wkxM7wNH9PIkPLLGKKcvuvQLCM0PhgGJ7sUEe 8VzLCKocLh7BbRn2Zuu9jlvNa6CU8XgksCDwT6ALfTxjr3AUNcM104MMEGBNT+o1aMGlskD2dzu BLy7IN X-Received: by 2002:a05:600c:4fd6:b0:485:3b34:2f51 with SMTP id 5b1f17b1804b1-4854b0a6a96mr57409545e9.4.1773245198147; Wed, 11 Mar 2026 09:06:38 -0700 (PDT) X-Received: by 2002:a05:600c:4fd6:b0:485:3b34:2f51 with SMTP id 5b1f17b1804b1-4854b0a6a96mr57409015e9.4.1773245197678; Wed, 11 Mar 2026 09:06:37 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf Subject: [PATCH v2 1/6] qcow2: Skip data-file resize if possible Date: Wed, 11 Mar 2026 17:06:23 +0100 Message-ID: <20260311160628.344838-2-hreitz@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260311160628.344838-1-hreitz@redhat.com> References: <20260311160628.344838-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773245313067154100 Content-Type: text/plain; charset="utf-8" With PREALLOC_MODE_OFF, we currently always resize the data file to the right length. This is definitely not necessary if it already has the correct length, and if @exact is false, we also don't need to shrink it. This is what other preallocation modes already do: preallocate_co() only increases the data file size if it is too small, but never shrinks it. (And note that for raw data files, PREALLOC_MODE_OFF is silently turned into PREALLOC_MODE_METADATA, so this commit only changes behavior for non-raw external data files.) For the next commits, having all preallocation modes behave the same will make it easier to decide when we can skip taking the RESIZE permission on the data-file child. Signed-off-by: Hanna Czenczek --- block/qcow2.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 81fd299b4c..cf9189b829 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -4572,15 +4572,22 @@ qcow2_co_truncate(BlockDriverState *bs, int64_t off= set, bool exact, switch (prealloc) { case PREALLOC_MODE_OFF: if (has_data_file(bs)) { + int64_t data_file_length =3D bdrv_co_getlength(s->data_file->b= s); + /* * If the caller wants an exact resize, the external data * file should be resized to the exact target size, too, * so we pass @exact here. + * Without @exact, we leave it as-is if it is already big enou= gh. + * Implicitly handle bdrv_co_getlength() errors by resizing. */ - ret =3D bdrv_co_truncate(s->data_file, offset, exact, prealloc= , 0, - errp); - if (ret < 0) { - goto fail; + if (data_file_length < offset || + (exact && data_file_length !=3D offset)) { + ret =3D bdrv_co_truncate(s->data_file, offset, exact, prea= lloc, 0, + errp); + if (ret < 0) { + goto fail; + } } } break; --=20 2.53.0 From nobody Tue Apr 7 20:09:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773245287; cv=none; d=zohomail.com; s=zohoarc; b=ACHY80aVnklyhnVxxKBB23fI0o7VKBobsVOrlX5r8nKa/E2Pw8CKRWykqtZc2oGOB15Yd1z7dMd9ARFrQF7BTMiSsHn0ZVnN5aAayV87zWCqV9HITfBbrDCPajDi2uvWfBj6WjVynwvMU33B3ggHEj9IQ/r7xjY/b5P8GmyVnvw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773245287; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Ej3dg4x6Sc8xzmx7tFlBTNb/I2tXgDJk9O874jd/4hc=; b=i29h8Cc8yL58EpMSKhVG7VxALp5cB4xLeNfBZhZuSqKh5zskF2f0jghAEthqu1Q3tBmR+FRR4CbYWyzqYgIrQEFou/ghhw3KGSvKAAmPZWah9517cOe0kgKBayVQLtugKhZbw5nlSmkfV2Iih1otKjRVS57dXT6dsToRDhdS9dg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773245287190692.0946045160435; Wed, 11 Mar 2026 09:08:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0M5R-0004Je-P4; Wed, 11 Mar 2026 12:07:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w0M5D-00041v-2U for qemu-devel@nongnu.org; Wed, 11 Mar 2026 12:06:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w0M59-0005nr-7R for qemu-devel@nongnu.org; Wed, 11 Mar 2026 12:06:50 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-604-Ie4uJB7EPxqUDlgv0VwRXg-1; Wed, 11 Mar 2026 12:06:43 -0400 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4853b0af42aso304685e9.0 for ; Wed, 11 Mar 2026 09:06:42 -0700 (PDT) Received: from localhost (p200300cfd737d0216f12b1cbc4c9e6fd.dip0.t-ipconnect.de. [2003:cf:d737:d021:6f12:b1cb:c4c9:e6fd]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48541aac28bsm153600955e9.1.2026.03.11.09.06.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 09:06:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773245204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ej3dg4x6Sc8xzmx7tFlBTNb/I2tXgDJk9O874jd/4hc=; b=QZkw/QoCiCRnOzZRdPZcyDAl9OnYDJ8xPtqRoL6XNG+HbWHoDGF4ep03ke8i9P0l85DkbE uPHln8ftkmmHJ0U6gNmWcJRopb22yc/BOiCO70vkrE4mWgUEP0nwvnxoFX30ssw/gyDwMu IE9ZHkAj87q7fPxE6ng72Dx9aE5+new= X-MC-Unique: Ie4uJB7EPxqUDlgv0VwRXg-1 X-Mimecast-MFC-AGG-ID: Ie4uJB7EPxqUDlgv0VwRXg_1773245202 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1773245201; x=1773850001; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ej3dg4x6Sc8xzmx7tFlBTNb/I2tXgDJk9O874jd/4hc=; b=Ox10FB/AG8lty/YPHMCwlyh757YWH9tT4py1DPiewDYBKhmxnY2MMZHMAB28pBLVPL sRMGvbRZRPNSTcb/LBMSHzlxZSgQUX1CncFz2JAvFK2PNejsVttkSDGr+liYBIvjVLyP UsT5UdEY+9uiaXVH6Cu97d4QH5ZA9iWRxaRXmQ2Mc4GV5zeHkdgk3Jj8CirB0WAwmxKl sO+4Hb5dz23HVTJWwf2yAcY3Ay7jWJOmqS8fJZyLgKZTmVMa9uxebLiDmstbBY11ifWa AFHCmR7p7GzAXeSp5elgZoyIUDnQmDCoMU4RPzsfWgCd/M+iqfWfwCOLjVEhVLmFCnw1 WvyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773245201; x=1773850001; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Ej3dg4x6Sc8xzmx7tFlBTNb/I2tXgDJk9O874jd/4hc=; b=fkEVaGOw/pgMEwW+0vDKA3tAdmkozNSkCwxEE9ra1b60/EbpqRLvMZM+Up3e+R4aD8 +XOYCPOEEAQctNaahcgfM9vzODW4XvbUVJ4cD0eMw0il1oIzQ2DFsU+7KPqycL5SgZYl DF9gp0Jn09tnEKVKrggTaVczsr2tEKSjdc2lrvBFJeD1PZ+o17T8Kt4qCDO8Xpdny3yv NEfXPckhObJqVKWIqFgvMeJQdYAaMfQdPNUnQWHQE8/m2OS6lRsE6L+vnoYew5rmLTfi q39lMA2SJBivTcV5/EGqIar820fxEbvnyuPNhx5wTmEM/D33DqvN+2Rd0QLuUCk22+K9 KVLA== X-Gm-Message-State: AOJu0YxjGISHbmOhuAOpW13U71kHzf7ilxXLU5dgwFikvjc64NcWj1+d 0btHBPYavgXRtWcrh6VTVmIsJoOVuJpC9BqblCYHPf6cuiyzc3LqkgZ42GTiEvhGBv2nbQvUEYa mfp/QQt/CgpYAHl1s67W7/6YLfR9Qst2IDE17h/+bDZrNIygXKBZVNd5I8HiExHtJ X-Gm-Gg: ATEYQzyVVniOeAOVaac130n1wpTjyR8PEkaak6TQwQb6OkPeA/8cPyX4C4V0G91KcIH WSlGHmKZzZyL8EtUE6uQ45a45L5vHbtVQYSJeZvwmrMKAf3GwHO9O7+kn33CuL5bw+JjMDQIei5 R99TeTxLCtJXZpnfjiO4qIHPWRINoY/5L6jupBqMJmDgHH9aHSPmBS8HqzwNHrWo0J4WLw8V7s6 OzArph6d6trbXKp+DW3jRLnIyyZP9rkEFV4g8DlPK0G4mNjXgGEd9Ejdoylp3zsQa1Ux4C0CgHD S0BwOPfwb4V/WmasfFAwS1yoevPp4TAfg8Lmm78wRLL98k2Hl+cYyNDurq8Z3P5j8xyWmsmPq16 EihHyrk1psJU3ilUbl8amGngkdQmgvqHBhCuVqY802bG38WPGkcmGgU3t6R/d/PGWWz2N/R2PW+ nmFEsx X-Received: by 2002:a05:600c:1988:b0:485:3e6c:aacb with SMTP id 5b1f17b1804b1-4854b0a527cmr51655645e9.4.1773245200754; Wed, 11 Mar 2026 09:06:40 -0700 (PDT) X-Received: by 2002:a05:600c:1988:b0:485:3e6c:aacb with SMTP id 5b1f17b1804b1-4854b0a527cmr51654875e9.4.1773245200229; Wed, 11 Mar 2026 09:06:40 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf Subject: [PATCH v2 2/6] qcow2: Always attach data-file given by node name Date: Wed, 11 Mar 2026 17:06:24 +0100 Message-ID: <20260311160628.344838-3-hreitz@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260311160628.344838-1-hreitz@redhat.com> References: <20260311160628.344838-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773245288813158500 Content-Type: text/plain; charset="utf-8" With BDRV_O_NO_IO, we suppress opening data-file to prevent opening unchecked paths through `qemu-img info`. However, a future commit will make qcow2_co_create() pass BDRV_O_NO_IO for the new image if possible, and then we need data-file attached to be able to query its size. qcow2_co_create() already has the data-file open, so it specifies it by node name; and if we get the data-file by node name, there is no security risk attaching it because it is already open. So check whether the data-file option is a string, i.e. a node name, and if so, allow attaching it despite BDRV_O_NO_IO. Signed-off-by: Hanna Czenczek --- block/qcow2.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index cf9189b829..edf18630f6 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1410,6 +1410,7 @@ qcow2_do_open(BlockDriverState *bs, QDict *options, i= nt flags, uint64_t ext_end; uint64_t l1_vm_state_index; bool update_header =3D false; + bool suppress_data_file =3D false; =20 ret =3D bdrv_co_pread(bs->file, 0, sizeof(header), &header, 0); if (ret < 0) { @@ -1719,14 +1720,23 @@ qcow2_do_open(BlockDriverState *bs, QDict *options,= int flags, goto fail; } =20 - if (open_data_file && (flags & BDRV_O_NO_IO)) { - /* - * Don't open the data file for 'qemu-img info' so that it can be = used - * to verify that an untrusted qcow2 image doesn't refer to extern= al - * files. - * - * Note: This still makes has_data_file() return true. - */ + /* + * Don't open the data file for 'qemu-img info' so that it can be used + * to verify that an untrusted qcow2 image doesn't refer to external + * files. + * + * Exception: If the data-file option is a node name, attaching that + * node will not open a new file, so cannot pose a security risk. + * + * Note: This still makes has_data_file() return true. + */ + if (flags & BDRV_O_NO_IO) { + QObject *data_file =3D qdict_get(options, "data-file"); + suppress_data_file =3D + !data_file || qobject_type(data_file) !=3D QTYPE_QSTRING; + } + + if (open_data_file && suppress_data_file) { if (s->incompatible_features & QCOW2_INCOMPAT_DATA_FILE) { s->data_file =3D NULL; } else { --=20 2.53.0 From nobody Tue Apr 7 20:09:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773245289; cv=none; d=zohomail.com; s=zohoarc; b=nXJ2Gx5HjGYEN/DPJfOqYul0kodrnHanQzaGFVnJl47/Iw4gsPzDcyKnubZhG4nHqRi77zlmmppgDrX5x+SZ388f6OkJpffopORb2dsUcnQL1VPmzd4aUWiha6Soyw0PVVAb6xCD7Gw+0HZBy74eblLUE1qGmMkzYnh/0Sjeyn4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773245289; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=l1uWV43rQtyDdNMKHi143nhhRTg/MPJw8Y9ODC/0WLs=; b=f5FvupwiBp7MmfGypLrdBMfnZ7XTQzAz4hIq/WMmc/J3U+MvtK7JcpmNXWZmcNRvvBfla3wYH1QONeZd/40ycIsn62dRgN/Ae3RbuaKM9nTFGvp7V4TU0+/u2rC8sLc/yqGST8jpK15UCofzrgOyiw/hQNRs0x9xEhi7EVNv5Yo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773245289277529.2739977916114; Wed, 11 Mar 2026 09:08:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0M5V-0004Rl-6q; Wed, 11 Mar 2026 12:07:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w0M5G-00045F-QH for qemu-devel@nongnu.org; Wed, 11 Mar 2026 12:06:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w0M5C-0005pL-Hh for qemu-devel@nongnu.org; Wed, 11 Mar 2026 12:06:52 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-401-txrW0ZfcOYS317ni-fxmOA-1; Wed, 11 Mar 2026 12:06:44 -0400 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-439a9182148so19333f8f.2 for ; Wed, 11 Mar 2026 09:06:44 -0700 (PDT) Received: from localhost (p200300cfd737d0216f12b1cbc4c9e6fd.dip0.t-ipconnect.de. [2003:cf:d737:d021:6f12:b1cb:c4c9:e6fd]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439fe2187aasm149198f8f.30.2026.03.11.09.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 09:06:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773245205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l1uWV43rQtyDdNMKHi143nhhRTg/MPJw8Y9ODC/0WLs=; b=W9G496rnGiRp+czmRHQpY753pUWzE/MkVYaw71cVhodpKetzXCLj5R+arTq3AOyK7u4VGS ZHOukmiuZMqAcMB6i3Jrg0ewV8QE7NAW8dAxGzvKEs0sd7puf1ofOO2SaNufqFvBIw8JDi yZM1VssY1WxVfYYpz8Cz3tAE9OayJkY= X-MC-Unique: txrW0ZfcOYS317ni-fxmOA-1 X-Mimecast-MFC-AGG-ID: txrW0ZfcOYS317ni-fxmOA_1773245203 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1773245203; x=1773850003; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=l1uWV43rQtyDdNMKHi143nhhRTg/MPJw8Y9ODC/0WLs=; b=RZoqfvWAlcSk2BfMzdja8BZhaw9m1zpgB6NqPZwVE5XUqWJ/8XTLs8+IY6Y0BcyObs V8/p3e7dJbFbv/2g6hcI1HQSOMGtmwV01OWYkeZ7I/sd9zccVZgPTrkwIp623dnhmZfF q+IDgFEYqPJRSHAvLM6PImN9EYX7mtydeYrq4JKPHAh2wgYil9ZGVGH1CBOqmntBqc49 +rzOq4va5SVXIlu8zncPg2P7CvbmxQaf99nDbp+kdYhb70iDeBzi7cRdUGSRp10ejLN+ M1Wv9CjHuz7o/0rDEp+zGUSuvdIfDfq/kGpWjZx6sMstip8sJ1wv74wQ3W9Yd2nlg4N1 7jFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773245203; x=1773850003; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=l1uWV43rQtyDdNMKHi143nhhRTg/MPJw8Y9ODC/0WLs=; b=I/63Bjfu7g6OQTB/tIS9m5/u+kGe/aqvbPs5Y6jBJruj7ZAPU3Z2WSq0RFr7zRnL5V HDg1mJcORQRrhtbeJTan8rQrLtaPtRyPdR0gNDwsD9foUtzM3wGssMe3TvCChOujeTtl lKMY+2qxbeyxf4bl8W3yKsPrvwL+HKpejp2U0oSEB9c6GoleS87DoyTYN13jFMN8TfuX EQUDUQ6zmInEO0tcPQ6mR+T53rylIoYOQrxcnbuBPNysyMZZVZkc9ZyFHl4r35RwLQ4L Gi8xTGTDXJaDoKCk+3nW+VyFa/aO+4kOvADDO1vmQcxjs8pjRQ4zQ2L093wLF+aoh4qB JCZA== X-Gm-Message-State: AOJu0YwJGoInT2z3njcKElgdb8c4ShaiSsc4JNQTkCieVEVfWGkAj6f3 3vmTbtnTIlEyHeK6cVaBVRwsFXYXJ6+QE1nQFUty2EYSYWzxyJxJrZHYmlb+c8MhwoSLadZpr06 /f2w0iioJO8PijQk7TX9Q6z0PtIiJvFceFH02tuUOFzjBHCxtyMNqcz7F X-Gm-Gg: ATEYQzyHffWmpdYJx7G2viXW2xmxhtvhrifqUeUO+P1EMwPB3Bx5yFXh3jLWlVN9jPg N5ZCwViGYE0YADpPZvs3TQ7nGyPWjWxVJQi3dMavF1lNY+19zrimytzOkFLoaNc6uJy47qW+DI4 NgWRwat5TTphsLOLqNDOIw8kKd1hek9z0y1D/WLPgAYDStFxi58YbvOZDlNSlXxguawvJfcWT5I PW/K/zv45GH96Vr9M15/WuZdVcM2etsC9VeNgaRqCf2ZiZ5u4AiWiCcfhpCw06oPi80YksaXl8C VlfeuSvm3snGhgHTVhGx0a2h2410innKJWtiSK9rU+8u703SMb958ilmnp6UMSA5O6OvJ8I8Vid vJRDJmIXBWUrticfB4t65C8lLjTv3PqfjTUYD4vFuIdbFW32xWPuO4kX/ZbchLkOS5mSVPwLgFD k+N5mk X-Received: by 2002:a5d:5848:0:b0:439:b1be:819f with SMTP id ffacd0b85a97d-439f81df05dmr6867289f8f.2.1773245203045; Wed, 11 Mar 2026 09:06:43 -0700 (PDT) X-Received: by 2002:a5d:5848:0:b0:439:b1be:819f with SMTP id ffacd0b85a97d-439f81df05dmr6867226f8f.2.1773245202564; Wed, 11 Mar 2026 09:06:42 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf Subject: [PATCH v2 3/6] qcow2: Preallocation: Do not COW after disk end Date: Wed, 11 Mar 2026 17:06:25 +0100 Message-ID: <20260311160628.344838-4-hreitz@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260311160628.344838-1-hreitz@redhat.com> References: <20260311160628.344838-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773245290954158500 Content-Type: text/plain; charset="utf-8" When creating/resizing an image with/to a non-cluster-aligned length, we currently implicitly COW the cluster tail after the guest disk end. That is unnecessary, but more importantly, when creating a qcow2 image for a pre-existing external raw data file, we should not write to it unless data preallocation was requested. So far, writing to the data file past the guest disk end during qcow2 image creation may just be a peculiarity. But this series will make qcow2 use the BDRV_O_NO_IO flag to suppress taking the WRITE flag on the data file during image creation, to allow users to create a qcow2 image with an existing raw image as its data file that is currently in use by the VM (i.e. the WRITE flag is unshared). To make this work, we really must not write to the data file at all during creation, unless data preallocation (falloc/full) has been requested. (The comment added in this commit therefore primarily reasons with the use of that flag, and how we must not break it. Admittedly, that only makes sense after the corresponding patch in this series.) Note that this means that creating/resizing images with/to a guest disk size that is not aligned to clusters will create a partial data cluster at the image end when preallocating (except for falloc/full preallocation without a data file). I think that is fine, similarly to how creating a non-preallocated image will generally leave a partial cluster at the end, too (the L1 table). It does mean iotest 125 needs to be adjusted, though. Signed-off-by: Hanna Czenczek --- block/qcow2.c | 18 ++++++++++++++++++ tests/qemu-iotests/125 | 17 +++++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index edf18630f6..2ab5a9e0f1 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3378,7 +3378,25 @@ preallocate_co(BlockDriverState *bs, uint64_t offset= , uint64_t new_length, } =20 for (m =3D meta; m !=3D NULL; m =3D m->next) { + int64_t disk_end_ofs; + m->prealloc =3D true; + + /* + * Do not COW beyond the supposed image end: There is no point= , and + * it could break BDRV_O_NO_IO from qcow2_co_create(): + * qcow2_alloc_host_offset() does not COW anything for the ran= ge we + * pass, but everything outside. If growing to a non-cluster + * aligned size, it will thus request COW beyond the image end, + * breaking the BDRV_O_NO_IO promise. + * (As long as the @offset passed to this function was aligned= to + * full clusters, that is the only possible instance of COW. = With + * qcow2_co_create(), it's always 0, so always aligned.) + */ + disk_end_ofs =3D (int64_t)new_length - (int64_t)m->offset; + if (m->cow_end.offset + m->cow_end.nb_bytes > disk_end_ofs) { + m->cow_end.nb_bytes =3D MAX(disk_end_ofs - m->cow_end.offs= et, 0); + } } =20 ret =3D qcow2_handle_l2meta(bs, &meta, true); diff --git a/tests/qemu-iotests/125 b/tests/qemu-iotests/125 index 708e7c5ba2..8213de012e 100755 --- a/tests/qemu-iotests/125 +++ b/tests/qemu-iotests/125 @@ -172,10 +172,10 @@ done # Test image resizing using preallocation and unaligned offsets $QEMU_IMG create -f raw "$TEST_IMG.base" 128k | _filter_img_create $QEMU_IO -c 'write -q -P 1 0 128k' -f raw "$TEST_IMG.base" -for orig_size in 31k 33k; do - for dst_size in 96k 128k; do +for orig_size in $((31 * 1024)) $((33 * 1024)); do + for dst_size in $((96 * 1024)) $((128 * 1024)); do for prealloc in metadata full; do - echo "--- Resizing image from $orig_size to $dst_size (preallo= cation=3D$prealloc) ---" + echo "--- Resizing image from $((orig_size / 1024))k to $((dst= _size / 1024))k (preallocation=3D$prealloc) ---" _make_test_img -F raw -b "$TEST_IMG.base" -o cluster_size=3D64= k "$orig_size" $QEMU_IMG resize -f "$IMGFMT" --preallocation=3D"$prealloc" "$= TEST_IMG" "$dst_size" # The first part of the image should contain data from the bac= king file @@ -183,10 +183,15 @@ for orig_size in 31k 33k; do # The resized part of the image should contain zeroes $QEMU_IO -c "read -q -P 0 ${orig_size} 63k" "$TEST_IMG" # If the image does not have an external data file we can also= verify its - # actual size. The resized image should have 7 clusters: - # header, L1 table, L2 table, refcount table, refcount block, = 2 data clusters + # actual size. The resized image should have 5 metadata cluste= rs + # (header, L1 table, L2 table, refcount table, refcount block) + # plus the data. We round up that data to full clusters for f= ull + # preallocation, but not for metadata preallocation. if ! _get_data_file "$TEST_IMG" > /dev/null; then - expected_file_length=3D$((65536 * 7)) + expected_file_length=3D$((65536 * 5 + dst_size)) + if [ "$prealloc" =3D full ]; then + expected_file_length=3D$(((expected_file_length + 6553= 5) / 65536 * 65536)) + fi file_length=3D$(stat -c '%s' "$TEST_IMG_FILE") if [ "$file_length" !=3D "$expected_file_length" ]; then echo "ERROR: file length $file_length (expected $expec= ted_file_length)" --=20 2.53.0 From nobody Tue Apr 7 20:09:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773245306; cv=none; d=zohomail.com; s=zohoarc; b=c0BSpNpB3CeefcZEpRydRNBySxEAqXHuOK2jyW4VlZkPMZaNcWEJjCJxG0PWpu3n19RDfrHPsmMm5n0fQLYfS8YhITN5FgMD+tpHkiNUAJKlWzuLj99bUTKbobSr1RmL9Rz98m0pAZ2kHRu1URlYRktoP+WKEhh0L9qdctQuFvY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773245306; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BuyIaOwGg3hOBBCUG5jek+OeVDlLciDtqXEanBQL7kM=; b=R+qxX253PdRUY2Ueb1FG88zBT9yI7bR3ZE7yKHZwsJJfC34rYHuF2Sms1sNox56AAB9pVZCR9NpqOuyacO7pHIHHm/TNyoi8iy0K+CcVdmlLEhe/1w7zs1VVIocNnD8nFqieSCV8AUwNX9Us6L1byUAqLOP+UosHLop5v11q7Jc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773245306187728.0353876504246; Wed, 11 Mar 2026 09:08:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0M5S-0004O3-Vx; Wed, 11 Mar 2026 12:07:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w0M5F-000455-99 for qemu-devel@nongnu.org; Wed, 11 Mar 2026 12:06:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w0M5C-0005s7-PV for qemu-devel@nongnu.org; Wed, 11 Mar 2026 12:06:52 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-322-LH0KZtmBPeuxWlkj8eg22Q-1; Wed, 11 Mar 2026 12:06:47 -0400 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-48531e6012bso150815e9.1 for ; Wed, 11 Mar 2026 09:06:46 -0700 (PDT) Received: from localhost (p200300cfd737d0216f12b1cbc4c9e6fd.dip0.t-ipconnect.de. [2003:cf:d737:d021:6f12:b1cb:c4c9:e6fd]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439fe2273e8sm185724f8f.33.2026.03.11.09.06.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 09:06:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773245208; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BuyIaOwGg3hOBBCUG5jek+OeVDlLciDtqXEanBQL7kM=; b=BDsikQpaFTtX10BSdBiA7kekyxW1VWj35zrSLbbvVxw1aH8L4aakH0yykycBPT0ucG9DCP hR41wDI+5LTcvXddH1Qa5QYZYANVUCatRNFyOl4c3aQIPPFDOsaf3SF9i6Z8tjf48lIABU EwPf7+NKfwLiOvY1dVeQ3zjI8zLI9N0= X-MC-Unique: LH0KZtmBPeuxWlkj8eg22Q-1 X-Mimecast-MFC-AGG-ID: LH0KZtmBPeuxWlkj8eg22Q_1773245206 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1773245205; x=1773850005; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BuyIaOwGg3hOBBCUG5jek+OeVDlLciDtqXEanBQL7kM=; b=CDYTy9EXLOoWuUhXjtHz13ZmUi5fEt04Hg5BCptaeUFoSpfj14Ox25r3qz8nQtRJSd A/873e2h52o6bZj0gGC3jo+UCgd41t0HxX0KQYPuJyGkTua+UHF1Nuv9v9ZbJVSeRcnh CtAjlVequneUhxckLi7UwT7ZeNRhR/4wJQBvljqyCyZN9juDvHLms3PaFV3bGfNVlNzp 8332qnDaMNecyXCwqYHMhrxWOEhS57xqV2V9RO7k44f8uJTg+qaMXrXe3ECaMNRd22T2 pErGCiA6mAm60iNBslbT0c9NRtwGIO7nyIi8B4/H1+CF6YgyD5AGtH8JGWIsJftlezsl ibZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773245205; x=1773850005; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=BuyIaOwGg3hOBBCUG5jek+OeVDlLciDtqXEanBQL7kM=; b=kuGBbj5Wap8jEvZGLX0dLYSb4oBIr0PJ/0qdkVrflVAg1xlJQ109PIN//zfWRiokNr LsK/opB5WeW3hQdGip9rYXnry8sbDNcEEHWDoLlpRZLdowr9YPi4t+RqLKCsuR96Wpw2 Fr4OCNGLXmGGhPz2QsPcPx7W+QWjDllsiOAOonJwFzjbs9f9ixCr/BdA5UZDQWODSMgr 0W7fSvnrzWh4CZeG5QEzE4UuZ/tp11XyXXMB7ZH6DZ7ppAWjcKGFHtwpFKq7clq7d+hm XyHNm6FRnO7omhO/Bgb85NLY4Owb/NyASqKMf13Sa27c8HEhR0jW/S8cGCt1rmXAee4r vs8g== X-Gm-Message-State: AOJu0YxaQoYzDbyBCGFciUOtbXTL9pWXti17NFK3kBWxTs/Tmtw4RUzg oyOdociQ0HvMMje0N9ICYnKLe+FSs5ZV/KtZKrll1pTquf4ubHayzXl/BXWlWsyRqfGh4a6KndZ xSw+ltkP/lbpfi+wGR62P2wJY1RJt2V6EYclDa/A3NWroKB7kX6boVVvGaWbFsNC6 X-Gm-Gg: ATEYQzyBmwkcbfgY5dV5pVX1dAHT+UBZl+NXY42AiRVCX/kPazA1oxatrRyPB7ZEzte Mj0fYRwItY+N9+puUfHIZTDfdURCPKe51oNwPzD8s9W/zzQxh1/F9egLkT2xte/O2Ftt/VNaPK+ F99w4kcmpos8hM+tLXHBcQGcJLbDpBR+h4ZRMrsgvYF3Dp47IuvgN5ekg3fMYfyU9PxnDiF2VaE yvxGuU/HEtmfNE55kEPWfmfIH5s6KkCtOkHGQZaK3ummuVpyBacLQHm0yS1URhhf1iahvwNsEhz l/sm60hSnE8iwc1PkrjYqQYAZgy3q/e8ajkI9xJ+XLGF8HHF/YdcgygMPomf2ei1RS47sIit/sL ywDhvyRdCv60ynUv3ueU2SO+H4bLqamTYLzLzeNvQhHA3IpL7DEAjVglaIufRxYK01IWDKWxRyL 0P/AzK X-Received: by 2002:a05:600c:c4a2:b0:485:4371:539a with SMTP id 5b1f17b1804b1-4854b134965mr55660855e9.31.1773245205305; Wed, 11 Mar 2026 09:06:45 -0700 (PDT) X-Received: by 2002:a05:600c:c4a2:b0:485:4371:539a with SMTP id 5b1f17b1804b1-4854b134965mr55659935e9.31.1773245204733; Wed, 11 Mar 2026 09:06:44 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf Subject: [PATCH v2 4/6] qcow2: Call qcow2_co_truncate() directly Date: Wed, 11 Mar 2026 17:06:26 +0100 Message-ID: <20260311160628.344838-5-hreitz@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260311160628.344838-1-hreitz@redhat.com> References: <20260311160628.344838-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773245307013158500 Content-Type: text/plain; charset="utf-8" bdrv_co_truncate() checks that BDRV_O_NO_IO is not set and that the RESIZE permission is available. However, after this series: - We want to set the BDRV_O_NO_IO flag in cases where we can ensure that no I/O will occur to/from the data file, to allow concurrent use of the data file while a qcow2 metadata image is put on top. - We want to take the RESIZE permission only when we are actually going to resize the data file, i.e. when it is not big enough yet. By calling qcow2_co_truncate() directly, we bypass these checks. That is OK because qcow2_co_create() is the sole owner and user of this qcow2 BDS. (For example, taking the right permissions on it does not matter if it is impossible for there to be another user.) Note that qcow2_co_truncate() takes a signed int64_t, whereas qcow2_opts->size is uint64_t, so we should add an explicit check for overflow. iotest 206's output changes accordingly. Signed-off-by: Hanna Czenczek --- block/qcow2.c | 17 +++++++++++++++-- tests/qemu-iotests/206.out | 6 +++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 2ab5a9e0f1..dd0f47c0ff 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -82,6 +82,10 @@ qcow2_co_preadv_compressed(BlockDriverState *bs, QEMUIOVector *qiov, size_t qiov_offset); =20 +static int coroutine_fn GRAPH_RDLOCK +qcow2_co_truncate(BlockDriverState *bs, int64_t offset, bool exact, + PreallocMode prealloc, BdrvRequestFlags flags, Error **e= rrp); + static int qcow2_probe(const uint8_t *buf, int buf_size, const char *filen= ame) { const QCowHeader *cow_header =3D (const void *)buf; @@ -3657,6 +3661,13 @@ qcow2_co_create(BlockdevCreateOptions *create_option= s, Error **errp) goto out; } =20 + if (qcow2_opts->size > BDRV_MAX_LENGTH) { + error_setg(errp, "Image size must not exceed %" PRId64 " bytes", + BDRV_MAX_LENGTH); + ret =3D -EINVAL; + goto out; + } + if (qcow2_opts->has_version) { switch (qcow2_opts->version) { case BLOCKDEV_QCOW2_VERSION_V2: @@ -3939,8 +3950,10 @@ qcow2_co_create(BlockdevCreateOptions *create_option= s, Error **errp) } =20 /* Okay, now that we have a valid image, let's give it the right size = */ - ret =3D blk_co_truncate(blk, qcow2_opts->size, false, - qcow2_opts->preallocation, 0, errp); + bdrv_graph_co_rdlock(); + ret =3D qcow2_co_truncate(blk_bs(blk), qcow2_opts->size, false, + qcow2_opts->preallocation, 0, errp); + bdrv_graph_co_rdunlock(); if (ret < 0) { error_prepend(errp, "Could not resize image: "); goto out; diff --git a/tests/qemu-iotests/206.out b/tests/qemu-iotests/206.out index 979f00f9bf..46c2d8db97 100644 --- a/tests/qemu-iotests/206.out +++ b/tests/qemu-iotests/206.out @@ -169,19 +169,19 @@ Job failed: Image size must be a multiple of 512 bytes =20 {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": = {"driver": "qcow2", "file": "node0", "size": 18446744073709551104}}} {"return": {}} -Job failed: Could not resize image: Image size cannot be negative +Job failed: Image size must not exceed 9223372035781033984 bytes {"execute": "job-dismiss", "arguments": {"id": "job0"}} {"return": {}} =20 {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": = {"driver": "qcow2", "file": "node0", "size": 9223372036854775808}}} {"return": {}} -Job failed: Could not resize image: Image size cannot be negative +Job failed: Image size must not exceed 9223372035781033984 bytes {"execute": "job-dismiss", "arguments": {"id": "job0"}} {"return": {}} =20 {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": = {"driver": "qcow2", "file": "node0", "size": 9223372036854775296}}} {"return": {}} -Job failed: Could not resize image: offset(9223372036854775296) exceeds ma= ximum(9223372035781033984) +Job failed: Image size must not exceed 9223372035781033984 bytes {"execute": "job-dismiss", "arguments": {"id": "job0"}} {"return": {}} =20 --=20 2.53.0 From nobody Tue Apr 7 20:09:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773245263; cv=none; d=zohomail.com; s=zohoarc; b=GRNcwcYEu43iQUqQ9F1Kr2RCQOfHlJXpNKLS6uMUQl+49zFkUEfll7hLpjozHnqYhlxfcVcVeVnCq+DUehEJ1RPKVK/R8fvQLK1D28gcZUgpmNA+3h80VX+6gLiSRjcdRaLGgVCdqPOUgOi+daD9jz2/7/UGUSWHqqbrrNIg3LE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773245263; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=FguOM5DVkqLFtBQkSA9wG1Nr+QxkYNGwvgghCA90PHc=; b=W3rLj5WerAkLrNQ/DsWUG+C5T3hjFH8o/FcCNAgTvOiQ2hntlOyKnDDw0OONt9RIqaeD9efPrT1oLbtDHieVAUMJh5VMe1IuzP7crX313Nr0O6A0pS5iMU1//nGB2XDXEDZGOLRVjqbZ3i5p0EblrsT2O2cEdHjv+QJJNQXrAeI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17732452633461021.9104035424551; Wed, 11 Mar 2026 09:07:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0M5S-0004NJ-Pt; Wed, 11 Mar 2026 12:07:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w0M5L-00046S-Qh for qemu-devel@nongnu.org; Wed, 11 Mar 2026 12:07:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w0M5D-0005uG-3T for qemu-devel@nongnu.org; Wed, 11 Mar 2026 12:06:54 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-563-7FTxjHL2PyafLL4D6Hazdg-1; Wed, 11 Mar 2026 12:06:49 -0400 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4853b5b0fafso58345e9.3 for ; Wed, 11 Mar 2026 09:06:48 -0700 (PDT) Received: from localhost (p200300cfd737d0216f12b1cbc4c9e6fd.dip0.t-ipconnect.de. [2003:cf:d737:d021:6f12:b1cb:c4c9:e6fd]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4854b5e9179sm61447595e9.3.2026.03.11.09.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 09:06:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773245210; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FguOM5DVkqLFtBQkSA9wG1Nr+QxkYNGwvgghCA90PHc=; b=a3N1LkeuUthnT7T3uztSLact0MzcQgrN1VT7EddhDNNqfyrFcJs9zk7SXy5DVx4IQA6fY3 j/Sr741ZeWgXFh8/fZi1JGgbqn5++yw81Lp/uWddgSEceHexzH5atGt+3fkXtonNfLSqLB vEGc7ClULPcv7Q9rJlVc7c43bjT05/s= X-MC-Unique: 7FTxjHL2PyafLL4D6Hazdg-1 X-Mimecast-MFC-AGG-ID: 7FTxjHL2PyafLL4D6Hazdg_1773245208 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1773245208; x=1773850008; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FguOM5DVkqLFtBQkSA9wG1Nr+QxkYNGwvgghCA90PHc=; b=BimtWXAPcZqg6QdYyYWOQ6uMYh4rZCCGYBtQa6BVIBvWLUj9o1/gM0TvZ/0tUcoent D7tFynM2C6oropp9MjcHi6qW2TNjsd2AytIyPrstPGs9iFeVjfe/F7nDW+4/LByshyv7 O+HwSb4o7iLkwy4eHn/LQz/9QCyp4bW07Rmk9YxE4bX8OIbybqAJrlf6ULERdL9w5nuG +nz6DZRfGI8GOH9UmA+DhJMRzw8W2Wx4paUXzfVO2Lkf5ez9oJ/1NbqI01SIYj6Sg4sW J63e7RTRTLCHvbvBG+v9usF+68GG9mkEj+7bMWZvLAOKbDNABJlOeOoJRChEm1JIrW1X wG2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773245208; x=1773850008; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=FguOM5DVkqLFtBQkSA9wG1Nr+QxkYNGwvgghCA90PHc=; b=CQEYq2ZuLI/hvK1h1i7oDR77VuOHfJULJwa4+DxaIs4Cmm/rweQdtGZMPaCPzAH/LS mlz7q0Oq7O5RtYuVci3g5o1aELT7HCMLVvpD15T6QGquefOfGp4amQ3/BfXc4GNoJJaf Lc03wrwzg6XJV20YL2b8sIF6ErTGmDe3Mg7wzV3cFPBm0pOQI5EbXZqjC434/AiqLDVQ Lo47rE6bCm+awkDfyLT1t5I+hbSPVyN8RGj9HTBFDi7Ttl8fpDqo8EaJAPf0ONi55ziA wYZRT9amIFtP8fV86bGYcgPLpGYeHP+OwgR3/7H/bySPCJt28Y0DYhgAYuS0J/mBwGm2 4Xvg== X-Gm-Message-State: AOJu0YyRRtRbxVV6sKBMSSSTocna1rkr4cuI04sF6c5R8AcO2Z6TMNtn MGVBC6KUGuxw4fcXvg7N2ZT+ymz2Svo+mt7BZulEDDM1p7uQXd+PtOq5fTyQAr2BfMFdzM40Iho uaqLelD6Rcyv8SJr480a7o9WKnhByMVBs9bG43m0eoNKrX/FpC/qveUH5 X-Gm-Gg: ATEYQzwO/mVFZCqGABR1KbfDHpFLqSEZOtMeXzvSbSV8qvfFHS/zhXc35ZEo72xAEtb +e2njpsnKafagsyyfF/Ki6sLIRfmdH/RV+rf8yTmP0mtVU5x5jzau6CjVhHGJm2FznZsWbNVXPq 6rRvHLCfmRwzFnb4yX5XQN2hwyKSQbjejTMrn3siN0ymIRr74l8F29rJLMzOG7CQSsKudQQBaSW C0s662gDo4NyUp9maZXc+TvS5gn2AFLsc7XILt73Yqub9UsocetTu97t/xZSLN8AwaFZ9zL58ah I5ipi6Gc/MHmhfiS+IUeior7KNLP7MYeJWARZcb5yEFdbykSlL2vLxvRmYZrsewcjBzgmBzZcZq bC+pzLFrUJ+2n6Wg1h5p4OB0TCPIh/QhiyQi0XXsfwh7ambefqLj4x6DK1C2mzsubVG1naym7SG 14yD3N X-Received: by 2002:a05:600c:1f0e:b0:485:35ba:1d81 with SMTP id 5b1f17b1804b1-4854b12cee4mr55450365e9.21.1773245207405; Wed, 11 Mar 2026 09:06:47 -0700 (PDT) X-Received: by 2002:a05:600c:1f0e:b0:485:35ba:1d81 with SMTP id 5b1f17b1804b1-4854b12cee4mr55449685e9.21.1773245206950; Wed, 11 Mar 2026 09:06:46 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf Subject: [PATCH v2 5/6] qcow2: Suppress data-file WRITE/RESIZE if possible Date: Wed, 11 Mar 2026 17:06:27 +0100 Message-ID: <20260311160628.344838-6-hreitz@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260311160628.344838-1-hreitz@redhat.com> References: <20260311160628.344838-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773245264715158500 Content-Type: text/plain; charset="utf-8" When formatting a qcow2 image, we only need the WRITE permission on the data-file child to preallocate data, so for metadata-only preallocation (or none at all), we can suppress that permission via the BDRV_O_NO_IO flag. That promises to actually not do any I/O at all, but writing is actually the only thing we would do, so it applies. (BDRV_O_NO_IO does not preclude reading/writing from/to the metadata file.) Similarly, we will only resize the data-file if it is currently smaller than the supposed virtual disk size; so it is already big enough, we can suppress the RESIZE permission by removing the BDRV_O_RESIZE flag. This commit allows creating a qcow2 image with an existing raw image as its external data file while that raw image is in use by the VM. Signed-off-by: Hanna Czenczek --- block/qcow2.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index dd0f47c0ff..00958a0552 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3641,6 +3641,7 @@ qcow2_co_create(BlockdevCreateOptions *create_options= , Error **errp) size_t cluster_size; int version; int refcount_order; + int blk_flags; uint64_t *refcount_table; int ret; uint8_t compression_type =3D QCOW2_COMPRESSION_TYPE_ZLIB; @@ -3908,20 +3909,48 @@ qcow2_co_create(BlockdevCreateOptions *create_optio= ns, Error **errp) * table) */ options =3D qdict_new(); + blk_flags =3D BDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_NO_FLUSH; qdict_put_str(options, "driver", "qcow2"); qdict_put_str(options, "file", bs->node_name); if (data_bs) { qdict_put_str(options, "data-file", data_bs->node_name); + + /* + * If possible, suppress all permissions we can. We must keep the + * BDRV_O_RDWR flag because the metadata child must still be writt= en, + * but we can add BDRV_O_NO_IO if we know that the data file child= will + * not receive any I/O, to suppress taking the WRITE permission on= it. + * We can only do so as long as none of the operations on `blk` wi= ll + * do I/O on the data file. Such I/O accesses can only happen dur= ing + * resize (which grows the image from length 0 to qcow2_opts->size= ) with + * data preallocation. So as long as no data preallocation has be= en + * requested, BDRV_O_NO_IO will work. + */ + if (qcow2_opts->preallocation =3D=3D PREALLOC_MODE_METADATA || + qcow2_opts->preallocation =3D=3D PREALLOC_MODE_OFF) { + blk_flags |=3D BDRV_O_NO_IO; + } + + /* + * Similarly for BDRV_O_RESIZE: Suppressing it means we will not t= ake + * the RESIZE permission. The data-file child is only grown if too + * small, never shrunk; so if it already is big enough, no need for + * BDRV_O_RESIZE. + */ + bdrv_graph_co_rdlock(); + if (bdrv_co_getlength(data_bs) >=3D (int64_t)qcow2_opts->size) { + blk_flags &=3D ~BDRV_O_RESIZE; + } + bdrv_graph_co_rdunlock(); } - blk =3D blk_co_new_open(NULL, NULL, options, - BDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_NO_FLUSH, - errp); + blk =3D blk_co_new_open(NULL, NULL, options, blk_flags, errp); if (blk =3D=3D NULL) { ret =3D -EIO; goto out; } =20 bdrv_graph_co_rdlock(); + /* BDRV_O_NO_IO note: No data-file I/O */ ret =3D qcow2_alloc_clusters(blk_bs(blk), 3 * cluster_size); if (ret < 0) { bdrv_graph_co_rdunlock(); @@ -3940,7 +3969,10 @@ qcow2_co_create(BlockdevCreateOptions *create_option= s, Error **errp) s->image_data_file =3D g_strdup(data_bs->filename); } =20 - /* Create a full header (including things like feature table) */ + /* + * Create a full header (including things like feature table). + * BDRV_O_NO_IO note: No data-file I/O + */ ret =3D qcow2_update_header(blk_bs(blk)); bdrv_graph_co_rdunlock(); =20 @@ -3949,7 +3981,13 @@ qcow2_co_create(BlockdevCreateOptions *create_option= s, Error **errp) goto out; } =20 - /* Okay, now that we have a valid image, let's give it the right size = */ + /* + * Okay, now that we have a valid image, let's give it the right size. + * BDRV_O_NO_IO note: This will only read/write from/to data-file if d= ata + * preallocation has been requested. + * BDRV_O_RESIZE note: We pass @exact =3D false, so the data-file is o= nly + * resized if it is smaller than qcow2_opts->size. + */ bdrv_graph_co_rdlock(); ret =3D qcow2_co_truncate(blk_bs(blk), qcow2_opts->size, false, qcow2_opts->preallocation, 0, errp); @@ -3968,6 +4006,7 @@ qcow2_co_create(BlockdevCreateOptions *create_options= , Error **errp) } =20 bdrv_graph_co_rdlock(); + /* BDRV_O_NO_IO note: No data-file I/O */ ret =3D bdrv_co_change_backing_file(blk_bs(blk), qcow2_opts->backi= ng_file, backing_format, false); bdrv_graph_co_rdunlock(); @@ -3983,6 +4022,7 @@ qcow2_co_create(BlockdevCreateOptions *create_options= , Error **errp) /* Want encryption? There you go. */ if (qcow2_opts->encrypt) { bdrv_graph_co_rdlock(); + /* BDRV_O_NO_IO note: No data-file I/O */ ret =3D qcow2_set_up_encryption(blk_bs(blk), qcow2_opts->encrypt, = errp); bdrv_graph_co_rdunlock(); =20 @@ -4481,6 +4521,15 @@ fail: return ret; } =20 +/** + * Resize the qcow2 image. + * To support BDRV_O_NO_IO and !BDRV_O_RESIZE from qcow2_co_create(), this + * function must: + * - If @exact is false, resize an external data file only if its size is = less + * than @offset + * - Only access (write to) an external data file if @prealloc prescribes = data + * preallocation (FALLOC/FULL). + */ static int coroutine_fn GRAPH_RDLOCK qcow2_co_truncate(BlockDriverState *bs, int64_t offset, bool exact, PreallocMode prealloc, BdrvRequestFlags flags, Error **e= rrp) @@ -4634,6 +4683,11 @@ qcow2_co_truncate(BlockDriverState *bs, int64_t offs= et, bool exact, break; =20 case PREALLOC_MODE_METADATA: + /* + * Note for BDRV_O_NO_IO and !BDRV_O_RESIZE: This will not do I/O = on an + * external data file, and will only resize it if its current leng= th is + * less than `offset`. + */ ret =3D preallocate_co(bs, old_length, offset, prealloc, errp); if (ret < 0) { goto fail; @@ -4652,6 +4706,11 @@ qcow2_co_truncate(BlockDriverState *bs, int64_t offs= et, bool exact, /* With a data file, preallocation means just allocating the metad= ata * and forwarding the truncate request to the data file */ if (has_data_file(bs)) { + /* + * Note for BDRV_O_NO_IO and !BDRV_O_RESIZE: This *will* write= data + * to an external data file, but only resize it if its current + * length is less than `offset`. + */ ret =3D preallocate_co(bs, old_length, offset, prealloc, errp); if (ret < 0) { goto fail; --=20 2.53.0 From nobody Tue Apr 7 20:09:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773245288; cv=none; d=zohomail.com; s=zohoarc; b=NI2OVglx7AjYqBPYxNU991I5FjmZ3s8Fe0UPzpCNOoP1ORl1WdbPaRSDr1KESQpJy4pSa9CuSTNXPZpxEQgSuzLSTQwl11JyE23a+MIN8xNkf9goXHxEMzzaP3OqnB7Sz7nmkzH9BpnfNI/mltaHSmptzRrE9BMhH55EodXmf4s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773245288; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8Vn6qsaydGKrU8xcrdJbka8xvFYPDq3wcj2yCu2g43M=; b=mPbiaFliZwP8AYZ9bv+r2WMp4NeHJtvVuitwqRhdUBjCtklo7uGHhIw2YQnu4VI1gCVRc28KopPtNpu9eywIMufSJGnFYT5ja8dtwJLXTagLNm0SzjXXb+2z9m06yvVHeqerRoTd+qKgerqFYOrUOBGbvekzJX62e8CkOKvmUxo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773245288204707.1743209210827; Wed, 11 Mar 2026 09:08:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0M6N-00057A-SI; Wed, 11 Mar 2026 12:08:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w0M5T-0004PS-F1 for qemu-devel@nongnu.org; Wed, 11 Mar 2026 12:07:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w0M5N-00060Q-2f for qemu-devel@nongnu.org; Wed, 11 Mar 2026 12:07:07 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-185-K_yvbzjnM9u_bFT09IgLjA-1; Wed, 11 Mar 2026 12:06:54 -0400 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4853b0af42aso306845e9.0 for ; Wed, 11 Mar 2026 09:06:53 -0700 (PDT) Received: from localhost (p200300cfd737d0216f12b1cbc4c9e6fd.dip0.t-ipconnect.de. [2003:cf:d737:d021:6f12:b1cb:c4c9:e6fd]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4854b0dc8d7sm19862695e9.25.2026.03.11.09.06.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 09:06:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773245216; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8Vn6qsaydGKrU8xcrdJbka8xvFYPDq3wcj2yCu2g43M=; b=SugsxAmncJzTiqiqPkFWTYS/1vZFg3L1EeU+0NKRl0L46uF+IA+02cjQA77pb6jbfAUMHd sI25XyVBqvP7bqhILyB8BCL/zFuHG4JIlngwgkwJ6ZCB9e+92GvS0Cjaspe8eNzBDwSuIr BcuD/VzAbZIh16dwz3IgrauC7blrYhQ= X-MC-Unique: K_yvbzjnM9u_bFT09IgLjA-1 X-Mimecast-MFC-AGG-ID: K_yvbzjnM9u_bFT09IgLjA_1773245213 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1773245213; x=1773850013; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8Vn6qsaydGKrU8xcrdJbka8xvFYPDq3wcj2yCu2g43M=; b=L5ELlJwq0akgr6km5BZQ2ev+MBDp/d8MgtTKhHoN6IiP+3jTPpWnUQfD+Z6zztsye1 rXZC1oChP+m/FGM3WqBtCPY3c73Ju/EHHaOe2kEWyYoOQRJ27BE674Gn8Ko1MDH7NYPI 8FllfrG+LcLuOdcxUFZiV7CuKD0HAbLef1nNl2ZvaHmRIie0oaeX1ci1sjemVdMG5v31 ijZ3tLjvqEFsZGAdtCGAyPqPIXQg75x4SYqppsm/6pWRKP5mAKVzy3aLkQUr/N1kKK/d gy5bea02QFApc0BtSQw7ApxpX/BE8GFMFXhqehHFE4jS87hsOjDe9SCW89+B1pXmGSh8 7O9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773245213; x=1773850013; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=8Vn6qsaydGKrU8xcrdJbka8xvFYPDq3wcj2yCu2g43M=; b=R1K6yar1nL7wdvYRrNyeeFWnBqvh0hr3St0PrITnUTW0p0T718rRsie+OCtKHSPaOl A1dbHOhhKsc0CE+nT+2QBiTGZZluX78hxnYRlTpO4W02FEcst7NquPnD8cpMQTRjAdwT NwU4vqJ0lPkaIibtN98XByqhFVbsvWuxvYHmAr+jAhzvVr3IBIJ933P3Oy2NC5zt2wSE 4ifZtdhiLRs2ClnT7TPcTOKjTcFPlsYTSeQkXwqsC9VAaRE2DdeJrRwl+tD1iV0/G8ZD VTAJNjNU9F1y1Dg8EWLlp8bVhvnXAroLH6lt0Lgag4vSZh3eUs7vcBODXWk0myf/VhPq g9+Q== X-Gm-Message-State: AOJu0YzOSb9OFyLhox/eEarzG2qVMKKQisyCHqvraepji9WBTC0OI9HP AZZveNYrX2mlKbpQNs/cjs69fBV2hr0UFtF74PFIGfgyF1RGU16xHkKvBDhgBPFzYYkZgpo4nKK yRXoytW3KTdODM9d52NYNlz7DxqQyxHk6wrovpX5ET698FDyH4Act8R6j X-Gm-Gg: ATEYQzwyZuKD5/wpfeWjo72edoGuhy61bwJ+HtnGBG3YS+eSvcpcwP4PkBQGZSSAo76 dT70+LOmBUtapGHwW3sx/JAMpCYhbdA9zqOcySTiNJd6SCZ+WaPdngXf7FcGBtD1JU+T4nPfkRD B1gKpfIR/Gaakew05NTDiUao55v9yxN3aydLPyqN2JxFGh2zlUKDaBuK3O8TWUA7IxL/Axmsdfb KnXWwvc/vAJ2JoQaINgJUH7PtW7jMy9JLEZMRhyNqPVc4prXtDICMG5qi+mVhR6rlGpAqkliOR7 Tqa+EXbuJOzJLhN4POg9K6UjfQ2uod4lYdybnxekxuENmIVyJZG2eASGB5fssAmn4FUYwJkGwqv MmvG/1lRJW9wbbcNMqSmx9kdA34awsohtdZLae0llivVRTXBI3VNUlAn+OUWSxy7cXeFN+xNTu/ T7XHpE X-Received: by 2002:a05:600c:3b18:b0:477:5c58:3d42 with SMTP id 5b1f17b1804b1-4854b0b3546mr55006495e9.10.1773245211134; Wed, 11 Mar 2026 09:06:51 -0700 (PDT) X-Received: by 2002:a05:600c:3b18:b0:477:5c58:3d42 with SMTP id 5b1f17b1804b1-4854b0b3546mr55005235e9.10.1773245209869; Wed, 11 Mar 2026 09:06:49 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf Subject: [PATCH v2 6/6] iotests: Add qcow2-live-data-file test Date: Wed, 11 Mar 2026 17:06:28 +0100 Message-ID: <20260311160628.344838-7-hreitz@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260311160628.344838-1-hreitz@redhat.com> References: <20260311160628.344838-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773245288961158500 Content-Type: text/plain; charset="utf-8" While a raw image is attached to a VM, create a pure-metadata qcow2 image with that raw image as its data file, and then replace the raw image by the qcow2 image. Signed-off-by: Hanna Czenczek --- tests/qemu-iotests/tests/qcow2-live-data-file | 280 ++ .../tests/qcow2-live-data-file.out | 2904 +++++++++++++++++ 2 files changed, 3184 insertions(+) create mode 100755 tests/qemu-iotests/tests/qcow2-live-data-file create mode 100644 tests/qemu-iotests/tests/qcow2-live-data-file.out diff --git a/tests/qemu-iotests/tests/qcow2-live-data-file b/tests/qemu-iot= ests/tests/qcow2-live-data-file new file mode 100755 index 0000000000..49eee048ac --- /dev/null +++ b/tests/qemu-iotests/tests/qcow2-live-data-file @@ -0,0 +1,280 @@ +#!/usr/bin/env python3 +# group: rw +# +# Given a raw image file already attached to a VM, create a qcow2 file with +# that image as its external (raw) data file, and replace the raw image by +# the qcow2 image. +# +# Copyright (C) 2026 Red Hat, Inc. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Creator/Owner: Hanna Czenczek + +from enum import Enum, auto +import re +import iotests +from iotests import log, qemu_img, qemu_img_log, qemu_io_log + +iotests.script_initialize( + supported_fmts=3D['qcow2'], + unsupported_imgopts=3D['compat'], +) + +DISK_SIZE =3D 64 * 1024 * 1024 + +class CreateException(Exception): + pass + +class GuestDiskType(Enum): + VIRTIO_BLK =3D auto() + SCSI_HD =3D auto() + SCSI_CD =3D auto() + +def do_test( + vm: iotests.VM, + with_raw_node: bool, + guest_disk_type: GuestDiskType, + preallocation: str, + qcow2_size: int, + raw_img_path: str, + qcow2_img_path: str, +) -> None: + log('=3D=3D=3D do_test() =3D=3D=3D') + log(f' - with_raw_node=3D{with_raw_node}') + log(f' - guest_disk_type=3D{guest_disk_type}') + log(f' - preallocation=3D{preallocation}') + log(f' - qcow2_size=3D{qcow2_size}') + + log('') + log('--- Setting up raw image ---') + qemu_img('create', '-f', 'raw', raw_img_path, str(DISK_SIZE)) + + log('') + log('--- Launching VM ---') + + vm.add_blockdev(vm.qmp_to_opts({ + 'driver': 'file', + 'node-name': 'protocol', + 'filename': raw_img_path, + })) + + if with_raw_node: + vm.add_blockdev(vm.qmp_to_opts({ + 'driver': 'raw', + 'node-name': 'raw', + 'file': 'protocol', + })) + raw_node =3D 'raw' + else: + raw_node =3D 'protocol' + + dev_id =3D 'sda' + qom_path =3D f'/machine/peripheral/{dev_id}' + if guest_disk_type =3D=3D GuestDiskType.VIRTIO_BLK: + vm.add_device(f'virtio-blk,id=3D{dev_id},drive=3D{raw_node}') + dev_id =3D f'{qom_path}/virtio-backend' + elif guest_disk_type =3D=3D GuestDiskType.SCSI_HD: + vm.add_device('virtio-scsi') + vm.add_device(f'scsi-hd,id=3D{dev_id},drive=3D{raw_node}') + elif guest_disk_type =3D=3D GuestDiskType.SCSI_CD: + vm.add_device('virtio-scsi') + vm.add_device(f'scsi-cd,id=3D{dev_id},drive=3D{raw_node}') + + vm.launch() + + log('') + log('--- Creating qcow2 image ---') + + create_and_open(vm, { + 'driver': 'file', + 'filename': qcow2_img_path, + }, { + 'size': 0, + }, { + 'node-name': 'qcow2-protocol', + }) + + create_and_open(vm, { + 'driver': 'qcow2', + 'file': 'qcow2-protocol', + 'data-file': 'protocol', + }, { + 'data-file-raw': True, + 'size': qcow2_size, + 'preallocation': preallocation, + }, { + 'node-name': 'qcow2', + }) + + cmd =3D 'aio_write -P 42 0 4M' + log(f'[HMP qemu-io: {cmd}]') + log(vm.qmp( + 'human-monitor-command', + command_line=3Df'qemu-io -d {dev_id} "{cmd}"', + )) + + if with_raw_node: + log('[blockdev-reopen]') + log(vm.qmp('blockdev-reopen', { + 'options': [{ + 'driver': 'raw', + 'node-name': 'raw', + 'file': 'qcow2', + }], + })) + else: + log('[qom-set]') + log(vm.qmp('qom-set', { + 'path': qom_path, + 'property': 'drive', + 'value': 'qcow2', + })) + + cmd =3D 'aio_flush' + log(f'[HMP qemu-io: {cmd}]') + log(vm.qmp( + 'human-monitor-command', + command_line=3Df'qemu-io -d {dev_id} {cmd}', + )) + + vm.shutdown() + + qlog =3D vm.get_log() + if qlog is not None: + log('[qemu log]') + qlog =3D iotests.filter_qemu_io(iotests.filter_qtest(qlog)) + log(qlog) + + log('[qemu-img check]') + qemu_img_log('check', '-f', 'qcow2', qcow2_img_path) + + cmd =3D 'read -P 42 0 4M' + log(f'[qemu-io: {cmd}]') + qemu_io_log(qcow2_img_path, '-c', cmd) + +def create_and_open( + vm: iotests.VM, + base_options: dict[str, object], + create_options: dict[str, object], + open_options: dict[str, object], +) -> None: + driver =3D base_options['driver'] + log(f'[blockdev-create: {driver}]') + log(vm.qmp('blockdev-create', { + 'job-id': 'create', + 'options': base_options | create_options, + })) + + while True: + event =3D vm.event_wait( + name=3D'JOB_STATUS_CHANGE', + match=3D{'data': {'id': 'create'}}, + ) + assert event is not None + status =3D event['data']['status'] + log(f' -> {status}') + if status =3D=3D 'aborting': + jobs =3D vm.qmp('query-jobs')['return'] + job_info =3D next(job for job in jobs if job['id'] =3D=3D 'cre= ate') + error =3D re.sub(r'#block\d+', '#blockXXX', job_info['error']) + log(f'blockdev-create failed: {error}') + raise CreateException(error) + if status =3D=3D 'concluded': + break + + log('[job-dismiss]') + log(vm.qmp('job-dismiss', id=3D'create')) + log('[blockdev-add]') + log(vm.qmp('blockdev-add', base_options | open_options)) + +def verify_exception( + exception: CreateException, + conflicting_permissions: list[str], + with_raw_node: bool, + guest_disk_type: GuestDiskType, +) -> None: + if with_raw_node: + user =3D "node 'raw'" + user_child =3D 'file' + elif guest_disk_type =3D=3D GuestDiskType.VIRTIO_BLK: + user =3D "block device '/machine/peripheral/sda/virtio-backend'" + user_child =3D 'root' + else: + user =3D "block device 'sda'" + user_child =3D 'root' + + refstr =3D ( + "Permission conflict on node 'protocol': permissions " + f"'{', '.join(conflicting_permissions)}' are both required by node= " + "'#blockXXX' (uses node 'protocol' as 'data-file' child) and unsha= red " + f"by {user} (uses node 'protocol' as '{user_child}' child)." + ) + + if str(exception) !=3D refstr: + log("Exception differs from reference:") + log(f'Is: {exception}') + log(f'Expected: {refstr}') + assert str(exception) =3D=3D refstr + +def run_test( + with_raw_node: bool, + guest_disk_type: GuestDiskType, + preallocation: str, + qcow2_size: int, +) -> None: + with iotests.FilePath('raw.img') as raw_img_path, \ + iotests.FilePath('metadata.qcow2') as qcow2_img_path, \ + iotests.VM() as vm: + try: + do_test( + vm, + with_raw_node, + guest_disk_type, + preallocation, + qcow2_size, + raw_img_path, + qcow2_img_path, + ) + except CreateException as e: + expected_conflicting_perms =3D [] + + if preallocation in ('falloc', 'full'): + # Data preallocation must fail because it must write to the + # data file, requiring the WRITE permission. + # For a data file, the WRITE permission implies the RESIZE + # permission. CD does not allow resizing, so it will conf= lict + # on both WRITE and RESIZE. + if guest_disk_type =3D=3D GuestDiskType.SCSI_CD: + expected_conflicting_perms +=3D ['write', 'resize'] + else: + expected_conflicting_perms +=3D ['write'] + elif guest_disk_type =3D=3D GuestDiskType.SCSI_CD and \ + qcow2_size > DISK_SIZE: + # CD does not allow resizing, but creating a bigger qcow2 = image + # would require growing the raw image, necessitating the R= ESIZE + # permission. (Creating a smaller qcow2 however will not + # shrink it.) + expected_conflicting_perms +=3D ['resize'] + + if not expected_conflicting_perms: + raise e + + verify_exception(e, expected_conflicting_perms, + with_raw_node, guest_disk_type) + log('(Handled expected exception)') + log('') + + +def run_all_test_combinations(): + for with_raw_node in (False, True): + for guest_disk_type in GuestDiskType: + for preallocation in ('off', 'metadata', 'falloc', 'full'): + # Sprinkle in -512 and +512 to verify that non-cluster-ali= gned + # sizes work, too + for qcow2_size in (DISK_SIZE, DISK_SIZE // 2 - 512, + DISK_SIZE * 2 + 512): + run_test(with_raw_node, guest_disk_type, preallocation, + qcow2_size) + +run_all_test_combinations() diff --git a/tests/qemu-iotests/tests/qcow2-live-data-file.out b/tests/qemu= -iotests/tests/qcow2-live-data-file.out new file mode 100644 index 0000000000..9cdad853fa --- /dev/null +++ b/tests/qemu-iotests/tests/qcow2-live-data-file.out @@ -0,0 +1,2904 @@ +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Doff + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[qom-set] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +1024/1024 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Doff + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[qom-set] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +512/512 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed clusters +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Doff + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[qom-set] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +2049/2049 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dmetadata + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[qom-set] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +1024/1024 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dmetadata + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[qom-set] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +512/512 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed clusters +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dmetadata + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[qom-set] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +2049/2049 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dfalloc + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by block device '/machine/peripheral/sda/virt= io-backend' (uses node 'protocol' as 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dfalloc + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by block device '/machine/peripheral/sda/virt= io-backend' (uses node 'protocol' as 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dfalloc + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by block device '/machine/peripheral/sda/virt= io-backend' (uses node 'protocol' as 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dfull + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by block device '/machine/peripheral/sda/virt= io-backend' (uses node 'protocol' as 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dfull + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by block device '/machine/peripheral/sda/virt= io-backend' (uses node 'protocol' as 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dfull + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by block device '/machine/peripheral/sda/virt= io-backend' (uses node 'protocol' as 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Doff + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[qom-set] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +1024/1024 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Doff + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[qom-set] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +512/512 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed clusters +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Doff + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[qom-set] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +2049/2049 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dmetadata + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[qom-set] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +1024/1024 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dmetadata + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[qom-set] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +512/512 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed clusters +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dmetadata + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[qom-set] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +2049/2049 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dfalloc + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by block device 'sda' (uses node 'protocol' a= s 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dfalloc + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by block device 'sda' (uses node 'protocol' a= s 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dfalloc + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by block device 'sda' (uses node 'protocol' a= s 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dfull + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by block device 'sda' (uses node 'protocol' a= s 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dfull + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by block device 'sda' (uses node 'protocol' a= s 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dfull + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by block device 'sda' (uses node 'protocol' a= s 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Doff + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[qom-set] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +1024/1024 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Doff + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[qom-set] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +512/512 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed clusters +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Doff + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'resize' are both required by node '#blockXXX' (uses node 'protocol' as '= data-file' child) and unshared by block device 'sda' (uses node 'protocol' = as 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dmetadata + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[qom-set] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +1024/1024 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dmetadata + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[qom-set] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +512/512 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed clusters +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dmetadata + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'resize' are both required by node '#blockXXX' (uses node 'protocol' as '= data-file' child) and unshared by block device 'sda' (uses node 'protocol' = as 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dfalloc + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write, resize' are both required by node '#blockXXX' (uses node 'protoco= l' as 'data-file' child) and unshared by block device 'sda' (uses node 'pro= tocol' as 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dfalloc + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write, resize' are both required by node '#blockXXX' (uses node 'protoco= l' as 'data-file' child) and unshared by block device 'sda' (uses node 'pro= tocol' as 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dfalloc + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write, resize' are both required by node '#blockXXX' (uses node 'protoco= l' as 'data-file' child) and unshared by block device 'sda' (uses node 'pro= tocol' as 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dfull + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write, resize' are both required by node '#blockXXX' (uses node 'protoco= l' as 'data-file' child) and unshared by block device 'sda' (uses node 'pro= tocol' as 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dfull + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write, resize' are both required by node '#blockXXX' (uses node 'protoco= l' as 'data-file' child) and unshared by block device 'sda' (uses node 'pro= tocol' as 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DFalse + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dfull + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write, resize' are both required by node '#blockXXX' (uses node 'protoco= l' as 'data-file' child) and unshared by block device 'sda' (uses node 'pro= tocol' as 'root' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Doff + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[blockdev-reopen] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +1024/1024 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Doff + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[blockdev-reopen] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +512/512 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed clusters +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Doff + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[blockdev-reopen] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +2049/2049 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dmetadata + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[blockdev-reopen] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +1024/1024 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dmetadata + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[blockdev-reopen] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +512/512 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed clusters +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dmetadata + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[blockdev-reopen] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +2049/2049 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dfalloc + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by node 'raw' (uses node 'protocol' as 'file'= child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dfalloc + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by node 'raw' (uses node 'protocol' as 'file'= child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dfalloc + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by node 'raw' (uses node 'protocol' as 'file'= child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dfull + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by node 'raw' (uses node 'protocol' as 'file'= child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dfull + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by node 'raw' (uses node 'protocol' as 'file'= child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.VIRTIO_BLK + - preallocation=3Dfull + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by node 'raw' (uses node 'protocol' as 'file'= child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Doff + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[blockdev-reopen] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +1024/1024 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Doff + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[blockdev-reopen] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +512/512 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed clusters +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Doff + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[blockdev-reopen] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +2049/2049 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dmetadata + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[blockdev-reopen] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +1024/1024 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dmetadata + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[blockdev-reopen] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +512/512 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed clusters +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dmetadata + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[blockdev-reopen] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +2049/2049 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dfalloc + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by node 'raw' (uses node 'protocol' as 'file'= child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dfalloc + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by node 'raw' (uses node 'protocol' as 'file'= child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dfalloc + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by node 'raw' (uses node 'protocol' as 'file'= child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dfull + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by node 'raw' (uses node 'protocol' as 'file'= child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dfull + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by node 'raw' (uses node 'protocol' as 'file'= child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_HD + - preallocation=3Dfull + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write' are both required by node '#blockXXX' (uses node 'protocol' as 'd= ata-file' child) and unshared by node 'raw' (uses node 'protocol' as 'file'= child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Doff + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[blockdev-reopen] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +1024/1024 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Doff + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[blockdev-reopen] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +512/512 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed clusters +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Doff + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'resize' are both required by node '#blockXXX' (uses node 'protocol' as '= data-file' child) and unshared by node 'raw' (uses node 'protocol' as 'file= ' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dmetadata + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[blockdev-reopen] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +1024/1024 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed cluste= rs +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dmetadata + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[HMP qemu-io: aio_write -P 42 0 4M] +{"return": ""} +[blockdev-reopen] +{"return": {}} +[HMP qemu-io: aio_flush] +{"return": ""} +[qemu log] +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[qemu-img check] +No errors were found on the image. +512/512 =3D 100.00% allocated, 0.00% fragmented, 0.00% compressed clusters +Image end offset: 327680 + +[qemu-io: read -P 42 0 4M] +read 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dmetadata + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'resize' are both required by node '#blockXXX' (uses node 'protocol' as '= data-file' child) and unshared by node 'raw' (uses node 'protocol' as 'file= ' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dfalloc + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write, resize' are both required by node '#blockXXX' (uses node 'protoco= l' as 'data-file' child) and unshared by node 'raw' (uses node 'protocol' a= s 'file' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dfalloc + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write, resize' are both required by node '#blockXXX' (uses node 'protoco= l' as 'data-file' child) and unshared by node 'raw' (uses node 'protocol' a= s 'file' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dfalloc + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write, resize' are both required by node '#blockXXX' (uses node 'protoco= l' as 'data-file' child) and unshared by node 'raw' (uses node 'protocol' a= s 'file' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dfull + - qcow2_size=3D67108864 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write, resize' are both required by node '#blockXXX' (uses node 'protoco= l' as 'data-file' child) and unshared by node 'raw' (uses node 'protocol' a= s 'file' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dfull + - qcow2_size=3D33553920 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write, resize' are both required by node '#blockXXX' (uses node 'protoco= l' as 'data-file' child) and unshared by node 'raw' (uses node 'protocol' a= s 'file' child). +(Handled expected exception) + +=3D=3D=3D do_test() =3D=3D=3D + - with_raw_node=3DTrue + - guest_disk_type=3DGuestDiskType.SCSI_CD + - preallocation=3Dfull + - qcow2_size=3D134218240 + +--- Setting up raw image --- + +--- Launching VM --- + +--- Creating qcow2 image --- +[blockdev-create: file] +{"return": {}} + -> created + -> running + -> waiting + -> pending + -> concluded +[job-dismiss] +{"return": {}} +[blockdev-add] +{"return": {}} +[blockdev-create: qcow2] +{"return": {}} + -> null + -> created + -> running + -> aborting +blockdev-create failed: Permission conflict on node 'protocol': permission= s 'write, resize' are both required by node '#blockXXX' (uses node 'protoco= l' as 'data-file' child) and unshared by node 'raw' (uses node 'protocol' a= s 'file' child). +(Handled expected exception) + --=20 2.53.0