From nobody Sun Apr 28 17:06:54 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 1536012709892557.053182868654; Mon, 3 Sep 2018 15:11:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2B4AA88302; Mon, 3 Sep 2018 22:11:48 +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 D01A260BE4; Mon, 3 Sep 2018 22:11:47 +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 6AAE9181A12E; Mon, 3 Sep 2018 22:11:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w83M9oWi013036 for ; Mon, 3 Sep 2018 18:09:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3F439601B0; Mon, 3 Sep 2018 22:09:50 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 37A4E60BC0 for ; Mon, 3 Sep 2018 22:09:48 +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 26C65307D90F for ; Mon, 3 Sep 2018 22:09:47 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 81F2721B6B; Mon, 3 Sep 2018 18:09:46 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Mon, 03 Sep 2018 18:09:46 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id C9AF1E44DD; Mon, 3 Sep 2018 18:09:45 -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=smUAPJlCoFC3IW7Jtf2UotU5Ya0D3hGdrbbojc+PBJpuF7cv/i4XWnNs/ BSTHpLPjCJJqhTlPcPwPIKsEAWJVCUTynPm7VRmNY4Knj9ydSePWRNswKti7JF8W UfPB7KoZ8ZIEQPvQK1eVwqHlBkTpxJPAjAkRssMUMoqOlaDqxjLP4M1T1gLvXxNc LDQAiFuEZtplbGFnDXA7geonES12f1PidyvZa+aZN+j0rMlX+Ym62qF1Do4AvXRU E3+gbtA1n4gOyfLhN543fgFKUCekdr6qTyJX2qUG8gGDuXxjI/sfnrqnfcURvz2g HpMN/nvFJH6rMY2dTSpQyVqgOIQMA== X-ME-Proxy: X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Tue, 4 Sep 2018 00:09:32 +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.48]); Mon, 03 Sep 2018 22:09:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 03 Sep 2018 22:09:47 +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.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 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.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 03 Sep 2018 22:11:48 +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 Sun Apr 28 17:06:54 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 1536012795339365.7491303779947; Mon, 3 Sep 2018 15:13:15 -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 38DE583F3C; Mon, 3 Sep 2018 22:13: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 F129289DFE; Mon, 3 Sep 2018 22:13: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 A93854BB75; Mon, 3 Sep 2018 22:13:12 +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 w83M9o2n013049 for ; Mon, 3 Sep 2018 18:09:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id D1DDD308BDA9; Mon, 3 Sep 2018 22:09:50 +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 C9081308BDA2 for ; Mon, 3 Sep 2018 22:09:48 +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 AD0E0356D5 for ; Mon, 3 Sep 2018 22:09:47 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 241F821B0B; Mon, 3 Sep 2018 18:09:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Mon, 03 Sep 2018 18:09:47 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 6EF1CE462B; Mon, 3 Sep 2018 18:09:46 -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=BeJqRySExiTqh4eiW4fX4Vg4n+bPQnwYcdJ1UX5Au UQ=; b=Nr/6wcJx+xvuGbecOFK1FrR2tdA7d1LeUiAQq5K2QFumHrbQn1+gwhweP SPoL2UoMpjAi27kMSLspRN3bzJ6RM1pafAHARZ7UQHAGcC3/K/x6G2JE6J5IukIy xTktHj8MY9mwvLCtdEUX+cgy9ciW/gn7mPtMPNCZZfWuAH60OKDGFkbxXjuvmkl0 ShIqO4505JdFMNZXIQDxaZFY6eE3ipCQ1JN/UIod97AageVJyAccZFKXQgINmTbd 6i3jrwureKoolbWdFR5CHQDC/JXwHoJ0XWt310KtLK8dZMAP9fEVfXiUYYzFAK0H ZtaqCobLDrzbA/QQDzDIEGpJwy0dw== X-ME-Proxy: X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Tue, 4 Sep 2018 00:09:33 +0200 Message-Id: <1220ee9cb73c45fbd5eb759f0efe373d6723a059.1536012494.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 212 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 03 Sep 2018 22:09:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 03 Sep 2018 22:09:47 +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.30 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 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.27]); Mon, 03 Sep 2018 22:13:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Signed-off-by: Marek Marczykowski-G=C3=B3recki --- Changes in v2: - use virDomainObjEndAPI - drop duplicated error reporting on virDomainObjIsActive - bump version comment to 4.8.0 --- src/libxl/libxl_driver.c | 121 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 121 insertions(+) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 5a5e792..0a4e716 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -1403,6 +1403,123 @@ 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)) + 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; + } + + 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: + virDomainObjEndAPI(&vm); + virObjectEventStateQueue(driver->domainEventState, event); + return ret; +} + static char * libxlDomainGetOSType(virDomainPtr dom) { @@ -6385,6 +6502,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 Sun Apr 28 17:06:54 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 1536012651526236.0696431709723; Mon, 3 Sep 2018 15:10:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2652D30820C0; Mon, 3 Sep 2018 22:10:43 +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 E7BE21001F5B; Mon, 3 Sep 2018 22:10:40 +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 0380518005DF; Mon, 3 Sep 2018 22:10:36 +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 w83M9nYQ013027 for ; Mon, 3 Sep 2018 18:09:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8BB0B19489; Mon, 3 Sep 2018 22:09:49 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F6F819484 for ; Mon, 3 Sep 2018 22:09:49 +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 517D23086246 for ; Mon, 3 Sep 2018 22:09:48 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id BBB882144B; Mon, 3 Sep 2018 18:09:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Mon, 03 Sep 2018 18:09:47 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 16025E44DD; Mon, 3 Sep 2018 18:09:46 -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=2mcuRJjn9VtfGHRXCdYDmEeyyrS9eKmspoZTtYWIi JU=; b=CYgxols9rgPpUtWYlAVbP+ip20Z7rJxtFpUlK1igTpZWGKorquwcwX+la FAERmp15TFsTQ+jhFDWJLA3S5JjZNeJJlZw6doS+5pNfVSW6V++hAi+BfRs4Oeyp kHNYMyGlUd4Ll6aYyEQgWwE5DI3ZGG37kaIjb3gjewY99dsMB7P8HOFyhopNNkmv oYXRbqPbAykqpF/8xgcdTp/5vkgoJ/eGBZhQGxTYmHdce9flzdr8u4ZR/SwAoKub Q1o7eLr/n/iuoLkc2+4kSyzoZIclOAV9WEjbwHi1Ok5kQIdezGOukPStHUD0bIX1 y4J3DwQ71z58aG6+ZwV4Ap6LAYurQ== X-ME-Proxy: X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Tue, 4 Sep 2018 00:09:34 +0200 Message-Id: <551fec425d0448572eb9559f06fad841d0eeac22.1536012494.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 212 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 03 Sep 2018 22:09:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 03 Sep 2018 22:09:48 +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.49 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 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.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 03 Sep 2018 22:10:49 +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 0a4e716..4b2d688 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