From patchwork Thu Feb 1 18:30:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Andryuk X-Patchwork-Id: 13541631 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A0901C48286 for ; Thu, 1 Feb 2024 18:30:48 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.674669.1049740 (Exim 4.92) (envelope-from ) id 1rVbph-0002Fe-6I; Thu, 01 Feb 2024 18:30:41 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 674669.1049740; Thu, 01 Feb 2024 18:30:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rVbph-0002FV-3R; Thu, 01 Feb 2024 18:30:41 +0000 Received: by outflank-mailman (input) for mailman id 674669; Thu, 01 Feb 2024 18:30:40 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rVbpg-00020T-Im for xen-devel@lists.xenproject.org; Thu, 01 Feb 2024 18:30:40 +0000 Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [2607:f8b0:4864:20::f32]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ffd0bc85-c12f-11ee-8a43-1f161083a0e0; Thu, 01 Feb 2024 19:30:40 +0100 (CET) Received: by mail-qv1-xf32.google.com with SMTP id 6a1803df08f44-6818a9fe380so7291216d6.2 for ; Thu, 01 Feb 2024 10:30:40 -0800 (PST) Received: from pm2-ws13.praxislan02.com (207-172-141-204.s8906.c3-0.slvr-cbr1.lnh-slvr.md.cable.rcncustomer.com. [207.172.141.204]) by smtp.gmail.com with ESMTPSA id pf8-20020a056214498800b0068c75141e73sm25824qvb.2.2024.02.01.10.30.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 10:30:37 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ffd0bc85-c12f-11ee-8a43-1f161083a0e0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706812238; x=1707417038; darn=lists.xenproject.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=+F33WLb8SsbhR8svkMBYfGDsCEmngZ8q/7ZaljEVS3M=; b=UwPIDUq10isCpumWgi97FEc+KPHMV/lzjQUdUJom8FKLNOJFrxvg3FpDxy5n1gp0SE ILP/i+JESIXyEntN9bZ7ZnT0kSF9Lghvd2zwS+Ry47cSDo81pHYekxtpC4VRgBVOFAK/ a1Yld2ffKmAMfgyouFIDep2M93QDSeBunhSO4rlgMxWgc3obZ0v6hJoL3n1Xv7GSDkMi OPccFDprcDcMguOjOwAyltWBf8EWXT58S4poeFpQKBBALojtDoGsdS2+p8gToes8vzkC uPGaBEHFBmakozTIu8ss+w5px7ICfrjYndxV+xBhNnPn2AQScBW7p7OEV2VSRyJHvWF4 S6tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706812238; x=1707417038; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+F33WLb8SsbhR8svkMBYfGDsCEmngZ8q/7ZaljEVS3M=; b=u0KzJ0SFsLvWzqhs/El9QLGfcKEqRfX3qbSny+BaEjNoJdGm3O6rFscApUIUTrpQzg W6G5pQPE6ih1PCBMbbVG/K/gvZT67NSCah02mii74/K2cP4Pn1Vq9zpm3lXgq+gyCSAG XPT+z45wV1qjxAu0suGPhimK1LBdPDCB3DRcHFC3M4loetB6+/5KfsDfdG8FSGQ7uZoT 8cEfIPWkkk+BUwrX29FLYmXHB6X8bSyzUky0xN5IBYJTLxpum/KtzPWWzNTFJCYyO6PF HgSfdW8teWeWgdW77qbHMfiuaUTc9vUyG/kXH3eKcwC0FMt+KjUJ3EzdUfqYKwaRF8Gs 3Ahw== X-Gm-Message-State: AOJu0YygHjLqaUkQdraYAfzk38lBy+7c1hE0yaC5XANj1aZlbcEJKohG 3rdjr2+ZCagm4bTxfzDClSljNQ3KCgQtJzOsaqj3mGIhsikuCBauWSv//0im X-Google-Smtp-Source: AGHT+IEShpw6JudIZoJMi92UdXTK/nz8GoPmUq8wT+imB1lMTJxLIqgl6uF2XZHxabDNwONIF0UnIA== X-Received: by 2002:ad4:5746:0:b0:686:a472:1205 with SMTP id q6-20020ad45746000000b00686a4721205mr6139692qvx.0.1706812238079; Thu, 01 Feb 2024 10:30:38 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVCqkg7ZSjgpD/6/3COlNsVpzNskT++aPAlEYlQcK/J6/X50n8ZfzMbMgXQu2IqIT3VJLJ2pWTsNJ/JK/rhpjASjcHk5PBWTPpYhRO3amEmvhZkTGv+ From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Wei Liu , Anthony PERARD Subject: [PATCH 1/4] block-common: Fix same_vm for no targets Date: Thu, 1 Feb 2024 13:30:21 -0500 Message-ID: <20240201183024.145424-2-jandryuk@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201183024.145424-1-jandryuk@gmail.com> References: <20240201183024.145424-1-jandryuk@gmail.com> MIME-Version: 1.0 same_vm is broken when the two main domains do not have targets. otvm and targetvm are both missing, which means they get set to -1 and then converted to empty strings: ++10697+ local targetvm=-1 ++10697+ local otvm=-1 ++10697+ otvm= ++10697+ othervm=/vm/cc97bc2f-3a91-43f7-8fbc-4cb92f90b4e4 ++10697+ targetvm= ++10697+ local frontend_uuid=/vm/844dea4e-44f8-4e3e-8145-325132a31ca5 The final comparison returns true since the two empty strings match: ++10697+ '[' /vm/844dea4e-44f8-4e3e-8145-325132a31ca5 = /vm/cc97bc2f-3a91-43f7-8fbc-4cb92f90b4e4 -o '' = /vm/cc97bc2f-3a91-43f7-8fbc-4cb92f90b4e4 -o /vm/844dea4e-44f8-4e3e-8145-325132a31ca5 = '' -o '' = '' ']' Replace -1 with distinct strings indicating the lack of a value and remove the collescing to empty stings. The strings themselves will no longer match, and that is correct. ++12364+ '[' /vm/844dea4e-44f8-4e3e-8145-325132a31ca5 = /vm/cc97bc2f-3a91-43f7-8fbc-4cb92f90b4e4 -o 'No target' = /vm/cc97bc2f-3a91-43f7-8fbc-4cb92f90b4e4 -o /vm/844dea4e-44f8-4e3e-8145-325132a31ca5 = 'No other target' -o 'No target' = 'No other target' ']' Signed-off-by: Jason Andryuk Reviewed-by: Anthony PERARD --- tools/hotplug/Linux/block-common.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/hotplug/Linux/block-common.sh b/tools/hotplug/Linux/block-common.sh index f86a88c4eb..5c80237d99 100644 --- a/tools/hotplug/Linux/block-common.sh +++ b/tools/hotplug/Linux/block-common.sh @@ -112,14 +112,12 @@ same_vm() "$FRONTEND_UUID") local target=$(xenstore_read_default "/local/domain/$FRONTEND_ID/target" \ "-1") - local targetvm=$(xenstore_read_default "/local/domain/$target/vm" "-1") + local targetvm=$(xenstore_read_default "/local/domain/$target/vm" "No Target") local otarget=$(xenstore_read_default "/local/domain/$otherdom/target" \ "-1") local otvm=$(xenstore_read_default "/local/domain/$otarget/vm" \ - "-1") - otvm=${otvm%-1} - othervm=${othervm%-1} - targetvm=${targetvm%-1} + "No Other Target") + local frontend_uuid=${FRONTEND_UUID%-1} [ "$frontend_uuid" = "$othervm" -o "$targetvm" = "$othervm" -o \ From patchwork Thu Feb 1 18:30:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Andryuk X-Patchwork-Id: 13541633 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 43914C48286 for ; Thu, 1 Feb 2024 18:30:54 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.674670.1049750 (Exim 4.92) (envelope-from ) id 1rVbpm-0002Xv-Du; Thu, 01 Feb 2024 18:30:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 674670.1049750; Thu, 01 Feb 2024 18:30:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rVbpm-0002Xm-Al; Thu, 01 Feb 2024 18:30:46 +0000 Received: by outflank-mailman (input) for mailman id 674670; Thu, 01 Feb 2024 18:30:45 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rVbpl-0002Wb-2Q for xen-devel@lists.xenproject.org; Thu, 01 Feb 2024 18:30:45 +0000 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [2607:f8b0:4864:20::730]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 017bb2e7-c130-11ee-98f5-efadbce2ee36; Thu, 01 Feb 2024 19:30:42 +0100 (CET) Received: by mail-qk1-x730.google.com with SMTP id af79cd13be357-783d8e09a1cso73034085a.3 for ; Thu, 01 Feb 2024 10:30:42 -0800 (PST) Received: from pm2-ws13.praxislan02.com (207-172-141-204.s8906.c3-0.slvr-cbr1.lnh-slvr.md.cable.rcncustomer.com. [207.172.141.204]) by smtp.gmail.com with ESMTPSA id pf8-20020a056214498800b0068c75141e73sm25824qvb.2.2024.02.01.10.30.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 10:30:40 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 017bb2e7-c130-11ee-98f5-efadbce2ee36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706812241; x=1707417041; darn=lists.xenproject.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=PjjeoKX1m7W13o8Y7ZaEmX1lMzcVrUhBaLtbtuWZOxs=; b=WIQ8by9wMw2KvMGH49gSyXd36QEqZQA622acQ002jIMFMIxVWuGZul50oDt7i5ScWX VGBX8r3MhGIaeVc6xObwGA/QW+RORrZD9kH2tI7O+ujnhC9wZzu1BqQMBaPV0VHWEVlb hF5iTcRLKum26F2Qj6HhKkqsJf0v79pPU+9V48t/KcBMy2SlGUYKCKKoPOWJbXxRmZMZ v77EMJtgugJ0+G9Qd4aH8H5403vFnAXf/mNE5ahd8gINEbJ42b21gq4WEkpI7nkIi3aj SS0y37/8HIay1vvm2sEaAWPJ4c6tzXWR+4gnta7HyJE1tLGxJjRkNJcYvACCPh8LA/74 EF+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706812241; x=1707417041; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PjjeoKX1m7W13o8Y7ZaEmX1lMzcVrUhBaLtbtuWZOxs=; b=LgMm/hph4edgBqGNgiJnXrh9mdiOpUFAJcWLUbieDmZbCsoDUKBQa/+Iu/yojkN9nw M2BLVh7RXypRDDoWUnTQ2dlJZFmm+gMDf20iwvfgI2BylIc/qdsAKIuYsecLMNCjjhxO ip+H95wwFFhgRgnEgBvP27LHzwvxAb796hfiHBWHgv06QSR+/J8HBRjOXMpOzsW7LTKr cafheP6xhrP5CHgJX4ek3Ysoo0/J77Mzw0Vcq6950MF83GOpl1EvbxOoYs2H/lQW5U2o FNR1qW24WI9ESyFaLfrLY4qubAc7ImTkCNXz4IDwEfWnPq6jf4ceJD0LNOCM8bmfOlwE PG8g== X-Gm-Message-State: AOJu0YxuhG1zHXVPq4o3Dcyk3AGkGDmg3WxkRUwoGOSz04gPJvUy/FhZ N94oPdX7qO9Nceh/KFNazy3QbvGzhXQ4h/lZttweBuJ1U5nTVb61jVQyqDGC X-Google-Smtp-Source: AGHT+IFHvs1BSlxFAbLomRF+WK4BCyWVl6PudvCCCdULyTh8v4FtjY//z2fGun7qgHHPllbSX1rsxg== X-Received: by 2002:ad4:4ea4:0:b0:68c:61bd:7765 with SMTP id ed4-20020ad44ea4000000b0068c61bd7765mr6903583qvb.45.1706812240849; Thu, 01 Feb 2024 10:30:40 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUYh1WG/ROL1iDB4lPXW50gxnr9Y/V7AJ3B0CY7+Ub0PhR7RfgTo5nnJIcli8/j7t8CiihQDJFiPSft5ZniYYiK7NPm1J2tGxvtsXgRUsFt6+hfcP8Zy4Ivq4HcVhDdMpnJHprtF7g= From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Wei Liu , Anthony PERARD , Juergen Gross Subject: [PATCH 2/4] libxl: Add support for blktap vbd3 Date: Thu, 1 Feb 2024 13:30:22 -0500 Message-ID: <20240201183024.145424-3-jandryuk@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201183024.145424-1-jandryuk@gmail.com> References: <20240201183024.145424-1-jandryuk@gmail.com> MIME-Version: 1.0 This patch re-introduces blktap support to libxl. Unlike earlier versions, it does not link against any blktap library. libxl changes are needed to write to the vbd3 backend XenStore nodes. blktap has three components. tapdisk is a daemon implementing the disk IO, NBD (Network Block Device), and Xen PV interfaces. tap-ctl is a tool to control tapdisks - creating, starting, stopping and freeing. tapback manages the XenStore operations and instructs tapdisk to connect. It is notable that tapdisk performs the grant and event channel ops, but doesn't interact with XenStore. tapback performs XenStore operations and notifies tapdisks of values and changes. The flow is: libxl writes to the "vbd3" XenStore nodes and runs the block-tap script. The block-tap script runs tap-ctl to create a tapdisk instance as the physical device. tapback then sees the tapdisk and instructs the tapdisk to connect up the PV blkif interface. This is expected to work without the kernel blktap driver, so the block-tap script is modified accordingly to write the UNIX NBD path. backendtype=tap was not fully removed previously, but it would never succeed since it would hit the hardcoded error in disk_try_backend(). It is reused now. An example command to attach a vhd: xl block-attach vm 'vdev=xvdf,backendtype=tap,format=vhd,target=/srv/target.vhd' Format raw also works to run an "aio:" tapdisk. Signed-off-by: Jason Andryuk Reviewed-by: Anthony PERARD --- VHD support is important for OpenXT since there are lots of existing VHDs which still need supporting. tapdisk also supports encrypting VHDs which is not available in QEMU. --- docs/man/xl-disk-configuration.5.pod.in | 4 +++- tools/libs/light/libxl_device.c | 14 ++++++++++---- tools/libs/light/libxl_disk.c | 20 +++++++++++++++----- tools/libs/light/libxl_linux.c | 1 + tools/libs/light/libxl_types_internal.idl | 1 + tools/libs/light/libxl_utils.c | 2 ++ 6 files changed, 32 insertions(+), 10 deletions(-) diff --git a/docs/man/xl-disk-configuration.5.pod.in b/docs/man/xl-disk-configuration.5.pod.in index bc945cc517..cb442bd5b4 100644 --- a/docs/man/xl-disk-configuration.5.pod.in +++ b/docs/man/xl-disk-configuration.5.pod.in @@ -232,7 +232,7 @@ Specifies the backend implementation to use =item Supported values -phy, qdisk, standalone +phy, qdisk, standalone, tap =item Mandatory @@ -254,6 +254,8 @@ and "standalone" does not support specifications other than "virtio". Normally this option should not be specified, in which case libxl will automatically determine the most suitable backend. +"tap" needs blktap's tapback to be running. + =item B