From nobody Tue Feb 10 01:18:01 2026 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1681808478; cv=none; d=zohomail.com; s=zohoarc; b=JFGYG18Tds8r112kkHPy8ICn5+0U0syiyHNo8yJvDtqMeTajNYwPXVa0+geA4bIPYXJvrlIBqSfKSIPUcZuLoIgEKJjyerJGPiDUeYq2IP3AAKBKWAmV+u88lbTOCuo2QV1b6q8aAo4P0HzTq/oRo2+bPeK7jd4qg6cQBYa9rVg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681808478; 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=FEYvK09AI83oBNzQLOYG4uBOFRhq9qOB3YbdCAd7zIY=; b=LMoIp9IObqntRquEzZsQP/kka43gP8mX/4vv3losWIaRj6qqcBK7jqnyKi1w9w2AbCz8YoXHsRdw3HU0pdvXnOQ1rjC9nNU6GOiDjL2IGYK0ZlAGQF+NBTb7EN+uur5f76jkHg3inUvYxGmVwdFnoHMUD7leksPHiQSCW+l/k28= 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 16818084787141011.3053339583386; Tue, 18 Apr 2023 02:01:18 -0700 (PDT) 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-443-00VimZNrOwK-oM50M9Rvjg-1; Tue, 18 Apr 2023 05:01:11 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B156F8996E1; Tue, 18 Apr 2023 09:01:08 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E32E2166B26; Tue, 18 Apr 2023 09:01:08 +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 4BEDC1946594; Tue, 18 Apr 2023 09:01:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 37A2F19465B5 for ; Tue, 18 Apr 2023 09:01:07 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 29F0A14171BA; Tue, 18 Apr 2023 09:01:07 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 21DDD14171B8 for ; Tue, 18 Apr 2023 09:01:07 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.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 022C8858F0E for ; Tue, 18 Apr 2023 09:01:07 +0000 (UTC) Received: from relay.virtuozzo.com (relay.virtuozzo.com [130.117.225.111]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-558-3RHmXiThPh61M7jST77GIg-1; Tue, 18 Apr 2023 05:01:05 -0400 Received: from [192.168.16.124] (helo=dv.vzint.dev) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1pogx3-005ltk-2w; Tue, 18 Apr 2023 10:44:50 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681808477; 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=FEYvK09AI83oBNzQLOYG4uBOFRhq9qOB3YbdCAd7zIY=; b=akDe8VdFN964b3vciodNO1gy4JjR7kpjwOz82yZIgh57BkWck+0uLlY/XVjip2vBQnIKyc QOoJvmtK6DSHwcm6svuuuZja9Kq/bXmld0AyOdRfBcd+BkGSYye4zRz+rAcXjNTkxXXR7p B97d3HkokjPmGrHM/nsZQaCPuMKUw2Q= X-MC-Unique: 00VimZNrOwK-oM50M9Rvjg-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: 3RHmXiThPh61M7jST77GIg-1 From: Oleg Vasilev To: libvir-list@redhat.com Subject: [PATCH 1/3] qemu: migration: expose qemuMigrationParamsSetString Date: Tue, 18 Apr 2023 14:44:48 +0600 Message-Id: <20230418084450.486595-2-oleg.vasilev@virtuozzo.com> In-Reply-To: <20230418084450.486595-1-oleg.vasilev@virtuozzo.com> References: <20230418084450.486595-1-oleg.vasilev@virtuozzo.com> MIME-Version: 1.0 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.7 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: Oleg Vasilev , Den Lunev , Claudio Fontana Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: virtuozzo.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681808479535100001 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Claudio Fontana change from static to external linkage, and move the function close to the other similar ones, near qemuMigrationParamsSetULL. Signed-off-by: Claudio Fontana Signed-off-by: Oleg Vasilev --- src/qemu/qemu_migration_params.c | 47 +++++++++++++++----------------- src/qemu/qemu_migration_params.h | 5 ++++ 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index 21997d4156..a40f791be6 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -955,31 +955,6 @@ qemuMigrationParamsApply(virDomainObj *vm, } =20 =20 -/** - * qemuMigrationParamsSetString: - * @migrParams: migration parameter object - * @param: parameter to set - * @value: new value - * - * Enables and sets the migration parameter @param in @migrParams. Returns= 0 on - * success and -1 on error. Libvirt error is reported. - */ -static int -qemuMigrationParamsSetString(qemuMigrationParams *migParams, - qemuMigrationParam param, - const char *value) -{ - if (qemuMigrationParamsCheckType(param, QEMU_MIGRATION_PARAM_TYPE_STRI= NG) < 0) - return -1; - - migParams->params[param].value.s =3D g_strdup(value); - - migParams->params[param].set =3D true; - - return 0; -} - - /* qemuMigrationParamsEnableTLS * @driver: pointer to qemu driver * @vm: domain object @@ -1176,6 +1151,28 @@ qemuMigrationParamsSetULL(qemuMigrationParams *migPa= rams, return 0; } =20 +/** + * qemuMigrationParamsSetString: + * @migrParams: migration parameter object + * @param: parameter to set + * @value: new value + * + * Enables and sets the migration parameter @param in @migrParams. Returns= 0 on + * success and -1 on error. Libvirt error is reported. + */ +int +qemuMigrationParamsSetString(qemuMigrationParams *migParams, + qemuMigrationParam param, + const char *value) +{ + if (qemuMigrationParamsCheckType(param, QEMU_MIGRATION_PARAM_TYPE_STRI= NG) < 0) + return -1; + + migParams->params[param].value.s =3D g_strdup(value); + migParams->params[param].set =3D true; + return 0; +} + =20 /** * Returns -1 on error, diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_par= ams.h index e7c65f6a21..458a7a4dfa 100644 --- a/src/qemu/qemu_migration_params.h +++ b/src/qemu/qemu_migration_params.h @@ -126,6 +126,11 @@ qemuMigrationParamsSetULL(qemuMigrationParams *migPara= ms, qemuMigrationParam param, unsigned long long value); =20 +int +qemuMigrationParamsSetString(qemuMigrationParams *migParams, + qemuMigrationParam param, + const char *value); + int qemuMigrationParamsGetULL(qemuMigrationParams *migParams, qemuMigrationParam param, --=20 2.40.0 From nobody Tue Feb 10 01:18:01 2026 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1681808485; cv=none; d=zohomail.com; s=zohoarc; b=IAxCEP44C6ASZMq63OqBd7Uh3yHNUXI7MxVcLUa2wqrGUluaYvmucBmmZwaZQZUCFOZ9QUYFHOEcjrF/n55IP+u2JqeRqVZYVvSXJTkFjsXxHg6Lm4teKhyw65AaddiS4V/3TFfjmm71xKbj6i4+EZUm2O0dHXLSoKswIARpsD0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681808485; 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=hMj+Sy4xziF9vJS1FZI88JzG8rTs8fKFT3il5siF2WE=; b=FStuDzoYjgyj+8HJP1FwedEYg8nT6DUNw0BLaxZWaqp2uRC1/uo6YJhskk1geZQP0w+tIto7XXqcZtKfYI0XIEKQcM7vKpmOG33U/8SefYpWJ+jcLlI7dSd1f/JX46e3iL4vuB6zOMqbXsW3Esv1o78qs8Nn16WPN7lEiHf3s1M= 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 1681808485491916.7354839955009; Tue, 18 Apr 2023 02:01:25 -0700 (PDT) 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-81-u80rVNtIMM65hjk7xIAJEA-1; Tue, 18 Apr 2023 05:01:21 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0BE4F886068; Tue, 18 Apr 2023 09:01:19 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B60C72166B29; Tue, 18 Apr 2023 09:01:18 +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 8A12F1946594; Tue, 18 Apr 2023 09:01:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2F271194658F for ; Tue, 18 Apr 2023 09:01:17 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1196CC15BA0; Tue, 18 Apr 2023 09:01:17 +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 09C2BC15BB8 for ; Tue, 18 Apr 2023 09:01:10 +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 CCDFB3C10686 for ; Tue, 18 Apr 2023 09:01:10 +0000 (UTC) Received: from relay.virtuozzo.com (relay.virtuozzo.com [130.117.225.111]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-582-EGaTwJFkOjaD-7l3qECF0w-1; Tue, 18 Apr 2023 05:01:07 -0400 Received: from [192.168.16.124] (helo=dv.vzint.dev) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1pogx4-005ltk-2B; Tue, 18 Apr 2023 10:44:51 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681808484; 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=hMj+Sy4xziF9vJS1FZI88JzG8rTs8fKFT3il5siF2WE=; b=hHqyYY9Fl5cTIYO3XTBwoSMZr6W94q1XsfgSfqLY/pHpPndFZCPFJUVpz+ce3yvwHxF+Kp gXVSbmy7My+wms0gqu2iU70eCYRgNZJDzdIU9+yAiY3iCfJdMpUEwyc7rZqmMwgfEt67dW KnAFmQ4M/EgKiyTD7uJImSD8DwvYtho= X-MC-Unique: u80rVNtIMM65hjk7xIAJEA-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: EGaTwJFkOjaD-7l3qECF0w-1 From: Oleg Vasilev To: libvir-list@redhat.com Subject: [PATCH 2/3] qemu: migration: implement zstd compression Date: Tue, 18 Apr 2023 14:44:49 +0600 Message-Id: <20230418084450.486595-3-oleg.vasilev@virtuozzo.com> In-Reply-To: <20230418084450.486595-1-oleg.vasilev@virtuozzo.com> References: <20230418084450.486595-1-oleg.vasilev@virtuozzo.com> MIME-Version: 1.0 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.8 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: Oleg Vasilev , Den Lunev Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: virtuozzo.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681808487406100001 Content-Type: text/plain; charset="utf-8"; x-default="true" QEMU now supports multifd-compression=3Dzstd for migration with enabled mul= tifd. Bring the support to libvirt as well. Signed-off-by: Oleg Vasilev --- include/libvirt/libvirt-domain.h | 10 ++++++++++ src/qemu/qemu_migration.h | 1 + src/qemu/qemu_migration_params.c | 32 ++++++++++++++++++++++++++++++++ src/qemu/qemu_migration_params.h | 2 ++ tools/virsh-completer-domain.c | 2 +- tools/virsh-domain.c | 14 ++++++++++++++ 6 files changed, 60 insertions(+), 1 deletion(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 3ebb2c6642..f267ca357b 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1319,6 +1319,16 @@ typedef enum { */ # define VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE "compression.xbzrle.ca= che" =20 +/** + * VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL: + * + * virDomainMigrate* params field: the level of compression for zstd + * compression as VIR_TYPED_PARAM_INT. Accepted values are in range 1-22. + * + * Since: 9.0.0 + */ +# define VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL "compression.zstd.level" + /** * VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL: * diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h index d21b6f67e8..09d21fd878 100644 --- a/src/qemu/qemu_migration.h +++ b/src/qemu/qemu_migration.h @@ -88,6 +88,7 @@ VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS, VIR_TYPED_PARAM_INT, \ VIR_MIGRATE_PARAM_TLS_DESTINATION, VIR_TYPED_PARAM_STRING, \ VIR_MIGRATE_PARAM_DISKS_URI, VIR_TYPED_PARAM_STRING, \ + VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL, VIR_TYPED_PARAM_INT, \ NULL =20 =20 diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index a40f791be6..2533353ccf 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -71,6 +71,7 @@ struct _qemuMigrationParams { typedef enum { QEMU_MIGRATION_COMPRESS_XBZRLE =3D 0, QEMU_MIGRATION_COMPRESS_MT, + QEMU_MIGRATION_COMPRESS_ZSTD, =20 QEMU_MIGRATION_COMPRESS_LAST } qemuMigrationCompressMethod; @@ -79,6 +80,7 @@ VIR_ENUM_IMPL(qemuMigrationCompressMethod, QEMU_MIGRATION_COMPRESS_LAST, "xbzrle", "mt", + "zstd", ); =20 VIR_ENUM_IMPL(qemuMigrationCapability, @@ -114,6 +116,8 @@ VIR_ENUM_IMPL(qemuMigrationParam, "xbzrle-cache-size", "max-postcopy-bandwidth", "multifd-channels", + "multifd-compression", + "multifd-zstd-level", ); =20 typedef struct _qemuMigrationParamsAlwaysOnItem qemuMigrationParamsAlwaysO= nItem; @@ -216,6 +220,10 @@ static const qemuMigrationParamsTPMapItem qemuMigratio= nParamsTPMap[] =3D { .param =3D QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE, .party =3D QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION}, =20 + {.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_BANDWIDTH_POSTCOPY, .unit =3D 1024 * 1024, /* MiB/s */ .param =3D QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH, @@ -271,6 +279,12 @@ 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_ZSTD_LEVEL] =3D { + .type =3D QEMU_MIGRATION_PARAM_TYPE_INT, + }, }; G_STATIC_ASSERT(G_N_ELEMENTS(qemuMigrationParamInfo) =3D=3D QEMU_MIGRATION= _PARAM_LAST); =20 @@ -546,6 +560,10 @@ qemuMigrationParamsSetCompression(virTypedParameterPtr= params, cap =3D QEMU_MIGRATION_CAP_COMPRESS; break; =20 + case QEMU_MIGRATION_COMPRESS_ZSTD: + qemuMigrationParamsSetString(migParams, + QEMU_MIGRATION_PARAM_MULTIFD_COMP= RESSION, + "zstd"); case QEMU_MIGRATION_COMPRESS_LAST: default: continue; @@ -569,6 +587,13 @@ qemuMigrationParamsSetCompression(virTypedParameterPtr= params, return -1; } =20 + 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, @@ -669,6 +694,13 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr para= ms, return NULL; } =20 + if (migParams->params[QEMU_MIGRATION_PARAM_MULTIFD_ZSTD_LEVEL].set && + !(flags & VIR_MIGRATE_PARALLEL)) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Turn parallel migration on to tune zstd level")= ); + return NULL; + } + if (qemuMigrationParamsSetCompression(params, nparams, flags, migParam= s) < 0) return NULL; =20 diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_par= ams.h index 458a7a4dfa..383b25ce63 100644 --- a/src/qemu/qemu_migration_params.h +++ b/src/qemu/qemu_migration_params.h @@ -59,6 +59,8 @@ 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_ZSTD_LEVEL, =20 QEMU_MIGRATION_PARAM_LAST } qemuMigrationParam; diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c index b54baf3577..66748b7b65 100644 --- a/tools/virsh-completer-domain.c +++ b/tools/virsh-completer-domain.c @@ -1012,7 +1012,7 @@ virshDomainMigrateCompMethodsCompleter(vshControl *ct= l, const vshCmd *cmd, unsigned int flags) { - const char *methods[] =3D {"xbzrle", "mt", NULL}; + const char *methods[] =3D {"xbzrle", "mt", "zstd", NULL}; const char *method =3D NULL; =20 virCheckFlags(0, NULL); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 6850843a25..0813bd5de0 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -11056,6 +11056,10 @@ static const vshCmdOptDef opts_migrate[] =3D { .type =3D VSH_OT_INT, .help =3D N_("page cache size for xbzrle compression") }, + {.name =3D "comp-zstd-level", + .type =3D VSH_OT_INT, + .help =3D N_("zstd level for zstd compression") + }, {.name =3D "auto-converge-initial", .type =3D VSH_OT_INT, .help =3D N_("initial CPU throttling rate for auto-convergence") @@ -11238,6 +11242,16 @@ doMigrate(void *opaque) goto save_error; } =20 + 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 (vshCommandOptStringReq(ctl, cmd, "xml", &opt) < 0) goto out; if (opt) { --=20 2.40.0 From nobody Tue Feb 10 01:18:01 2026 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1681808524; cv=none; d=zohomail.com; s=zohoarc; b=J7m/eB6stKvThgcCeCiaKbWUlNX+Jhau/V2zz6FkxbXhj8mQAqYxkZWqjMfMZXbliwExfDSafhbXRTjc1M+z+htOMo/CF7BtjvQ/gQyY4481hRAEbEvfDZlBKsNVYj3Y8mMitGTM99zq2+SoGmvop6f0tHyvKq5dw6E1385tUy8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681808524; 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=PQJxnOjaoJNE3tXzlfzVwXEArwasv1hoDJquIvEmZf0=; b=iE3W1qLHz1gqxYpRobas4SUJw3wVINxmzHmWOe2gt+j6R5rsBjgVznm2aikzJauI6Vryq9fLnXHokQ1hTAFQugcMxi/sI868y0nGU6Q2tYKgwK5AMWvtViPFBF5/mS+q93EDF8n6c0ewxl0PkBdNbTi1HbR6UfRHy3j9TrusrRo= 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 1681808524021567.4390982692482; Tue, 18 Apr 2023 02:02:04 -0700 (PDT) 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-215-mqQC-cVLNe2rH2Ip3PeUqQ-1; Tue, 18 Apr 2023 05:01:10 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3C1F2185A7AC; Tue, 18 Apr 2023 09:01:08 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 80044492B0D; Tue, 18 Apr 2023 09:01:07 +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 12C911946594; Tue, 18 Apr 2023 09:01:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 58756194658F for ; Tue, 18 Apr 2023 09:01:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2FCA92A68; Tue, 18 Apr 2023 09:01:05 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 27F6147CE1 for ; Tue, 18 Apr 2023 09:01:05 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 091A2101A552 for ; Tue, 18 Apr 2023 09:01:05 +0000 (UTC) Received: from relay.virtuozzo.com (relay.virtuozzo.com [130.117.225.111]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-151-z6lg1O1jNySMdDw7ji3CbA-1; Tue, 18 Apr 2023 05:01:02 -0400 Received: from [192.168.16.124] (helo=dv.vzint.dev) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1pogx5-005ltk-1Q; Tue, 18 Apr 2023 10:44:52 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681808523; 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=PQJxnOjaoJNE3tXzlfzVwXEArwasv1hoDJquIvEmZf0=; b=U+WffDRdRH8Rals5cpqQdN+S4E8xw3L/41pCCb3mX6A2Y15Qqy7sKCctvbPeZHOzakizRv EqjynIBXsNUJVBeJvHx55c6Z0ndG8A5QwraGBQsKj7iwIR4Ub0XfRAyEsGEUUm7ZFIXWyJ 9ktjA5d3xFxdI+FurdpLk9LFFCCIqWc= X-MC-Unique: mqQC-cVLNe2rH2Ip3PeUqQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: z6lg1O1jNySMdDw7ji3CbA-1 From: Oleg Vasilev To: libvir-list@redhat.com Subject: [PATCH 3/3] tests: qemumigparams: test for zstd compression Date: Tue, 18 Apr 2023 14:44:50 +0600 Message-Id: <20230418084450.486595-4-oleg.vasilev@virtuozzo.com> In-Reply-To: <20230418084450.486595-1-oleg.vasilev@virtuozzo.com> References: <20230418084450.486595-1-oleg.vasilev@virtuozzo.com> MIME-Version: 1.0 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.5 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: Oleg Vasilev , Den Lunev Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: virtuozzo.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681808526084100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Here we add one more way to test migration parameters, namely: from vir par= ams. This allows to test the logic of (libvirt) compression->(qemu) multifd-comp= ression Signed-off-by: Oleg Vasilev --- tests/qemumigparamsdata/zstd.json | 4 ++ tests/qemumigparamsdata/zstd.reply | 7 +++ tests/qemumigparamsdata/zstd.xml | 6 ++ tests/qemumigparamstest.c | 90 +++++++++++++++++++++++++++--- 4 files changed, 100 insertions(+), 7 deletions(-) create mode 100644 tests/qemumigparamsdata/zstd.json create mode 100644 tests/qemumigparamsdata/zstd.reply create mode 100644 tests/qemumigparamsdata/zstd.xml diff --git a/tests/qemumigparamsdata/zstd.json b/tests/qemumigparamsdata/zs= td.json new file mode 100644 index 0000000000..61e8b7c2f1 --- /dev/null +++ b/tests/qemumigparamsdata/zstd.json @@ -0,0 +1,4 @@ +{ + "multifd-compression": "zstd", + "multifd-zstd-level": 3 +} diff --git a/tests/qemumigparamsdata/zstd.reply b/tests/qemumigparamsdata/z= std.reply new file mode 100644 index 0000000000..8818bc0b3e --- /dev/null +++ b/tests/qemumigparamsdata/zstd.reply @@ -0,0 +1,7 @@ +{ + "id": "libvirt-1", + "return": { + "multifd-compression": "zstd", + "multifd-zstd-level": 3 + } +} diff --git a/tests/qemumigparamsdata/zstd.xml b/tests/qemumigparamsdata/zst= d.xml new file mode 100644 index 0000000000..38f11bda90 --- /dev/null +++ b/tests/qemumigparamsdata/zstd.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/qemumigparamstest.c b/tests/qemumigparamstest.c index 5d45a9dd58..b0e1ad89a0 100644 --- a/tests/qemumigparamstest.c +++ b/tests/qemumigparamstest.c @@ -33,11 +33,20 @@ =20 #define VIR_FROM_THIS VIR_FROM_NONE =20 +typedef struct _qemuMigParamsSourceData qemuMigParamsSourceData; +struct _qemuMigParamsSourceData { + virTypedParameterPtr params; + int nparams; + unsigned long flags; + qemuMigrationParty party; +}; + typedef struct _qemuMigParamsData qemuMigParamsData; struct _qemuMigParamsData { virDomainXMLOption *xmlopt; const char *name; GHashTable *qmpschema; + qemuMigParamsSourceData *src; }; =20 =20 @@ -177,6 +186,50 @@ qemuMigParamsTestJSON(const void *opaque) return 0; } =20 +static int +qemuMigParamsTestParams(const void *opaque) +{ + const qemuMigParamsData *data =3D opaque; + g_autofree char *jsonFile =3D NULL; + g_autoptr(virJSONValue) paramsOut =3D NULL; + g_autoptr(qemuMigrationParams) migParams =3D NULL; + g_autofree char *actualJSON =3D NULL; + g_auto(virBuffer) debug =3D VIR_BUFFER_INITIALIZER; + + jsonFile =3D g_strdup_printf("%s/qemumigparamsdata/%s.json", + abs_srcdir, data->name); + + migParams =3D qemuMigrationParamsFromFlags(data->src->params, + data->src->nparams, + data->src->flags, + data->src->party); + if (!migParams) { + VIR_TEST_VERBOSE("can't construct params"); + return -1; + } + + if (!(paramsOut =3D qemuMigrationParamsToJSON(migParams, false)) || + !(actualJSON =3D virJSONValueToString(paramsOut, true))) + return -1; + + if (testQEMUSchemaValidateCommand("migrate-set-parameters", + paramsOut, + data->qmpschema, + false, + false, + false, + &debug) < 0) { + VIR_TEST_VERBOSE("failed to validate migration params '%s' against= QMP schema: %s", + actualJSON, virBufferCurrentContent(&debug)); + return -1; + } + + if (virTestCompareToFile(actualJSON, jsonFile) < 0) + return -1; + + return 0; +} + =20 static int mymain(void) @@ -184,6 +237,13 @@ mymain(void) g_autoptr(GHashTable) qmpschema =3D NULL; virQEMUDriver driver; int ret =3D 0; + qemuMigParamsSourceData src =3D { + .params =3D NULL, + .nparams =3D 0, + .flags =3D 0, + .party =3D QEMU_MIGRATION_SOURCE, + }; + int maxparams =3D 0; =20 if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; @@ -195,10 +255,10 @@ mymain(void) return EXIT_FAILURE; } =20 -#define DO_TEST(name) \ +#define DO_TEST(name, src) \ do { \ qemuMigParamsData data =3D { \ - driver.xmlopt, name, qmpschema \ + driver.xmlopt, name, qmpschema, src \ }; \ if (virTestRun(name " (xml)", qemuMigParamsTestXML, &data) < 0) \ ret =3D -1; \ @@ -206,13 +266,29 @@ mymain(void) ret =3D -1; \ if (virTestRun(name " (xml2xml)", qemuMigParamsTestXML2XML, &data)= < 0) \ ret =3D -1; \ + if ((src !=3D NULL) && virTestRun(name " (src)", qemuMigParamsTest= Params, &data) < 0) \ + ret =3D -1; \ } while (0) =20 - DO_TEST("empty"); - DO_TEST("basic"); - DO_TEST("tls"); - DO_TEST("tls-enabled"); - DO_TEST("tls-hostname"); + DO_TEST("empty", NULL); + DO_TEST("basic", NULL); + DO_TEST("tls", NULL); + DO_TEST("tls-enabled", NULL); + DO_TEST("tls-hostname", NULL); + + src.flags |=3D VIR_MIGRATE_PARALLEL; + + if (virTypedParamsAddString(&src.params, &src.nparams, &maxparams, + VIR_MIGRATE_PARAM_COMPRESSION, "zstd") < 0 || + virTypedParamsAddInt(&src.params, &src.nparams, &maxparams, + VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL, 3) = < 0) { + ret =3D -1; + goto cleanup; + } + DO_TEST("zstd", &src); + + cleanup: + virTypedParamsFree(src.params, src.nparams); =20 qemuTestDriverFree(&driver); =20 --=20 2.40.0