From nobody Mon Apr 29 12:03:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1500659275621514.6193594567427; Fri, 21 Jul 2017 10:47:55 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB2C21E318; Fri, 21 Jul 2017 17:47:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 914E817CC4; Fri, 21 Jul 2017 17:47:53 +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 227E04BB79; Fri, 21 Jul 2017 17:47:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6LHfQJw032635 for ; Fri, 21 Jul 2017 13:41:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 956AD18210; Fri, 21 Jul 2017 17:41:26 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8D35E58856 for ; Fri, 21 Jul 2017 17:41:24 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7C31B80F79 for ; Fri, 21 Jul 2017 17:41:22 +0000 (UTC) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6LHd0Gw135553 for ; Fri, 21 Jul 2017 13:41:21 -0400 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0b-001b2d01.pphosted.com with ESMTP id 2bujuk0wr2-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 21 Jul 2017 13:41:21 -0400 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 21 Jul 2017 11:41:21 -0600 Received: from b03cxnp07028.gho.boulder.ibm.com (9.17.130.15) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 21 Jul 2017 11:41:20 -0600 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6LHfJBc5177798; Fri, 21 Jul 2017 10:41:19 -0700 Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A79FC603C; Fri, 21 Jul 2017 11:41:19 -0600 (MDT) Received: from kofr2.aus.stglabs.ibm.com (unknown [9.40.193.43]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP id 595A4C6047; Fri, 21 Jul 2017 11:41:19 -0600 (MDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BB2C21E318 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BB2C21E318 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7C31B80F79 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=seg@us.ibm.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7C31B80F79 From: seg@us.ibm.com To: libvir-list@redhat.com Date: Fri, 21 Jul 2017 12:41:12 -0500 In-Reply-To: <1500658874-61501-1-git-send-email-seg@us.ibm.com> References: <1500658874-61501-1-git-send-email-seg@us.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17072117-0012-0000-0000-000014B64568 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007400; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00890861; UDB=6.00445130; IPR=6.00671028; BA=6.00005482; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016316; XFM=3.00000015; UTC=2017-07-21 17:41:21 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17072117-0013-0000-0000-00004EB51973 Message-Id: <1500658874-61501-2-git-send-email-seg@us.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-21_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707210274 X-Greylist: Delayed for 49:09:18 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 21 Jul 2017 17:41:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 21 Jul 2017 17:41:23 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'seg@us.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.721 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Scott Garfinkle Subject: [libvirt] [PATCH 1/3] migrate-getmaxdowntime command qemu side 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 21 Jul 2017 17:47:54 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Scott Garfinkle JSON-only implementation to retrieve downtime-limit from Qemu - aka GetMaxDowntime. Signed-off-by: Scott Garfinkle --- src/qemu/qemu_driver.c | 45 ++++++++++++++++++++++++++++++++++++++++= ++++ src/qemu/qemu_monitor.c | 12 ++++++++++++ src/qemu/qemu_monitor.h | 3 +++ src/qemu/qemu_monitor_json.c | 40 +++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 3 +++ 5 files changed, 103 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 8d261b7..72b4d8c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13152,6 +13152,50 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom, return ret; } =20 + +static int +qemuDomainMigrateGetMaxDowntime(virDomainPtr dom, + unsigned long long *downtime, + unsigned int flags) +{ + virQEMUDriverPtr driver =3D dom->conn->privateData; + virDomainObjPtr vm; + qemuDomainObjPrivatePtr priv; + int ret =3D -1; + + virCheckFlags(0, -1); + + if (!(vm =3D qemuDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainMigrateGetMaxDowntimeEnsureACL(dom->conn, vm->def) < 0) + goto cleanup; + + if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + goto cleanup; + + if (!virDomainObjIsActive(vm)) { + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); + goto endjob; + } + + priv =3D vm->privateData; + qemuDomainObjEnterMonitor(driver, vm); + + ret =3D qemuMonitorGetMigrationDowntime(priv->mon, downtime); + + if (qemuDomainObjExitMonitor(driver, vm) < 0) + ret =3D -1; + + endjob: + qemuDomainObjEndJob(driver, vm); + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + static int qemuDomainMigrateGetCompressionCache(virDomainPtr dom, unsigned long long *cacheSize, @@ -20796,6 +20840,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .domainGetJobInfo =3D qemuDomainGetJobInfo, /* 0.7.7 */ .domainGetJobStats =3D qemuDomainGetJobStats, /* 1.0.3 */ .domainAbortJob =3D qemuDomainAbortJob, /* 0.7.7 */ + .domainMigrateGetMaxDowntime =3D qemuDomainMigrateGetMaxDowntime, /* 3= .6.0 */ .domainMigrateSetMaxDowntime =3D qemuDomainMigrateSetMaxDowntime, /* 0= .8.0 */ .domainMigrateGetCompressionCache =3D qemuDomainMigrateGetCompressionC= ache, /* 1.0.3 */ .domainMigrateSetCompressionCache =3D qemuDomainMigrateSetCompressionC= ache, /* 1.0.3 */ diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 2b0afcc..b17a60b 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2552,6 +2552,18 @@ qemuMonitorSetMigrationDowntime(qemuMonitorPtr mon, =20 =20 int +qemuMonitorGetMigrationDowntime(qemuMonitorPtr mon, + unsigned long long *downtime) +{ + VIR_DEBUG("downtime=3D%p", downtime); + + QEMU_CHECK_MONITOR_JSON(mon); + + return qemuMonitorJSONGetMigrationDowntime(mon, downtime); +} + + +int qemuMonitorGetMigrationCacheSize(qemuMonitorPtr mon, unsigned long long *cacheSize) { diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 1697db5..d094d09 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -595,6 +595,9 @@ int qemuMonitorSavePhysicalMemory(qemuMonitorPtr mon, int qemuMonitorSetMigrationSpeed(qemuMonitorPtr mon, unsigned long bandwidth); =20 +int qemuMonitorGetMigrationDowntime(qemuMonitorPtr mon, + unsigned long long *downtime); + int qemuMonitorSetMigrationDowntime(qemuMonitorPtr mon, unsigned long long downtime); =20 diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 65b1fbb..8fc11eb 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2450,6 +2450,46 @@ int qemuMonitorJSONEjectMedia(qemuMonitorPtr mon, virJSONValueFree(cmd); virJSONValueFree(reply); return ret; +}=20 + + +int qemuMonitorJSONGetMigrationDowntime(qemuMonitorPtr mon, + unsigned long long *downtime) +{ + int ret =3D -1; + virJSONValuePtr cmd; + virJSONValuePtr reply =3D NULL; + virJSONValuePtr result; + unsigned int value =3D 0; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("query-migrate-parameters", N= ULL))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + goto cleanup; + + if (qemuMonitorJSONHasError(reply, "CommandNotFound")) + goto cleanup; + + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + goto cleanup; + + if(!(result =3D virJSONValueObjectGet(reply, "return"))) + goto cleanup; + + if (virJSONValueObjectGetNumberUint(result, "downtime-limit", &value) = < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing migration capabilities")); + goto cleanup; + } + + *downtime =3D value; + ret =3D 0; + + cleanup: + virJSONValueFree(cmd); + virJSONValueFree(reply); + return ret; } =20 =20 diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index d090d57..1626085 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -128,6 +128,9 @@ int qemuMonitorJSONSetMigrationSpeed(qemuMonitorPtr mon, int qemuMonitorJSONSetMigrationDowntime(qemuMonitorPtr mon, unsigned long long downtime); =20 +int qemuMonitorJSONGetMigrationDowntime(qemuMonitorPtr mon, + unsigned long long *downtime); + int qemuMonitorJSONGetMigrationCacheSize(qemuMonitorPtr mon, unsigned long long *cacheSize); int qemuMonitorJSONSetMigrationCacheSize(qemuMonitorPtr mon, --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 12:03:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1500659176258415.69497704620085; Fri, 21 Jul 2017 10:46:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0E7877EA92; Fri, 21 Jul 2017 17:46:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B3DEB17481; Fri, 21 Jul 2017 17:46:12 +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 61D9541284; Fri, 21 Jul 2017 17:46:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6LHfSAb032649 for ; Fri, 21 Jul 2017 13:41:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 05C1739BD; Fri, 21 Jul 2017 17:41:28 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F147617144 for ; Fri, 21 Jul 2017 17:41:27 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4A37E804E3 for ; Fri, 21 Jul 2017 17:41:26 +0000 (UTC) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6LHd1E9071324 for ; Fri, 21 Jul 2017 13:41:25 -0400 Received: from e37.co.us.ibm.com (e37.co.us.ibm.com [32.97.110.158]) by mx0b-001b2d01.pphosted.com with ESMTP id 2buj66u03c-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 21 Jul 2017 13:41:25 -0400 Received: from localhost by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 21 Jul 2017 11:41:24 -0600 Received: from b03cxnp07028.gho.boulder.ibm.com (9.17.130.15) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 21 Jul 2017 11:41:22 -0600 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6LHfLB64915628; Fri, 21 Jul 2017 10:41:21 -0700 Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8CABCC6042; Fri, 21 Jul 2017 11:41:21 -0600 (MDT) Received: from kofr2.aus.stglabs.ibm.com (unknown [9.40.193.43]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP id 64B1CC603C; Fri, 21 Jul 2017 11:41:21 -0600 (MDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0E7877EA92 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0E7877EA92 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4A37E804E3 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=seg@us.ibm.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4A37E804E3 From: seg@us.ibm.com To: libvir-list@redhat.com Date: Fri, 21 Jul 2017 12:41:13 -0500 In-Reply-To: <1500658874-61501-1-git-send-email-seg@us.ibm.com> References: <1500658874-61501-1-git-send-email-seg@us.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17072117-0024-0000-0000-000016E64E93 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007400; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00890861; UDB=6.00445130; IPR=6.00671028; BA=6.00005482; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016316; XFM=3.00000015; UTC=2017-07-21 17:41:23 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17072117-0025-0000-0000-00004BF14386 Message-Id: <1500658874-61501-3-git-send-email-seg@us.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-21_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707210274 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 21 Jul 2017 17:41:27 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 21 Jul 2017 17:41:27 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'seg@us.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.721 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Scott Garfinkle Subject: [libvirt] [PATCH 2/3] migrate-getmaxdowntime public symbols and table indices 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 21 Jul 2017 17:46:13 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Scott Garfinkle virsh migrate-getmaxdowntime command public symbols, indices, and dependenc= ies. Signed-off-by: Scott Garfinkle --- src/libvirt_public.syms | 4 ++++ src/remote/remote_protocol.x | 16 +++++++++++++++- src/remote_protocol-structs | 8 ++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index fac77fb..da5692a 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -768,4 +768,8 @@ LIBVIRT_3.4.0 { virStreamSparseSendAll; } LIBVIRT_3.1.0; =20 +LIBVIRT_3.6.0 { + global: + virDomainMigrateGetMaxDowntime; +} LIBVIRT_3.4.0; # .... define new API here using predicted next version number .... diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index aa0aa38..e1f4e27 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -2326,6 +2326,15 @@ struct remote_domain_abort_job_args { }; =20 =20 +struct remote_domain_migrate_get_max_downtime_args { + remote_nonnull_domain dom; + unsigned int flags; +}; + +struct remote_domain_migrate_get_max_downtime_ret { + unsigned hyper downtime; /* insert@1 */ +}; + struct remote_domain_migrate_set_max_downtime_args { remote_nonnull_domain dom; unsigned hyper downtime; @@ -6064,7 +6073,12 @@ enum remote_procedure { * @generate: both * @acl: domain:write */ - REMOTE_PROC_DOMAIN_SET_BLOCK_THRESHOLD =3D 386 + REMOTE_PROC_DOMAIN_SET_BLOCK_THRESHOLD =3D 386, =20 + /** + * @generate: both + * @acl: domain:migrate + */ + REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_DOWNTIME =3D 387 =20 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index a46fe37..5804e60 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -1778,6 +1778,13 @@ struct remote_domain_migrate_set_max_downtime_args { uint64_t downtime; u_int flags; }; +struct remote_domain_migrate_get_max_downtime_args { + remote_nonnull_domain dom; + u_int flags; +}; +struct remote_domain_migrate_get_max_downtime_ret { + uint64_t downtime; +}; struct remote_domain_migrate_get_compression_cache_args { remote_nonnull_domain dom; u_int flags; @@ -3233,4 +3240,5 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_SET_VCPU =3D 384, REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD =3D 385, REMOTE_PROC_DOMAIN_SET_BLOCK_THRESHOLD =3D 386, + REMOTE_PROC_DOMAIN_GET_MAX_DOWNTIME =3D 387 }; --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 12:03:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1500659159144396.2800069540722; Fri, 21 Jul 2017 10:45:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 20CF6C0587C7; Fri, 21 Jul 2017 17:45:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0BBF058856; Fri, 21 Jul 2017 17:45:55 +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 4FAC54BB79; Fri, 21 Jul 2017 17:45:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6LHfUZl032662 for ; Fri, 21 Jul 2017 13:41:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 757BA18210; Fri, 21 Jul 2017 17:41:30 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6D74858856 for ; Fri, 21 Jul 2017 17:41:30 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C5684A6E2 for ; Fri, 21 Jul 2017 17:41:28 +0000 (UTC) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6LHeQ2O078339 for ; Fri, 21 Jul 2017 13:41:28 -0400 Received: from e37.co.us.ibm.com (e37.co.us.ibm.com [32.97.110.158]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bunb1sxag-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 21 Jul 2017 13:41:27 -0400 Received: from localhost by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 21 Jul 2017 11:41:27 -0600 Received: from b03cxnp07028.gho.boulder.ibm.com (9.17.130.15) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 21 Jul 2017 11:41:24 -0600 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6LHfOJ45177850; Fri, 21 Jul 2017 10:41:24 -0700 Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4D7FBC6043; Fri, 21 Jul 2017 11:41:24 -0600 (MDT) Received: from kofr2.aus.stglabs.ibm.com (unknown [9.40.193.43]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP id 116C7C603C; Fri, 21 Jul 2017 11:41:24 -0600 (MDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 20CF6C0587C7 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 20CF6C0587C7 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5C5684A6E2 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=seg@us.ibm.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5C5684A6E2 From: seg@us.ibm.com To: libvir-list@redhat.com Date: Fri, 21 Jul 2017 12:41:14 -0500 In-Reply-To: <1500658874-61501-1-git-send-email-seg@us.ibm.com> References: <1500658874-61501-1-git-send-email-seg@us.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17072117-0024-0000-0000-000016E64E94 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007400; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00890861; UDB=6.00445130; IPR=6.00671028; BA=6.00005482; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016316; XFM=3.00000015; UTC=2017-07-21 17:41:25 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17072117-0025-0000-0000-00004BF14389 Message-Id: <1500658874-61501-4-git-send-email-seg@us.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-21_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707210274 X-Greylist: Delayed for 49:09:24 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 21 Jul 2017 17:41:29 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 21 Jul 2017 17:41:29 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'seg@us.ibm.com' RCPT:'' X-RedHat-Spam-Score: -3.501 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Scott Garfinkle Subject: [libvirt] [PATCH 3/3] migrate-getmaxdowntime local/libvirt bits 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 21 Jul 2017 17:45:57 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Scott Garfinkle virsh migrate-getmaxdowntime command libvirt and virsh side, including help Signed-off-by: Scott Garfinkle --- include/libvirt/libvirt-domain.h | 4 ++++ src/driver-hypervisor.h | 6 ++++++ src/libvirt-domain.c | 43 +++++++++++++++++++++++++++++++++++++ src/remote/remote_driver.c | 1 + tools/virsh-domain.c | 46 ++++++++++++++++++++++++++++++++++++= ++++ tools/virsh.pod | 18 ++++++++++++++++ 6 files changed, 118 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 45f939a..ed3c461 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1043,6 +1043,10 @@ int virDomainMigrateSetMaxDowntime (virDomainPtr dom= ain, unsigned long long downtime, unsigned int flags); =20 +int virDomainMigrateGetMaxDowntime (virDomainPtr domain, + unsigned long long *downtime, + unsigned int flags); + int virDomainMigrateGetCompressionCache(virDomainPtr domain, unsigned long long *cacheSize, unsigned int flags); diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index 3053d7a..7d32cad 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -702,6 +702,11 @@ typedef int unsigned int flags); =20 typedef int +(*virDrvDomainMigrateGetMaxDowntime)(virDomainPtr domain, + unsigned long long *downtime, + unsigned int flags); + +typedef int (*virDrvDomainMigrateGetCompressionCache)(virDomainPtr domain, unsigned long long *cacheSize, unsigned int flags); @@ -1412,6 +1417,7 @@ struct _virHypervisorDriver { virDrvDomainGetJobInfo domainGetJobInfo; virDrvDomainGetJobStats domainGetJobStats; virDrvDomainAbortJob domainAbortJob; + virDrvDomainMigrateGetMaxDowntime domainMigrateGetMaxDowntime; virDrvDomainMigrateSetMaxDowntime domainMigrateSetMaxDowntime; virDrvDomainMigrateGetCompressionCache domainMigrateGetCompressionCach= e; virDrvDomainMigrateSetCompressionCache domainMigrateSetCompressionCach= e; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 4033ae8..12417e2 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -8781,6 +8781,49 @@ virDomainMigrateSetMaxDowntime(virDomainPtr domain, =20 =20 /** + * virDomainMigrateGetMaxDowntime: + * @domain: a domain object + * @downtime: return value of the maximum tolerable downtime for live migr= ation, in milliseconds + * @flags: extra flags; not used yet, so callers should always pass 0 + * + * Gets current maximum tolerable time for which the domain is allowed to = be paused + * at the end of live migration. It's supposed to be called while the doma= in is + * being live-migrated as a reaction to migration progress. + * + * Returns 0 in case of success, -1 otherwise. + */ +int +virDomainMigrateGetMaxDowntime(virDomainPtr domain, + unsigned long long *downtime, + unsigned int flags) +{ + virConnectPtr conn; + + VIR_DOMAIN_DEBUG(domain, "downtime =3D %p, flags=3D%x", downtime, flag= s); + + virResetLastError(); + + virCheckDomainReturn(domain, -1); + conn =3D domain->conn; + + virCheckNonNullArgGoto(downtime, error); + + //unlike SetMaxDowntime, it's okay for the connection to be readonly + + if (conn->driver->domainMigrateGetMaxDowntime) { + if (conn->driver->domainMigrateGetMaxDowntime(domain, downtime, fl= ags) < 0) + goto error; + return 0; + } + + virReportUnsupportedError(); + error: + virDispatchError(conn); + return -1; +} + + +/** * virDomainMigrateGetCompressionCache: * @domain: a domain object * @cacheSize: return value of current size of the cache (in bytes) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index a57d25f..aa8d8a1 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8400,6 +8400,7 @@ static virHypervisorDriver hypervisor_driver =3D { .domainGetJobInfo =3D remoteDomainGetJobInfo, /* 0.7.7 */ .domainGetJobStats =3D remoteDomainGetJobStats, /* 1.0.3 */ .domainAbortJob =3D remoteDomainAbortJob, /* 0.7.7 */ + .domainMigrateGetMaxDowntime =3D remoteDomainMigrateGetMaxDowntime, /*= 3.6.0 */ .domainMigrateSetMaxDowntime =3D remoteDomainMigrateSetMaxDowntime, /*= 0.8.0 */ .domainMigrateGetCompressionCache =3D remoteDomainMigrateGetCompressio= nCache, /* 1.0.3 */ .domainMigrateSetCompressionCache =3D remoteDomainMigrateSetCompressio= nCache, /* 1.0.3 */ diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 0684979..1b524a3 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -10720,6 +10720,46 @@ cmdMigrateSetMaxDowntime(vshControl *ctl, const vs= hCmd *cmd) } =20 /* + * "migrate-getmaxdowntime" command + */ +static const vshCmdInfo info_migrate_getmaxdowntime[] =3D { + {.name =3D "help", + .data =3D N_("get maximum tolerable downtime") + }, + {.name =3D "desc", + .data =3D N_("Get maximum tolerable downtime (in milliseconds)for a d= omain which is being live-migrated to another host.") + }, + {.name =3D NULL} +}; + +static const vshCmdOptDef opts_migrate_getmaxdowntime[] =3D { + VIRSH_COMMON_OPT_DOMAIN_FULL, + {.name =3D NULL} +}; + +static bool +cmdMigrateGetMaxDowntime(vshControl *ctl, const vshCmd *cmd) +{ + virDomainPtr dom =3D NULL; + unsigned long long downtime; + bool ret =3D false; + + if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) + return false; + + if (virDomainMigrateGetMaxDowntime(dom, &downtime, 0)) + goto done; + + vshPrint(ctl, "%llu\n", downtime); + + ret =3D true; + + done: + virDomainFree(dom); + return ret; +} + +/* * "migrate-compcache" command */ static const vshCmdInfo info_migrate_compcache[] =3D { @@ -13845,6 +13885,12 @@ const vshCmdDef domManagementCmds[] =3D { .info =3D info_migrate_setmaxdowntime, .flags =3D 0 }, + {.name =3D "migrate-getmaxdowntime", + .handler =3D cmdMigrateGetMaxDowntime, + .opts =3D opts_migrate_getmaxdowntime, + .info =3D info_migrate_getmaxdowntime, + .flags =3D 0 + }, {.name =3D "migrate-compcache", .handler =3D cmdMigrateCompCache, .opts =3D opts_migrate_compcache, diff --git a/tools/virsh.pod b/tools/virsh.pod index 43d6f0c..fc0a46c 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1869,6 +1869,24 @@ is supposed to be used while the domain is being liv= e-migrated as a reaction to migration progress and increasing number of compression cache misses obtained from domjobinfo. =20 +=3Ditem B I + +Get the maximum tolerable downtime for a domain which is being live-migrat= ed to +another host. This is the number of milliseconds the guest is allowed +to be down at the end of live migration. + +=3Ditem B I [I<--size> B] + +Sets and/or gets size of the cache (in bytes) used for compressing repeate= dly +transferred memory pages during live migration. When called without I, +the command just prints current size of the compression cache. When I +is specified, the hypervisor is asked to change compression cache to I +bytes and then the current size is printed (the result may differ from the +requested size due to rounding done by the hypervisor). The I option +is supposed to be used while the domain is being live-migrated as a reacti= on +to migration progress and increasing number of compression cache misses +obtained from domjobinfo. + =3Ditem B I I =20 Set the maximum migration bandwidth (in MiB/s) for a domain which is being --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list