From nobody Fri May 17 03:00:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=huawei.com ARC-Seal: i=1; a=rsa-sha256; t=1677231424; cv=none; d=zohomail.com; s=zohoarc; b=m96TZVlWy05ZFcn9ti2Cif+0ZdHZxuRwLQ1hYy3xI0snQHrSj/xHRvnlfqJCU+Z6xX3+40O3SWrSmUcMygMXXcZnCpdACtcd0HsLXlyNQ6/JL2n5CXJ2XxbG4AZPtdI8Dj8+CRO7zjn6RcMZ7/jvkDWf2+qbQ1g7zMXLbTULgnk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677231424; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=j7tSEFcz6ogiy0xz59wOMZHLPJFIWkt/8R6sY0mEdf0=; b=H0/B31sd5Wq9TduRxgU+Kj6OBmTUQ1JCgZlZEo5mPc05vCHq04+uSLJ9Mm7qU61Lejndnz5Fgo57jtdICKp2Tm7MFPGR6AQfpnNyj9cT2bQATjy9490zNnlo9ZzbuoaCbRCLsTymQ7H9FC63+6bnZAQLY59z7yii1NtYIoxf3VM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1677231424216347.9317975992326; Fri, 24 Feb 2023 01:37:04 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-158-3_eEB7weMMGFbYJfIIfctg-1; Fri, 24 Feb 2023 04:36:42 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A31E880D0F3; Fri, 24 Feb 2023 09:36:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1B7E404BEC0; Fri, 24 Feb 2023 09:36:39 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B48EC19465B2; Fri, 24 Feb 2023 09:36:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DAB6919465A0 for ; Fri, 24 Feb 2023 09:36:37 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id CA559404BEC1; Fri, 24 Feb 2023 09:36:37 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C2EFF404BEC0 for ; Fri, 24 Feb 2023 09:36:37 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A3390811E6E for ; Fri, 24 Feb 2023 09:36:37 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-544-k25egn5gOsiBurFHv0-JzA-1; Fri, 24 Feb 2023 04:36:35 -0500 Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PNPpt3fdvznWTv; Fri, 24 Feb 2023 17:33:58 +0800 (CST) Received: from localhost.localdomain (10.175.124.27) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Fri, 24 Feb 2023 17:36:31 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677231423; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=j7tSEFcz6ogiy0xz59wOMZHLPJFIWkt/8R6sY0mEdf0=; b=ink+hddE2C1UvJ7OLFYcfP0F4WDEZ/L0PDqGbw6cSh3MoGnm/vbuB7IcihSXuSwwMWCaq/ ZkEIV2Y0Xouk0zMgrG/v2BuP2+YQ6YOYPMJ1jHsWhXWGMq19AB/Mci9La2DH+arCNekMCq TRMk8Rvz0SYLcuLwCrCTu6RZvgR4eqs= X-MC-Unique: 3_eEB7weMMGFbYJfIIfctg-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: k25egn5gOsiBurFHv0-JzA-1 From: Jiang Jiacheng To: Subject: [PATCH 1/3] Add public API for parallel compression method Date: Fri, 24 Feb 2023 17:27:10 +0800 Message-ID: <20230224092712.3033504-2-jiangjiacheng@huawei.com> In-Reply-To: <20230224092712.3033504-1-jiangjiacheng@huawei.com> References: <20230224092712.3033504-1-jiangjiacheng@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500022.china.huawei.com (7.185.36.66) X-CFilter-Loop: Reflected X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yubihong@huawei.com, linyilu@huawei.com, jiangjiacheng@huawei.com, xiexiangyou@huawei.com, zhengchuan@huawei.com, caozhongwang1@huawei.com, jdenemar@redhat.com, wanghao232@huawei.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677231425233100001 Content-Type: text/plain; charset="utf-8" Add description for VIR_MIGRATE_PARAM_COMPRESSION, it will be reused in choosing compression method during parallel migration. Add public API VIR_MIGRATE_PARAM_COMPRESSION_ZLIB_LEVEL, VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL for migration APIs to support set compress level during parallel migration. Signed-off-by: Jiang Jiacheng Reviewed-by: Jiri Denemark --- include/libvirt/libvirt-domain.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 5152ed4551..40b6b19495 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1269,9 +1269,11 @@ typedef enum { * VIR_MIGRATE_PARAM_COMPRESSION: * * virDomainMigrate* params multiple field: name of the method used to - * compress migration traffic. Supported compression methods: xbzrle, mt. - * The parameter may be specified multiple times if more than one method - * should be used. + * compress migration traffic. Supported compression methods: xbzrle, mt, + * zlib, zstd. The parameter may be specified multiple times if more than + * one method. Not all combinations of compression methods and migration + * options may be allowed. Parallel migration of QEMU domains is only + * compatible with either zlib or zstd method. * * Since: 1.3.4 */ @@ -1318,6 +1320,28 @@ typedef enum { */ # define VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE "compression.xbzrle.ca= che" =20 +/** + * VIR_MIGRATE_PARAM_COMPRESSION_ZLIB_LEVEL: + * + * virDomainMigrate* params field: the level of compression for zlib as + * VIR_TYPED_PARAM_INT. Accepted values are in range 0-9. 0 is no compress= ion, + * 1 is maximum speed and 9 is maximum compression. + * + * Since: 9.1.0 + */ +# define VIR_MIGRATE_PARAM_COMPRESSION_ZLIB_LEVEL "compression.zlib.l= evel" + +/** + * VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL: + * + * virDomainMigrate* params field: the level of compression for zstd as + * VIR_TYPED_PARAM_INT. Accepted values are in range 0-20. 0 is no compres= sion, + * 1 is maximum speed and 20 is maximum compression. + * + * Since: 9.1.0 + */ +# define VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL "compression.zstd.l= evel" + /** * VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL: * --=20 2.33.0 From nobody Fri May 17 03:00:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=huawei.com ARC-Seal: i=1; a=rsa-sha256; t=1677231418; cv=none; d=zohomail.com; s=zohoarc; b=lRWzvPHgFErwNp8zmp16ByCTQwA1p18G+9oIDWpuw0zPZqUvSfiB86UaVIIO3Fc9MAK0DRLQf+cZGTObGrunxvfwzDNVCMG95CuSjwa4Z3WCkmkUyp4c8TlZWBbztO7ukRvtCvoeBo/xE4Qcy0wh/Rtul9CXmIj7j+x8HkWMYz4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677231418; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bDBwo2A1O+86wm7ywrB2O+kgoWfusfMIYaa6iaft/OE=; b=GE2Z0AeZeOqqgyMGOaG5jjlfF5a6Xtx2cJXtz7ZQUQt8PH4E4SFvZetyXIhMFc0gz5iJJogQhRCYdUk44uZ/LvDP5gf/HgUcFlaWwPko0eZKhzso1Pn42xRCiTesO3V//gPsWytfGyz4LRvIQptqV9aCqH18l/38IKowl71dysY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1677231418880638.7174087791775; Fri, 24 Feb 2023 01:36:58 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-115-5Pzaz6o1OVqtlGTjEjFVfQ-1; Fri, 24 Feb 2023 04:36:49 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 82FB5183B3C3; Fri, 24 Feb 2023 09:36:47 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C87040C1423; Fri, 24 Feb 2023 09:36:47 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4F0AC19465B1; Fri, 24 Feb 2023 09:36:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4FC4519465B1 for ; Fri, 24 Feb 2023 09:36:46 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 415FF492B08; Fri, 24 Feb 2023 09:36:46 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38FE6492B07 for ; Fri, 24 Feb 2023 09:36:40 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0DFAA1C068CC for ; Fri, 24 Feb 2023 09:36:40 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-475-eFAVbP7QPEW4S1-DHsklKQ-1; Fri, 24 Feb 2023 04:36:35 -0500 Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PNPsB0xWBzrS6c; Fri, 24 Feb 2023 17:35:58 +0800 (CST) Received: from localhost.localdomain (10.175.124.27) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Fri, 24 Feb 2023 17:36:31 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677231417; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=bDBwo2A1O+86wm7ywrB2O+kgoWfusfMIYaa6iaft/OE=; b=Qoi54N+0VGadVwdTClRt2UiViqOqmOAn/NRXzSprQqadZwG9Jnq3iZgfvsMpFaumBGkhaE iNF69UId0Qe6Zkr3Z8sX7leVCGxzLAEcOVwn4j2MT0MSAtAK7d/nMobNE+0w82VMpdYqGu VaNuW4oAjLzvjUCAftU89G/944hti6Q= X-MC-Unique: 5Pzaz6o1OVqtlGTjEjFVfQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: eFAVbP7QPEW4S1-DHsklKQ-1 From: Jiang Jiacheng To: Subject: [PATCH 2/3] virsh: Add migrate options to set parallel compress level Date: Fri, 24 Feb 2023 17:27:11 +0800 Message-ID: <20230224092712.3033504-3-jiangjiacheng@huawei.com> In-Reply-To: <20230224092712.3033504-1-jiangjiacheng@huawei.com> References: <20230224092712.3033504-1-jiangjiacheng@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500022.china.huawei.com (7.185.36.66) X-CFilter-Loop: Reflected X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yubihong@huawei.com, linyilu@huawei.com, jiangjiacheng@huawei.com, xiexiangyou@huawei.com, zhengchuan@huawei.com, caozhongwang1@huawei.com, jdenemar@redhat.com, wanghao232@huawei.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677231419218100001 Content-Type: text/plain; charset="utf-8" Add migrate options: --compression-zlib-level --compression-zstd-level These options are used to set compress level for "zlib" or "zstd" during parallel migration if the compress method is specified. Signed-off-by: Jiang Jiacheng Reviewed-by: Jiri Denemark --- docs/manpages/virsh.rst | 29 ++++++++++++++++++++--------- tools/virsh-domain.c | 26 ++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index d5b614dc03..ccad02bd94 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -3356,7 +3356,8 @@ migrate [--xml file] [--migrate-disks disk-list] [--disks-port port] [--compressed] [--comp-methods method-list] [--comp-mt-level] [--comp-mt-threads] [--comp-mt-dthreads] - [--comp-xbzrle-cache] [--auto-converge] [auto-converge-initial] + [--comp-xbzrle-cache] [--comp-zlib-level] [--comp-zstd-level] + [--auto-converge] [auto-converge-initial] [auto-converge-increment] [--persistent-xml file] [--tls] [--postcopy-bandwidth bandwidth] [--parallel [--parallel-connections connections]] @@ -3463,14 +3464,24 @@ to post-copy upon timeout; migration has to be star= ted with *--postcopy* option for this to work. =20 *--compressed* activates compression, the compression method is chosen -with *--comp-methods*. Supported methods are "mt" and "xbzrle" and -can be used in any combination. When no methods are specified, a hypervisor -default methods will be used. QEMU defaults to "xbzrle". Compression metho= ds -can be tuned further. *--comp-mt-level* sets compression level. -Values are in range from 0 to 9, where 1 is maximum speed and 9 is maximum -compression. *--comp-mt-threads* and *--comp-mt-dthreads* set the number -of compress threads on source and the number of decompress threads on targ= et -respectively. *--comp-xbzrle-cache* sets size of page cache in bytes. +with *--comp-methods*. Supported methods are "mt", "xbzrle", "zlib", +and "zstd". The supported set of methods and their combinations depend +on a hypervisor and migration options. QEMU only supports "zlib" and +"zstd" methods when *--parallel* is used and they cannot be used at +once. When no methods are specified, a hypervisor default methods will +be used. QEMU defaults to no compression for *--parallel* migration and +"xbzrle" otherwise. Compression methods can be tuned further. +*--comp-mt-level* sets compression level for "mt" method. Values are in +range from 0 to 9, where 1 is maximum speed and 9 is maximum compression. +*--comp-mt-threads* and *--comp-mt-dthreads* set the number of compress +threads on source and the number of decompress threads on target respectiv= ely. +*--comp-xbzrle-cache* sets size of page cache in bytes. +*--comp-zlib-level* sets the compression level when using "zlib" method. +Values are in range from 0 to 9 and defaults to 1, where 0 is no compressi= on, +1 is maximum speed and 9 is maximum compression. +*--comp-zstd-level* sets the compression level when using "zstd" method. +Values are in range from 0 to 20 and defaults to 1, where 0 is no compress= ion, +1 is maximum speed and 20 is maximum compression. =20 Providing *--tls* causes the migration to use the host configured TLS setup (see migrate_tls_x509_cert_dir in /etc/libvirt/qemu.conf) in order to perf= orm diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index a4abcb1b03..357f53c8e7 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -11097,6 +11097,14 @@ static const vshCmdOptDef opts_migrate[] =3D { .completer =3D virshCompleteEmpty, .help =3D N_("override the destination host name used for TLS verific= ation") }, + {.name =3D "comp-zlib-level", + .type =3D VSH_OT_INT, + .help =3D N_("compress level for zlib compression") + }, + {.name =3D "comp-zstd-level", + .type =3D VSH_OT_INT, + .help =3D N_("compress level for zstd compression") + }, {.name =3D NULL} }; =20 @@ -11309,6 +11317,24 @@ doMigrate(void *opaque) goto save_error; } =20 + if ((rv =3D vshCommandOptInt(ctl, cmd, "comp-zlib-level", &intOpt)) < = 0) { + goto out; + } else if (rv > 0) { + if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, + VIR_MIGRATE_PARAM_COMPRESSION_ZLIB_LEVEL, + intOpt) < 0) + goto save_error; + } + + if ((rv =3D vshCommandOptInt(ctl, cmd, "comp-zstd-level", &intOpt)) < = 0) { + goto out; + } else if (rv > 0) { + if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, + VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL, + intOpt) < 0) + goto save_error; + } + if ((rv =3D vshCommandOptULongLong(ctl, cmd, "bandwidth", &ullOpt)) < = 0) { goto out; } else if (rv > 0) { --=20 2.33.0 From nobody Fri May 17 03:00:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=huawei.com ARC-Seal: i=1; a=rsa-sha256; t=1677231408; cv=none; d=zohomail.com; s=zohoarc; b=JWAm35uh+0g+HSexLtDphnYlWLONB4TglR04livI3CWItcj1qf74XLZI7NzuyzKm/tZWJK9HHYzVCKE7Z6h4e1+PAxH//3NA+D1LS2YT8pRQ+JYC6KPFh5QvpiJOeR+np4ZXzH1GeCRFpALdS+aDJnnsI5V+udZEoJFH0tk55Gs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677231408; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mdmt48hUPFcKHARH4HsARKz9JC6Gyh8dlazwW7ndOxo=; b=NMhCMx5cgWg0AHkChItxUPhZs1G/02v1lppLlAzeLczDzUJzOIstIOtUY85dgEcnZNKXh+fxWs43SsOItbUlR3G6KsfSc07LjwbeL5qxyTgjsxfEwOOc/deW9NxhNIRYohdEwYOiMusiTfJuzuKi3SEt3cb3xbuJllEdVTSZlHM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1677231408655441.343535018692; Fri, 24 Feb 2023 01:36:48 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-149-2E0e0RNrPxa-ljc4clfmBw-1; Fri, 24 Feb 2023 04:36:44 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A73E0183B3CD; Fri, 24 Feb 2023 09:36:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79B20404BEC4; Fri, 24 Feb 2023 09:36:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AFA3119465B2; Fri, 24 Feb 2023 09:36:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B40B719465A0 for ; Fri, 24 Feb 2023 09:36:38 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9B0D140C1106; Fri, 24 Feb 2023 09:36:38 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast07.extmail.prod.ext.rdu2.redhat.com [10.11.55.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9311C40C10FA for ; Fri, 24 Feb 2023 09:36:38 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 771C83C0F66A for ; Fri, 24 Feb 2023 09:36:38 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-562-1Bx81tOHPMGw5gDqfPNXzA-1; Fri, 24 Feb 2023 04:36:35 -0500 Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PNPsB4XG6zrS7Y; Fri, 24 Feb 2023 17:35:58 +0800 (CST) Received: from localhost.localdomain (10.175.124.27) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Fri, 24 Feb 2023 17:36:32 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677231407; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=mdmt48hUPFcKHARH4HsARKz9JC6Gyh8dlazwW7ndOxo=; b=jMV4gjdlJNrB92l9VhDhu9PuyQMX/60cxcBTZka07uJRmGxhxHhnzPJfhj8EBRhM6Zuajm rPUinvcMH/EVM1m7JeaqN0V0rXOk0WdiUtKvYi7hKx7pXE0xDjPCjrO2ZMjof/VSewmw4/ X/BQfj7hQF3kCXAfoZaDcLaJh4B10Os= X-MC-Unique: 2E0e0RNrPxa-ljc4clfmBw-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: 1Bx81tOHPMGw5gDqfPNXzA-1 From: Jiang Jiacheng To: Subject: [PATCH 3/3] qemu: support set parallel migration compression method Date: Fri, 24 Feb 2023 17:27:12 +0800 Message-ID: <20230224092712.3033504-4-jiangjiacheng@huawei.com> In-Reply-To: <20230224092712.3033504-1-jiangjiacheng@huawei.com> References: <20230224092712.3033504-1-jiangjiacheng@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500022.china.huawei.com (7.185.36.66) X-CFilter-Loop: Reflected X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yubihong@huawei.com, linyilu@huawei.com, jiangjiacheng@huawei.com, xiexiangyou@huawei.com, zhengchuan@huawei.com, caozhongwang1@huawei.com, jdenemar@redhat.com, wanghao232@huawei.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677231409279100002 Content-Type: text/plain; charset="utf-8" Add new compress methods zlib and zstd for parallel migration, these method should be used with migration option --comp-methods and will be processed in 'qemuMigrationParamsSetCompression'. Note that only one compress method could be chosen for parallel=20 migration and they cann't be used in compress migration. Signed-off-by: Jiang Jiacheng Reviewed-by: Jiri Denemark --- src/qemu/qemu_migration.h | 2 + src/qemu/qemu_migration_params.c | 80 +++++++++++++++++++++++++++++++- src/qemu/qemu_migration_params.h | 3 ++ 3 files changed, 83 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h index d21b6f67e8..ed62fd4a91 100644 --- a/src/qemu/qemu_migration.h +++ b/src/qemu/qemu_migration.h @@ -86,6 +86,8 @@ VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT, VIR_TYPED_PARAM_INT, \ VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY, VIR_TYPED_PARAM_ULLONG, \ VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS, VIR_TYPED_PARAM_INT, \ + VIR_MIGRATE_PARAM_COMPRESSION_ZLIB_LEVEL, VIR_TYPED_PARAM_INT, \ + VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL, VIR_TYPED_PARAM_INT, \ VIR_MIGRATE_PARAM_TLS_DESTINATION, VIR_TYPED_PARAM_STRING, \ VIR_MIGRATE_PARAM_DISKS_URI, VIR_TYPED_PARAM_STRING, \ NULL diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index bd09dcfb23..3c224131c5 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -71,6 +71,8 @@ struct _qemuMigrationParams { typedef enum { QEMU_MIGRATION_COMPRESS_XBZRLE =3D 0, QEMU_MIGRATION_COMPRESS_MT, + QEMU_MIGRATION_COMPRESS_ZLIB, + QEMU_MIGRATION_COMPRESS_ZSTD, =20 QEMU_MIGRATION_COMPRESS_LAST } qemuMigrationCompressMethod; @@ -79,6 +81,8 @@ VIR_ENUM_IMPL(qemuMigrationCompressMethod, QEMU_MIGRATION_COMPRESS_LAST, "xbzrle", "mt", + "zlib", + "zstd", ); =20 VIR_ENUM_IMPL(qemuMigrationCapability, @@ -114,6 +118,9 @@ VIR_ENUM_IMPL(qemuMigrationParam, "xbzrle-cache-size", "max-postcopy-bandwidth", "multifd-channels", + "multifd-compression", + "multifd-zlib-level", + "multifd-zstd-level", ); =20 typedef struct _qemuMigrationParamsAlwaysOnItem qemuMigrationParamsAlwaysO= nItem; @@ -225,6 +232,14 @@ static const qemuMigrationParamsTPMapItem qemuMigratio= nParamsTPMap[] =3D { .param =3D QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS, .party =3D QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION}, =20 + {.typedParam =3D VIR_MIGRATE_PARAM_COMPRESSION_ZLIB_LEVEL, + .param =3D QEMU_MIGRATION_PARAM_MULTIFD_ZLIB_LEVEL, + .party =3D QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION}, + + {.typedParam =3D VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL, + .param =3D QEMU_MIGRATION_PARAM_MULTIFD_ZSTD_LEVEL, + .party =3D QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION}, + {.typedParam =3D VIR_MIGRATE_PARAM_TLS_DESTINATION, .param =3D QEMU_MIGRATION_PARAM_TLS_HOSTNAME, .party =3D QEMU_MIGRATION_SOURCE}, @@ -271,6 +286,15 @@ static const qemuMigrationParamInfoItem qemuMigrationP= aramInfo[] =3D { [QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS] =3D { .type =3D QEMU_MIGRATION_PARAM_TYPE_INT, }, + [QEMU_MIGRATION_PARAM_MULTIFD_COMPRESSION] =3D { + .type =3D QEMU_MIGRATION_PARAM_TYPE_STRING, + }, + [QEMU_MIGRATION_PARAM_MULTIFD_ZLIB_LEVEL] =3D { + .type =3D QEMU_MIGRATION_PARAM_TYPE_INT, + }, + [QEMU_MIGRATION_PARAM_MULTIFD_ZSTD_LEVEL] =3D { + .type =3D QEMU_MIGRATION_PARAM_TYPE_INT, + }, }; G_STATIC_ASSERT(G_N_ELEMENTS(qemuMigrationParamInfo) =3D=3D QEMU_MIGRATION= _PARAM_LAST); =20 @@ -504,8 +528,6 @@ qemuMigrationParamsSetTPString(qemuMigrationParams *mig= Params, migParams->params[param].value.s); } =20 - - static int qemuMigrationParamsSetCompression(virTypedParameterPtr params, int nparams, @@ -520,6 +542,13 @@ qemuMigrationParamsSetCompression(virTypedParameterPtr= params, if (STRNEQ(params[i].field, VIR_MIGRATE_PARAM_COMPRESSION)) continue; =20 + if (migParams->params[QEMU_MIGRATION_PARAM_MULTIFD_COMPRESSION].se= t) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Only one compression method could be specifi= ed with " + "parallel compression")); + return -1; + } + method =3D qemuMigrationCompressMethodTypeFromString(params[i].val= ue.s); if (method < 0) { virReportError(VIR_ERR_INVALID_ARG, @@ -535,15 +564,43 @@ qemuMigrationParamsSetCompression(virTypedParameterPt= r params, return -1; } =20 + if ((method =3D=3D QEMU_MIGRATION_COMPRESS_MT || + method =3D=3D QEMU_MIGRATION_COMPRESS_XBZRLE) && + flags & VIR_MIGRATE_PARALLEL) { + virReportError(VIR_ERR_INVALID_ARG, + _("Compression method '%s' isn't supported with= parallel migration"), + params[i].value.s); + return -1; + } + + if ((method =3D=3D QEMU_MIGRATION_COMPRESS_ZLIB || + method =3D=3D QEMU_MIGRATION_COMPRESS_ZSTD) && + flags & VIR_MIGRATE_COMPRESSED) { + virReportError(VIR_ERR_INVALID_ARG, + _("Compression method '%s' isn't supported with= compress migration"), + params[i].value.s); + return -1; + } + migParams->compMethods |=3D 1ULL << method; =20 switch ((qemuMigrationCompressMethod) method) { case QEMU_MIGRATION_COMPRESS_XBZRLE: cap =3D QEMU_MIGRATION_CAP_XBZRLE; + flags |=3D VIR_MIGRATE_COMPRESSED; break; =20 case QEMU_MIGRATION_COMPRESS_MT: cap =3D QEMU_MIGRATION_CAP_COMPRESS; + flags |=3D VIR_MIGRATE_COMPRESSED; + break; + + case QEMU_MIGRATION_COMPRESS_ZLIB: + case QEMU_MIGRATION_COMPRESS_ZSTD: + flags |=3D VIR_MIGRATE_PARALLEL; + cap =3D QEMU_MIGRATION_CAP_MULTIFD; + migParams->params[QEMU_MIGRATION_PARAM_MULTIFD_COMPRESSION].va= lue.s =3D g_strdup(params[i].value.s); + migParams->params[QEMU_MIGRATION_PARAM_MULTIFD_COMPRESSION].se= t =3D true; break; =20 case QEMU_MIGRATION_COMPRESS_LAST: @@ -569,6 +626,20 @@ qemuMigrationParamsSetCompression(virTypedParameterPtr= params, return -1; } =20 + if (migParams->params[QEMU_MIGRATION_PARAM_MULTIFD_ZLIB_LEVEL].set && + !(migParams->compMethods & (1ULL << QEMU_MIGRATION_COMPRESS_ZLIB))= ) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Turn zlib compression on to tune it")); + return -1; + } + + if (migParams->params[QEMU_MIGRATION_PARAM_MULTIFD_ZSTD_LEVEL].set && + !(migParams->compMethods & (1ULL << QEMU_MIGRATION_COMPRESS_ZSTD))= ) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Turn zstd compression on to tune it")); + return -1; + } + if (!migParams->compMethods && (flags & VIR_MIGRATE_COMPRESSED)) { migParams->compMethods =3D 1ULL << QEMU_MIGRATION_COMPRESS_XBZRLE; ignore_value(virBitmapSetBit(migParams->caps, @@ -690,6 +761,11 @@ qemuMigrationParamsDump(qemuMigrationParams *migParams, *flags |=3D VIR_MIGRATE_COMPRESSED; } =20 + if (migParams->compMethods =3D=3D 1ULL << QEMU_MIGRATION_COMPRESS_ZLIB= || + migParams->compMethods =3D=3D 1ULL << QEMU_MIGRATION_COMPRESS_ZSTD= ) { + *flags |=3D VIR_MIGRATE_PARALLEL; + } + for (i =3D 0; i < QEMU_MIGRATION_COMPRESS_LAST; ++i) { if ((migParams->compMethods & (1ULL << i)) && virTypedParamsAddString(params, nparams, maxparams, diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_par= ams.h index e7c65f6a21..5857673227 100644 --- a/src/qemu/qemu_migration_params.h +++ b/src/qemu/qemu_migration_params.h @@ -59,6 +59,9 @@ typedef enum { QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE, QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH, QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS, + QEMU_MIGRATION_PARAM_MULTIFD_COMPRESSION, + QEMU_MIGRATION_PARAM_MULTIFD_ZLIB_LEVEL, + QEMU_MIGRATION_PARAM_MULTIFD_ZSTD_LEVEL, =20 QEMU_MIGRATION_PARAM_LAST } qemuMigrationParam; --=20 2.33.0