From nobody Wed May 1 23:53:56 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 1536348618633621.0385614055646; Fri, 7 Sep 2018 12:30:18 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 8E0993082133; Fri, 7 Sep 2018 19:30:16 +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 C625A16C00; Fri, 7 Sep 2018 19:30:15 +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 62ECC181A12F; Fri, 7 Sep 2018 19:30:14 +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 w87JUB1u008858 for ; Fri, 7 Sep 2018 15:30:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id B6EC15B690; Fri, 7 Sep 2018 19:30:11 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF8895B68E for ; Fri, 7 Sep 2018 19:30:09 +0000 (UTC) Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 334F71B69 for ; Fri, 7 Sep 2018 19:30:08 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 8DEBE401; Fri, 7 Sep 2018 15:30:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Fri, 07 Sep 2018 15:30:07 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 8499CE4122; Fri, 7 Sep 2018 15:30:06 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:in-reply-to:message-id:mime-version :references:references:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=/RSJwvLV8ZiImDKG29CeAsR93TcMZH9OJYTzAbJGb vc=; b=dqA0eWwtYhYO0pUgaz0m5yedMM0WdJyUxb1QfC5a8+zioPgAuYkEfe/KI 5N0dzHQxmvKglmkemKxrcaSBoqOJM3kgVM2qm+CN+nFlh3hCgnulUDX6t1YH7lUH 2rj0yiXAlv26n3E3AoxU5jsbYFKyCO0UU+1F5MjOSaxLNK7UepzxNzb96xCliNsu Bt1xhwTy4xp5/ANDkyYBoFZZtJWEDbCnXi5FyTz+FEDIpASUYH7erAPlDwcAFv0h qqWv1KKH7umZGQMPshsbxMe/b0TVBMxI/yqGnFPgPxzYmrNK1NfSKADMVFV8DyHa 0it1/kEukCbZjFN14B3te7zzRA9XQ== X-ME-Proxy: X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Fri, 7 Sep 2018 21:29:54 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 212 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 07 Sep 2018 19:30:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 07 Sep 2018 19:30:08 +0000 (UTC) for IP:'64.147.123.25' DOMAIN:'wout2-smtp.messagingengine.com' HELO:'wout2-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.7 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW) 64.147.123.25 wout2-smtp.messagingengine.com 64.147.123.25 wout2-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 1/3] libxl: send lifecycle event on suspend 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 07 Sep 2018 19:30:17 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jim Fehlig --- src/libxl/libxl_domain.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 2ab78ac..b800bc9 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -520,6 +520,18 @@ libxlDomainShutdownThread(void *opaque) case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: goto endjob; } + } else if (xl_reason =3D=3D LIBXL_SHUTDOWN_REASON_SUSPEND) { + virDomainObjSetState(vm, VIR_DOMAIN_PMSUSPENDED, + VIR_DOMAIN_PMSUSPENDED_UNKNOWN); + + dom_event =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_PMSUSPENDED, + VIR_DOMAIN_EVENT_PMSUSPENDED_ME= MORY); + /* + * Similar to the xl implementation, ignore SUSPEND. Any actions = needed + * after calling libxl_domain_suspend() are handled by it's caller= s. + */ + goto endjob; } else { VIR_INFO("Unhandled shutdown_reason %d", xl_reason); goto endjob; @@ -563,7 +575,6 @@ void libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *eve= nt) { libxlDriverPrivatePtr driver =3D data; - libxl_shutdown_reason xl_reason =3D event->u.domain_shutdown.shutdown_= reason; struct libxlShutdownThreadInfo *shutdown_info =3D NULL; virThread thread; libxlDriverConfigPtr cfg; @@ -574,13 +585,6 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CO= NST libxl_event *event) } =20 /* - * Similar to the xl implementation, ignore SUSPEND. Any actions need= ed - * after calling libxl_domain_suspend() are handled by its callers. - */ - if (xl_reason =3D=3D LIBXL_SHUTDOWN_REASON_SUSPEND) - goto error; - - /* * Start a thread to handle shutdown. We don't want to be tying up * libxl's event machinery by doing a potentially lengthy shutdown. */ --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 1 23:53:56 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 1536348636521590.6393670108931; Fri, 7 Sep 2018 12:30:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1AEF661463; Fri, 7 Sep 2018 19:30:35 +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 D28EC9A2C5; Fri, 7 Sep 2018 19:30:34 +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 8C7F74A465; Fri, 7 Sep 2018 19:30:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w87JUD3a008881 for ; Fri, 7 Sep 2018 15:30:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 768C416BE5; Fri, 7 Sep 2018 19:30:13 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C1CC17F8B for ; Fri, 7 Sep 2018 19:30:10 +0000 (UTC) Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E0F5661470 for ; Fri, 7 Sep 2018 19:30:08 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 4FCE62C1; Fri, 7 Sep 2018 15:30:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Fri, 07 Sep 2018 15:30:08 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 2A8F2E4509; Fri, 7 Sep 2018 15:30:07 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:in-reply-to:message-id:mime-version :references:references:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=UvxGTipzAxxh/FB4QqDcxD+MYFAfaebPS66XuDc7o vM=; b=bJz/1qEE2M8uqYO1QO6sQ3PZTe7cr4/aj6ziXnAcU41MH6P0USBBJ4bYr b03ALCA4e45YPJrIi5TsuGZNDAfOdoW/KWev4BffGpPb1HHYBcMarDJ5HZJPDGDx UEnOxq1zFYVPYYvpAxsjhDaImecRVyrVyo1TMdY2/p8bPs2pOZxBdMqrxibhhvGW 91PV/pVoLT9fUtEmjq0p+slPxdF0fb7rtWk2fKolJKY4gOfLIixis18xssrc2w4P 1G3MsXgqPIQ/JkdvAuke0oaJzQB6ixD4p/6VkysFNXT4VTLJKBSsao5cBmb23LQ+ DqLpsniO1wQ99tAUGcDhN+8PKFu5w== X-ME-Proxy: X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Fri, 7 Sep 2018 21:29:55 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 212 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 07 Sep 2018 19:30:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 07 Sep 2018 19:30:09 +0000 (UTC) for IP:'64.147.123.25' DOMAIN:'wout2-smtp.messagingengine.com' HELO:'wout2-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.7 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW) 64.147.123.25 wout2-smtp.messagingengine.com 64.147.123.25 wout2-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 2/3] libxl: implement virDomainPM* functions 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 07 Sep 2018 19:30:35 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jim Fehlig --- Changes in v2: - use virDomainObjEndAPI - drop duplicated error reporting on virDomainObjIsActive - bump version comment to 4.8.0 Changes in v3: - fix virDomainObjIsActive -> virDomainObjCheckActive - reuse duration not supported message from qemu - fix indentation - destroy the domain if death event re-enabling fails --- src/libxl/libxl_driver.c | 127 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 127 insertions(+) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 5a5e792..58f9f1f 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -1403,6 +1403,129 @@ libxlDomainDestroy(virDomainPtr dom) return libxlDomainDestroyFlags(dom, 0); } =20 +#ifdef LIBXL_HAVE_DOMAIN_SUSPEND_ONLY +static int +libxlDomainPMSuspendForDuration(virDomainPtr dom, + unsigned int target, + unsigned long long duration, + unsigned int flags) +{ + virDomainObjPtr vm; + int ret =3D -1; + libxlDriverPrivatePtr driver =3D dom->conn->privateData; + libxlDriverConfigPtr cfg =3D libxlDriverConfigGet(driver); + + virCheckFlags(0, -1); + if (target !=3D VIR_NODE_SUSPEND_TARGET_MEM) { + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, + _("PMSuspend type %d not supported by libxenlight driver"), + target); + return -1; + } + + if (duration !=3D 0) { + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("Duration not supported. Use 0 for now")); + return -1; + } + + if (!(vm =3D libxlDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainPMSuspendForDurationEnsureACL(dom->conn, vm->def) < 0) + goto cleanup; + + if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) + goto cleanup; + + if (!virDomainObjCheckActive(vm)) + goto endjob; + + /* Unlock virDomainObjPtr to not deadlock with even handler, which wil= l try + * to send lifecycle event + */ + virObjectUnlock(vm); + ret =3D libxl_domain_suspend_only(cfg->ctx, vm->def->id, NULL); + virObjectLock(vm); + + if (ret < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to suspend domain '%d'"), vm->def->id); + goto endjob; + } + + ret =3D 0; + + endjob: + libxlDomainObjEndJob(driver, vm); + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} +#endif + +static int +libxlDomainPMWakeup(virDomainPtr dom, unsigned int flags) +{ + libxlDriverPrivatePtr driver =3D dom->conn->privateData; + virDomainObjPtr vm; + int ret =3D -1; + virObjectEventPtr event =3D NULL; + libxlDomainObjPrivatePtr priv; + libxlDriverConfigPtr cfg =3D libxlDriverConfigGet(driver); + + virCheckFlags(0, -1); + + if (!(vm =3D libxlDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainPMWakeupEnsureACL(dom->conn, vm->def) < 0) + goto cleanup; + + if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) + goto cleanup; + + if (virDomainObjGetState(vm, NULL) !=3D VIR_DOMAIN_PMSUSPENDED) { + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("Domain is not suspended")); + goto endjob; + } + + + priv =3D vm->privateData; + if (libxl_domain_resume(cfg->ctx, vm->def->id, 1, NULL) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to resume domain '%d'"), vm->def->id); + goto endjob; + } + virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_WAKEUP= ); + /* reenable death event - libxl reports it only once */ + if (priv->deathW) + libxl_evdisable_domain_death(cfg->ctx, priv->deathW); + if (libxl_evenable_domain_death(cfg->ctx, vm->def->id, 0, &priv->death= W)) + goto destroy_dom; + + event =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_START= ED, + VIR_DOMAIN_EVENT_STARTED_WAKEUP); + + ret =3D 0; + goto endjob; + + destroy_dom: + libxlDomainDestroyInternal(driver, vm); + vm->def->id =3D -1; + virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, VIR_DOMAIN_SHUTOFF_FAILED= ); + + endjob: + libxlDomainObjEndJob(driver, vm); + + cleanup: + virDomainObjEndAPI(&vm); + virObjectEventStateQueue(driver->domainEventState, event); + return ret; +} + static char * libxlDomainGetOSType(virDomainPtr dom) { @@ -6385,6 +6508,10 @@ static virHypervisorDriver libxlHypervisorDriver =3D= { .domainReboot =3D libxlDomainReboot, /* 0.9.0 */ .domainDestroy =3D libxlDomainDestroy, /* 0.9.0 */ .domainDestroyFlags =3D libxlDomainDestroyFlags, /* 0.9.4 */ +#ifdef LIBXL_HAVE_DOMAIN_SUSPEND_ONLY + .domainPMSuspendForDuration =3D libxlDomainPMSuspendForDuration, /* 4.= 8.0 */ +#endif + .domainPMWakeup =3D libxlDomainPMWakeup, /* 4.8.0 */ .domainGetOSType =3D libxlDomainGetOSType, /* 0.9.0 */ .domainGetMaxMemory =3D libxlDomainGetMaxMemory, /* 0.9.0 */ .domainSetMaxMemory =3D libxlDomainSetMaxMemory, /* 0.9.2 */ --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 1 23:53:56 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 1536348631688651.1353778155617; Fri, 7 Sep 2018 12:30:31 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 38F923002871; Fri, 7 Sep 2018 19:30:30 +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 F390F30918D5; Fri, 7 Sep 2018 19:30:29 +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 AA9D24BB75; Fri, 7 Sep 2018 19:30:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w87JUA0s008848 for ; Fri, 7 Sep 2018 15:30:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id B88693083322; Fri, 7 Sep 2018 19:30:10 +0000 (UTC) Received: from mx1.redhat.com (ext-mx17.extmail.prod.ext.phx2.redhat.com [10.5.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B164A30001E7 for ; Fri, 7 Sep 2018 19:30:10 +0000 (UTC) Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8144A3082E65 for ; Fri, 7 Sep 2018 19:30:09 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id DC952390; Fri, 7 Sep 2018 15:30:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Fri, 07 Sep 2018 15:30:09 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id CDDD9E4508; Fri, 7 Sep 2018 15:30:07 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:in-reply-to:message-id:mime-version :references:references:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=EdI7OCc1QzpWldU5AFJATEi5Id9Yy3o2AFXNN6l6D fU=; b=Qtbxuqze4VQEghT1Wf+s6DnQddkNWHMJ6nvnb5jduD2p+hA8+961dLxYL L60MTek2rLVq+OyCZ6//cGkbaxI0mEZwn4Mi8CFgRQRzM46WAiSI6d/xMCLiZ4Oj k03P4tmlIAaVTiaTH0/IvII8gL69SkKOlhrL5R0eo7UF0ajiNmsyfQaCW1NYJM4x Bp6HXqCKh+H2dIMHhcEz8Ctrt55NVbDEZCUBelajXmD/ae9f+Txop0g+5Gg8f/8a 5amHJjnSUEbUPU731xoO0Ogm2lgWLXvUDXCEBJpb9S77zBF5zaGEhg5Z6IMB2QUf H1zjV1JUiLmh2N7Ck0e4AgRPxFStQ== X-ME-Proxy: X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Fri, 7 Sep 2018 21:29:56 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 212 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 07 Sep 2018 19:30:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 07 Sep 2018 19:30:09 +0000 (UTC) for IP:'64.147.123.25' DOMAIN:'wout2-smtp.messagingengine.com' HELO:'wout2-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.7 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW) 64.147.123.25 wout2-smtp.messagingengine.com 64.147.123.25 wout2-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.46 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 3/3] libxl: initialize domain state with real data 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 07 Sep 2018 19:30:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 When libvirtd is started, initialize domain objects state with its real state, not only RUNNING/SHUTOFF. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jim Fehlig --- src/libxl/libxl_driver.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 58f9f1f..006279b 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -412,6 +412,17 @@ libxlReconnectDomain(virDomainObjPtr vm, vm->def, hostdev_flags) < 0) goto error; =20 + if (d_info.shutdown && + d_info.shutdown_reason =3D=3D LIBXL_SHUTDOWN_REASON_SUSPEND) + virDomainObjSetState(vm, VIR_DOMAIN_PMSUSPENDED, + VIR_DOMAIN_PMSUSPENDED_UNKNOWN); + else if (d_info.paused) + virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, + VIR_DOMAIN_PAUSED_UNKNOWN); + else + virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, + VIR_DOMAIN_RUNNING_UNKNOWN); + if (virAtomicIntInc(&driver->nactive) =3D=3D 1 && driver->inhibitCallb= ack) driver->inhibitCallback(true, driver->inhibitOpaque); =20 --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list