From nobody Sat May 4 19:31: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 1533510089867230.45516375461762; Sun, 5 Aug 2018 16:01:29 -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 34F4730E684B; Sun, 5 Aug 2018 23:01:27 +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 5C0A0D58BB; Sun, 5 Aug 2018 23:01:26 +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 8FD3118037ED; Sun, 5 Aug 2018 23:01:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w75N1MFs016468 for ; Sun, 5 Aug 2018 19:01:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2B4D518964; Sun, 5 Aug 2018 23:01:22 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 21648183A7 for ; Sun, 5 Aug 2018 23:01:19 +0000 (UTC) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 335EF308FB98 for ; Sun, 5 Aug 2018 23:01:18 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 6808C20DC2; Sun, 5 Aug 2018 19:01:17 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Sun, 05 Aug 2018 19:01:17 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id B2A1AE425A; Sun, 5 Aug 2018 19:01:16 -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=KbwEb8L6ZtJ56jZws24+jkpnmFgaRoQmaSNB9Mf0l 6I=; b=kmdv9RzPv9sqxCc29JkIWSQoFV6uBuRD7WmimJxk84RVaG8Olw0fUFdFy ZSdnSnZDVFoBixCrVVumv0NnTnFxpqZob1ON0sEOWMPnkPAmtBVpzBafjG4t5NvU Kx8CzPXFp1ISuJsgk2c5P2mkjbzh2ePePwEZwDuqat7pV9MRwH0TkTVF8jozqACl /hv7q9dVdf/9H4vqx+jf5/tXyibXyxZOVjdj1Lm4nYSFGHoebOdRsvaMiJx+6VP4 eGQTH3zXeoIyXSGHeyKn/o83woKgRkINkKKwfEbpFrLtnN8tXT39Y4CkqozHc0zn 4b74OJm30Lfel5Yx4CnuzcvMgT2rw== X-ME-Proxy: X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Mon, 6 Aug 2018 01:01:07 +0200 Message-Id: <8e3b9fb8e223edc3308c9b466a2510e70ac2529a.1533510021.git-series.marmarek@invisiblethingslab.com> In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 209 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Sun, 05 Aug 2018 23:01:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Sun, 05 Aug 2018 23:01:18 +0000 (UTC) for IP:'66.111.4.25' DOMAIN:'out1-smtp.messagingengine.com' HELO:'out1-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS) 66.111.4.25 out1-smtp.messagingengine.com 66.111.4.25 out1-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 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.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Sun, 05 Aug 2018 23:01:27 +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 Sat May 4 19:31: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 1533510089455553.3850902351026; Sun, 5 Aug 2018 16:01:29 -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 89D6E3082133; Sun, 5 Aug 2018 23:01:26 +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 C705FD58BA; Sun, 5 Aug 2018 23:01:25 +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 1E9F14BB78; Sun, 5 Aug 2018 23:01:23 +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 w75N1MAU016474 for ; Sun, 5 Aug 2018 19:01:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 409A680D8F; Sun, 5 Aug 2018 23:01:22 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 32BF67FD5D for ; Sun, 5 Aug 2018 23:01:19 +0000 (UTC) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9FF5CC0467C3 for ; Sun, 5 Aug 2018 23:01:18 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 0BF3A2147B; Sun, 5 Aug 2018 19:01:18 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Sun, 05 Aug 2018 19:01:18 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 55DBAE4074; Sun, 5 Aug 2018 19:01:17 -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=OJk2OxPsbN6qpsntJ4qjEz//LaL9Kt+dfkILh0FWr U8=; b=W/9xaVUTiw/dqkoGnK3Ia7uwCiq9oSFqUnNztc47KRkRqZCnhAptYXDU/ TLQuhu2QmvNWSgw8aLU4cXlpYoLfRnKgY6JNkEdvJQzIOLkUNDTdrMuluE0uHbi3 aSnJ3br/XbzHpIKEeTe9ekuSi6z88MeVqu3dtbY1FTob8BCirQ04xJZ3n/Eu2I97 KFKZTyfcx5Qfk8+R5qnoWYWk9ovksvYQ1TglRz90/LllV86/I1peeWACSWkWVlP9 A78lD+tOA5ow2lENucBk78Jo1CuGjpLF8uU6JpjRjo4HVCHWnUjx2GGYUyENpz4z zGZ5d/YqZsNROUAGoHwNGpZ6cpwBw== X-ME-Proxy: X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Mon, 6 Aug 2018 01:01:08 +0200 Message-Id: <0a7c5eda1d0599063ab5d893977b77b68e613a1b.1533510021.git-series.marmarek@invisiblethingslab.com> In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 209 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sun, 05 Aug 2018 23:01:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sun, 05 Aug 2018 23:01:18 +0000 (UTC) for IP:'66.111.4.25' DOMAIN:'out1-smtp.messagingengine.com' HELO:'out1-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS) 66.111.4.25 out1-smtp.messagingengine.com 66.111.4.25 out1-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 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.42]); Sun, 05 Aug 2018 23:01:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Signed-off-by: Marek Marczykowski-G=C3=B3recki --- src/libxl/libxl_driver.c | 126 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 126 insertions(+) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 5a5e792..10c7aab 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -1403,6 +1403,128 @@ 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", + _("libxenlight driver supports only duration=3D0")); + 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 (!virDomainObjIsActive(vm)) { + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("Domain is not running")); + 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: + if (vm) + virObjectUnlock(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; + } + + event =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_START= ED, + VIR_DOMAIN_EVENT_STARTED_WAKEUP); + + 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 endjob; + + ret =3D 0; + + endjob: + libxlDomainObjEndJob(driver, vm); + + cleanup: + if (vm) + virObjectUnlock(vm); + virObjectEventStateQueue(driver->domainEventState, event); + return ret; +} + static char * libxlDomainGetOSType(virDomainPtr dom) { @@ -6385,6 +6507,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.= 7.0 */ +#endif + .domainPMWakeup =3D libxlDomainPMWakeup, /* 4.7.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 Sat May 4 19:31: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 1533510113403548.7565295963506; Sun, 5 Aug 2018 16:01:53 -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 E876E308A956; Sun, 5 Aug 2018 23:01:50 +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 AECED80D8F; Sun, 5 Aug 2018 23:01:50 +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 5E6F74A469; Sun, 5 Aug 2018 23:01:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w75N1MHQ016483 for ; Sun, 5 Aug 2018 19:01:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 72513308BDA6; Sun, 5 Aug 2018 23:01:22 +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 63F5C308BDA4 for ; Sun, 5 Aug 2018 23:01:20 +0000 (UTC) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CA8D74E900 for ; Sun, 5 Aug 2018 23:01:19 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 35088214E0; Sun, 5 Aug 2018 19:01:18 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Sun, 05 Aug 2018 19:01:19 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id EF07AE425A; Sun, 5 Aug 2018 19:01:17 -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=x0XSNP2vqMQbFZ1JpBy2WqX48x3wcSa2oRvrXYmKs 2E=; b=ka/XbLkIwBeSqaBVUUSxU92ju8gYRH6Mf7tCxpWwseFkxdtew4e0QZy2u NIQfACZB0UEH5P5qPfo/sKKw4cnqti5MXHrkPqOxYiR60OvoMTjA1uEaf2H7rmya R1XdCITmwKNz44Mtdk+haDI6jt89eRlVhl7fFJ+IsSMhwfxymi2ZOf9cAZhID8RC 0EL3p0KEvvDexJo85BLRE95dR8nk3B3CxMkfhxObN9W68JBDE48DPLjvfTBQrFDU EixbxsP79ScepLMiu2UkPmd+scSFg4gKRaPBFFGjXP985v6fcr84wwFyhVKyjJ62 PNwEfOnq/pHkSGa5imvAcCV/EmbRg== X-ME-Proxy: X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Mon, 6 Aug 2018 01:01:09 +0200 Message-Id: <546faeef72f1715adffc8730f6b066b59385eb35.1533510021.git-series.marmarek@invisiblethingslab.com> In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 209 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sun, 05 Aug 2018 23:01:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sun, 05 Aug 2018 23:01:19 +0000 (UTC) for IP:'66.111.4.25' DOMAIN:'out1-smtp.messagingengine.com' HELO:'out1-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS) 66.111.4.25 out1-smtp.messagingengine.com 66.111.4.25 out1-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 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.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.41]); Sun, 05 Aug 2018 23:01:51 +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 10c7aab..16b3146 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