From nobody Sun May 5 10:41:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594794855; cv=none; d=zohomail.com; s=zohoarc; b=Jb0EcVp79bi8AEWjXI5SFzBMS0EY0ygeRbVK+xk2FBczQra47Ww9f+8ngnChyXKJV1FGUAOgPBHPyzvlyr1xaaG05xhtejHthoArhGwAnW204FgJM6Z3CjOmelZEEGh6cJLPW4DQY2kG4CIc13ePZoiBb3jGWxVmDnVCyM4sRtw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594794855; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=/NZE8wsXbbCZH1ApIAe0lt5TAiTSnp6vvUle2ze4FEY=; b=eChY9AX+ecIAYOJpxNMKjBv35ySTl/iwaoZOCJExZQYOmDPNeVC64WR6yp4MpPufApa04mtqT7F5+Csj/68Oaok9IAgTa0OOinRiwNiNLwlZ2ROwkkvn8/+Sl5fz/C4jVvQ67+ngrvXOU/cM88EsE3EUWCIvU47XaATeyaM0Z+o= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594794855140980.0552296058064; Tue, 14 Jul 2020 23:34:15 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-84-CPD7LCl0PpqN6Q0YSEjkhg-1; Wed, 15 Jul 2020 02:34:11 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BD5881DE5; Wed, 15 Jul 2020 06:34:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 765A62E020; Wed, 15 Jul 2020 06:34:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 41A12180954D; Wed, 15 Jul 2020 06:34:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06F6Y0w1016037 for ; Wed, 15 Jul 2020 02:34:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 72BD510073BC; Wed, 15 Jul 2020 06:34:00 +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 6E5811007A51 for ; Wed, 15 Jul 2020 06:33:57 +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-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D4B47100E7C4 for ; Wed, 15 Jul 2020 06:33:57 +0000 (UTC) Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-313-YgYkSUlXPYWbGPBlMH6YdA-1; Wed, 15 Jul 2020 02:33:55 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 4139666D8A5955C54886 for ; Wed, 15 Jul 2020 14:18:19 +0800 (CST) Received: from DESKTOP-5IS4806.china.huawei.com (10.174.187.22) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Wed, 15 Jul 2020 14:18:09 +0800 X-MC-Unique: CPD7LCl0PpqN6Q0YSEjkhg-1 X-MC-Unique: YgYkSUlXPYWbGPBlMH6YdA-1 From: Keqian Zhu To: Subject: [PATCH] Qemu: migration: Not bind RAM info with active migration status Date: Wed, 15 Jul 2020 14:18:01 +0800 Message-ID: <20200715061801.19192-1-zhukeqian1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.187.22] X-CFilter-Loop: Reflected X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: wanghaibin.wang@huawei.com, Keqian Zhu , yezengruan@huawei.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For that Qemu supports returning incoming migration info since its commit 65ace0604551 (migration: add postcopy total blocktime into query-migrate), which may contains active status, but without RAM info. Drop this binding relationship check in libvirt. Signed-off-by: Keqian Zhu Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_monitor_json.c | 88 +++++++++++++++++------------------- 1 file changed, 42 insertions(+), 46 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index d808c4b55b..ba8e340742 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3547,56 +3547,52 @@ qemuMonitorJSONGetMigrationStatsReply(virJSONValueP= tr reply, case QEMU_MONITOR_MIGRATION_STATUS_PRE_SWITCHOVER: case QEMU_MONITOR_MIGRATION_STATUS_DEVICE: ram =3D virJSONValueObjectGetObject(ret, "ram"); - if (!ram) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("migration was active, but no RAM info was se= t")); - return -1; - } + if (ram) { + if (virJSONValueObjectGetNumberUlong(ram, "transferred", + &stats->ram_transferred) = < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("migration was active, but RAM 'transferr= ed' " + "data was missing")); + return -1; + } + if (virJSONValueObjectGetNumberUlong(ram, "remaining", + &stats->ram_remaining) < = 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("migration was active, but RAM 'remaining= ' " + "data was missing")); + return -1; + } + if (virJSONValueObjectGetNumberUlong(ram, "total", + &stats->ram_total) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("migration was active, but RAM 'total' " + "data was missing")); + return -1; + } =20 - if (virJSONValueObjectGetNumberUlong(ram, "transferred", - &stats->ram_transferred) < 0)= { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("migration was active, but RAM 'transferred' " - "data was missing")); - return -1; - } - if (virJSONValueObjectGetNumberUlong(ram, "remaining", - &stats->ram_remaining) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("migration was active, but RAM 'remaining' " - "data was missing")); - return -1; - } - if (virJSONValueObjectGetNumberUlong(ram, "total", - &stats->ram_total) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("migration was active, but RAM 'total' " - "data was missing")); - return -1; - } + if (virJSONValueObjectGetNumberDouble(ram, "mbps", &mbps) =3D= =3D 0 && + mbps > 0) { + /* mpbs from QEMU reports Mbits/s (M as in 10^6 not Mi as = 2^20) */ + stats->ram_bps =3D mbps * (1000 * 1000 / 8); + } =20 - if (virJSONValueObjectGetNumberDouble(ram, "mbps", &mbps) =3D=3D 0= && - mbps > 0) { - /* mpbs from QEMU reports Mbits/s (M as in 10^6 not Mi as 2^20= ) */ - stats->ram_bps =3D mbps * (1000 * 1000 / 8); + if (virJSONValueObjectGetNumberUlong(ram, "duplicate", + &stats->ram_duplicate) = =3D=3D 0) + stats->ram_duplicate_set =3D true; + ignore_value(virJSONValueObjectGetNumberUlong(ram, "normal", + &stats->ram_norm= al)); + ignore_value(virJSONValueObjectGetNumberUlong(ram, "normal-byt= es", + &stats->ram_norm= al_bytes)); + ignore_value(virJSONValueObjectGetNumberUlong(ram, "dirty-page= s-rate", + &stats->ram_dirt= y_rate)); + ignore_value(virJSONValueObjectGetNumberUlong(ram, "page-size", + &stats->ram_page= _size)); + ignore_value(virJSONValueObjectGetNumberUlong(ram, "dirty-sync= -count", + &stats->ram_iter= ation)); + ignore_value(virJSONValueObjectGetNumberUlong(ram, "postcopy-r= equests", + &stats->ram_post= copy_reqs)); } =20 - if (virJSONValueObjectGetNumberUlong(ram, "duplicate", - &stats->ram_duplicate) =3D=3D= 0) - stats->ram_duplicate_set =3D true; - ignore_value(virJSONValueObjectGetNumberUlong(ram, "normal", - &stats->ram_normal)); - ignore_value(virJSONValueObjectGetNumberUlong(ram, "normal-bytes", - &stats->ram_normal_b= ytes)); - ignore_value(virJSONValueObjectGetNumberUlong(ram, "dirty-pages-ra= te", - &stats->ram_dirty_ra= te)); - ignore_value(virJSONValueObjectGetNumberUlong(ram, "page-size", - &stats->ram_page_siz= e)); - ignore_value(virJSONValueObjectGetNumberUlong(ram, "dirty-sync-cou= nt", - &stats->ram_iteratio= n)); - ignore_value(virJSONValueObjectGetNumberUlong(ram, "postcopy-reque= sts", - &stats->ram_postcopy= _reqs)); - disk =3D virJSONValueObjectGetObject(ret, "disk"); if (disk) { rc =3D virJSONValueObjectGetNumberUlong(disk, "transferred", --=20 2.19.1