From nobody Mon Apr 29 09:41:20 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1576760643; cv=none; d=zohomail.com; s=zohoarc; b=aQrFMU0h3hEgiFGrbTzy+qlD4b8+RxH7DDNCZpWl+PauyXR68KZBjqkKsYgE/IHxqQN5bvdYm7CerhNKTvZWrxWH/bxajNjVqX6LEQvtqfo2u4fFFKsMYwANOluqe8UQVqgSm44PenRA5a+TMJhuIa+SQ8BT2qjBUUC3cMLwa6o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576760643; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=mJYRaB+zXX5eueh7N2Sh8nJY2+XkOOgPVXg9m3dGKP8=; b=EsfEZz0vpZOY2UIhS1wR5wmHQJfALqHkSPCf9SZMyLFtdimO5cA8IliN8MeTDhfVCD4oWgvwqS73A/tucNOZpQKTQlH2F/sz37WkzatduIhmjPrK4l9RxBPB/zyXKBSzuubkkbATV8KviqTBHBOpaAcOFyhQzAeEwbuS5tgp/mA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576760643100700.5315908260252; Thu, 19 Dec 2019 05:04:03 -0800 (PST) Received: from localhost ([::1]:40588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihvTF-0000t6-8H for importer@patchew.org; Thu, 19 Dec 2019 08:04:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47099) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihvHa-0002ka-Jd for qemu-devel@nongnu.org; Thu, 19 Dec 2019 07:51:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihvHZ-0008Oo-3E for qemu-devel@nongnu.org; Thu, 19 Dec 2019 07:51:58 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:43795) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihvHY-0008FD-NX; Thu, 19 Dec 2019 07:51:56 -0500 Received: by mail-wr1-x441.google.com with SMTP id d16so5837482wre.10; Thu, 19 Dec 2019 04:51:56 -0800 (PST) Received: from sparse-local.redhat.com (93-173-2-23.bb.netvision.net.il. [93.173.2.23]) by smtp.gmail.com with ESMTPSA id s65sm6207905wmf.48.2019.12.19.04.51.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 04:51:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mJYRaB+zXX5eueh7N2Sh8nJY2+XkOOgPVXg9m3dGKP8=; b=AlXyv9M1OgC/F8VAPj6chtsFmQFfuxmW8t0+9EKvEZc40ZoG3SvCraYJKF51AwRip4 /qC6uxrnskkBCLpDKpxKnOkrGqvq3JK6xPF7F3JI6wskVp/3XbjFDqbYqNppWJXB7icT K9BC92mgu06MCpt4EWSC3jrFEt24Wbuh1knTghaNI7jQtQlOfjDeCkUX9ICbn3RJxrgR INSjoIPOmX8UtP0TRoxjNTYvGkkp28qV2thQ9IrE+jrpfPoVfUtLS5Ei/iE6ONo4kVyM cJ8tTGPmMt176zFYPbUwDt7lcPUaPPwWPMvnhdAwhiUiGzoFyuGRBnV+zNT3jDaIX3Ad EuAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mJYRaB+zXX5eueh7N2Sh8nJY2+XkOOgPVXg9m3dGKP8=; b=KfRv4obpbnUzbDIUhTa8e9SHcfurt6+nawqQTa/rgUbKojQ6bLPhudfb4j1jPiAuCR r6ZpjrpHv+UUNlVV9lCAL9SdkE3/8hmtbuVR1jxtW6t8fSAENN13xxznoQxyOS7UmOmY YzbVQHHY2YUoIQr6pEq5Gmc6euxA/dR0Qo17Mdpd5HZp+q8ZhkwIikgrvbDVYrjD680N JWh2Yf76bJc/RclymEgHtptSooXShMxScDAJrHU7r+JEhsUsT1flL0E9sdnhZpHbYzbU /GJHIt0unDK86j97yMIGXh3BEW4Y4Fi9qf5zUEuOHkfNXU8XUwjcJqUhP+qikos6w3ev 3Cdg== X-Gm-Message-State: APjAAAWErmQCOqSRlHxQtaE8mgYWM7rQ0ImJwglMGGpOCwcOMdgqO0Px xRgBu6qua/+aAsiw44b2Agt4utaz X-Google-Smtp-Source: APXvYqzinrpi6iA2CvgidZwVtKV6Ssg3m+QtLJRUNFLseRiawl+JAB0e3oHFjZFZUn24lz62uSW1cQ== X-Received: by 2002:a05:6000:118e:: with SMTP id g14mr9244602wrx.39.1576759914512; Thu, 19 Dec 2019 04:51:54 -0800 (PST) From: Nir Soffer X-Google-Original-From: Nir Soffer To: qemu-devel@nongnu.org Subject: [PATCH] block: nbd: Fix dirty bitmap context name Date: Thu, 19 Dec 2019 14:51:51 +0200 Message-Id: <20191219125151.21482-1-nsoffer@redhat.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Nir Soffer , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" When adding an export with a dirty bitmap, expose the bitmap at: qemu:dirty-bitmap:export-name This matches qapi documentation, and user expectations. Without this, qemu leaks libvirt implementations details to clients by exposing the bitmap using the actual bitmap name: qemu:dirty-bitmap:bitmap-name And all clients need to duplicate code like: meta_context =3D "qemu:dirty-bitmap:backup-" + export_name NBD allows exposing multiple bitmaps under "qemu:dirty-bitmap:" namespace, and clients can query the available bitmaps, but it is not clear what a client should do if a server provides multiple bitmaps. --- nbd/server.c | 2 +- tests/qemu-iotests/223 | 16 ++++++++-------- tests/qemu-iotests/223.out | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/nbd/server.c b/nbd/server.c index 24ebc1a805..f20f2994c0 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -1574,7 +1574,7 @@ NBDExport *nbd_export_new(BlockDriverState *bs, uint6= 4_t dev_offset, exp->export_bitmap =3D bm; assert(strlen(bitmap) <=3D BDRV_BITMAP_MAX_NAME_SIZE); exp->export_bitmap_context =3D g_strdup_printf("qemu:dirty-bitmap:= %s", - bitmap); + name); assert(strlen(exp->export_bitmap_context) < NBD_MAX_STRING_SIZE); } =20 diff --git a/tests/qemu-iotests/223 b/tests/qemu-iotests/223 index ea69cd4b8b..3068a7c280 100755 --- a/tests/qemu-iotests/223 +++ b/tests/qemu-iotests/223 @@ -167,7 +167,7 @@ $QEMU_IO -r -c 'r -P 0x22 512 512' -c 'r -P 0 512k 512k= ' -c 'r -P 0x11 1m 1m' \ $QEMU_IMG map --output=3Djson --image-opts \ "$IMG" | _filter_qemu_img_map $QEMU_IMG map --output=3Djson --image-opts \ - "$IMG,x-dirty-bitmap=3Dqemu:dirty-bitmap:b" | _filter_qemu_img_map + "$IMG,x-dirty-bitmap=3Dqemu:dirty-bitmap:n" | _filter_qemu_img_map =20 echo echo "=3D=3D=3D Contrast to small granularity dirty-bitmap =3D=3D=3D" @@ -175,7 +175,7 @@ echo =20 IMG=3D"driver=3Dnbd,export=3Dn2,server.type=3Dunix,server.path=3D$SOCK_DIR= /nbd" $QEMU_IMG map --output=3Djson --image-opts \ - "$IMG,x-dirty-bitmap=3Dqemu:dirty-bitmap:b2" | _filter_qemu_img_map + "$IMG,x-dirty-bitmap=3Dqemu:dirty-bitmap:n2" | _filter_qemu_img_map =20 echo echo "=3D=3D=3D End qemu NBD server =3D=3D=3D" @@ -199,15 +199,15 @@ echo echo "=3D=3D=3D Use qemu-nbd as server =3D=3D=3D" echo =20 -nbd_server_start_unix_socket -r -f $IMGFMT -B b "$TEST_IMG" -IMG=3D"driver=3Dnbd,server.type=3Dunix,server.path=3D$nbd_unix_socket" +nbd_server_start_unix_socket -r -f $IMGFMT -x n -B b "$TEST_IMG" +IMG=3D"driver=3Dnbd,export=3Dn,server.type=3Dunix,server.path=3D$nbd_unix_= socket" $QEMU_IMG map --output=3Djson --image-opts \ - "$IMG,x-dirty-bitmap=3Dqemu:dirty-bitmap:b" | _filter_qemu_img_map + "$IMG,x-dirty-bitmap=3Dqemu:dirty-bitmap:n" | _filter_qemu_img_map =20 -nbd_server_start_unix_socket -f $IMGFMT -B b2 "$TEST_IMG" -IMG=3D"driver=3Dnbd,server.type=3Dunix,server.path=3D$nbd_unix_socket" +nbd_server_start_unix_socket -f $IMGFMT -x n -B b2 "$TEST_IMG" +IMG=3D"driver=3Dnbd,export=3Dn,server.type=3Dunix,server.path=3D$nbd_unix_= socket" $QEMU_IMG map --output=3Djson --image-opts \ - "$IMG,x-dirty-bitmap=3Dqemu:dirty-bitmap:b2" | _filter_qemu_img_map + "$IMG,x-dirty-bitmap=3Dqemu:dirty-bitmap:n" | _filter_qemu_img_map =20 # success, all done echo '*** done' diff --git a/tests/qemu-iotests/223.out b/tests/qemu-iotests/223.out index f175598802..9f879add60 100644 --- a/tests/qemu-iotests/223.out +++ b/tests/qemu-iotests/223.out @@ -61,7 +61,7 @@ exports available: 2 max block: 33554432 available meta contexts: 2 base:allocation - qemu:dirty-bitmap:b + qemu:dirty-bitmap:n export: 'n2' size: 4194304 flags: 0xced ( flush fua trim zeroes df cache fast-zero ) @@ -70,7 +70,7 @@ exports available: 2 max block: 33554432 available meta contexts: 2 base:allocation - qemu:dirty-bitmap:b2 + qemu:dirty-bitmap:n2 =20 =3D=3D=3D Contrast normal status to large granularity dirty-bitmap =3D=3D= =3D =20 @@ -141,7 +141,7 @@ exports available: 2 max block: 33554432 available meta contexts: 2 base:allocation - qemu:dirty-bitmap:b + qemu:dirty-bitmap:n export: 'n2' size: 4194304 flags: 0xced ( flush fua trim zeroes df cache fast-zero ) @@ -150,7 +150,7 @@ exports available: 2 max block: 33554432 available meta contexts: 2 base:allocation - qemu:dirty-bitmap:b2 + qemu:dirty-bitmap:n2 =20 =3D=3D=3D Contrast normal status to large granularity dirty-bitmap =3D=3D= =3D =20 --=20 2.21.0