From nobody Sat Feb 7 17:34:31 2026 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1565713242; cv=none; d=zoho.com; s=zohoarc; b=Tigtz2gtYcGngn5LIQqkwpRfvDJKta69wwjsi/AHE0FkGPKDnKK2IwotNtWb7fGnY0a+9K/uzcb6AIUsfu3eQR0jGnsRGCdRojYCjB9QJZ/O66wLsiOT2qN5+rQPhg5S1KO2xVFDG1L0SSQ3EK6l/tK/7T10ddu9h84yPoYzwBc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565713242; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=6VarylO/+ds0OSmgn4PHrY1ocLisKXqViUBqYy9RxYU=; b=Ibm/ZznokvoFLNFE0thTDTkfZDXnLjolMYxd0t/AJNC4inlH2EmPb9dI1qHBHI2dRW5ye+esjvwNdlHXa1bs9QBGve3Kp32x3WV9meig2ZYZ85G4apRmtWcjAWVXSQx0cAT8VY3a9+Fk5/THoBkqpZZiO3PpMG6ttwnc8OA2VEs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565713242123383.6401797392149; Tue, 13 Aug 2019 09:20:42 -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 E2E967CB80; Tue, 13 Aug 2019 16:20:40 +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 C13188095B; Tue, 13 Aug 2019 16:20: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 803EAE206; Tue, 13 Aug 2019 16:20:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7DGKdNV012221 for ; Tue, 13 Aug 2019 12:20:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5767E18E35; Tue, 13 Aug 2019 16:20:39 +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 527CB821F8 for ; Tue, 13 Aug 2019 16:20:37 +0000 (UTC) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3BBED82DA for ; Tue, 13 Aug 2019 16:20:36 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id n9so108421401wru.0 for ; Tue, 13 Aug 2019 09:20:36 -0700 (PDT) Received: from archlap.localdomain ([185.32.231.210]) by smtp.gmail.com with ESMTPSA id f192sm1402686wmg.30.2019.08.13.09.20.33 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 13 Aug 2019 09:20:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=1JuO6NoZNVe8f43nAQZ2AMSDV9FCbJojr73fzuAqWK4=; b=FAvvx2ctd9vAK/bKSbUR4/ko1y3Bo38HJBYV6SCk85Ux7Qpbi96L1NC4CKOKJIqYgu SMj6fvTYGmpzrU5BnZxZmJovDEIVhVTE/guGenc9v8W81CZmDCzQbD8VcoPRWQZuJvC3 FQ8le/YxG80jQUcZBgzSAmVDSRl3inKEaoSsTajFcMTe2TAOdVnoZNor3VRMPehUH2M0 OGEh7sz3MlOcYzCz1x2c3n5tTiYBU4POC0xr3MEwDhe5R+5OBvAjRcOTqJac2/fv5Pza iHTdsEMmyF2ji1D4+zfBFxFC7ApZtU6f1mirBnJJ6d0D/8CG6t5VQEqEkxp07lIgtcQ0 r4XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1JuO6NoZNVe8f43nAQZ2AMSDV9FCbJojr73fzuAqWK4=; b=XenzNUkUTIo0J5dMzEBcWJKIuS2LckE2z8mrAEFK6qXbbli6MR8D4gauFS5Bd7jg0G ATVsyN9CIkDfYbU6i2QEJt5wWUTCJEC2l595P54gNtg1fny5eX6rKq64mAIDcDAME1n6 EU6gzcb/g9MDGpr+RxJTl29/hUHmLmzWoGMCpgCRrrWwYhqbieG8r98UD1kk/eVxjtjp MhHP3A/EMgFYwD1gVX5o/m9NjwJNN6sKKj4wLYMOj8Lx/Bh9ZYkFSzIcBpEHIipkEIsu te2dhHhC40dXgNallTwhh9dSun6jy5C56pzUm++R8STkevJls0Te09aTjHipFlYh0ckH cYEg== X-Gm-Message-State: APjAAAXKS2tTkTL/gT/rTVeb6a2Edu2tBebUQ+rNtSl9L7qwtK1BVriy ucy6yGBlTZhor/EYjm6Kv5XY3jlIKbw= X-Google-Smtp-Source: APXvYqxQkqa1p8lQQZNKtq3mYA8eTlRNcoqOHyjGoDWxHrKQY+jcwgRKh4E1oQ0G0dZVRNh1wdOXkg== X-Received: by 2002:adf:f991:: with SMTP id f17mr19602833wrr.233.1565713234580; Tue, 13 Aug 2019 09:20:34 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Tue, 13 Aug 2019 19:19:59 +0300 Message-Id: <20190813162000.20788-2-stamatis.iliass@gmail.com> In-Reply-To: <20190813162000.20788-1-stamatis.iliass@gmail.com> References: <20190813162000.20788-1-stamatis.iliass@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 13 Aug 2019 16:20:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 13 Aug 2019 16:20:36 +0000 (UTC) for IP:'209.85.221.65' DOMAIN:'mail-wr1-f65.google.com' HELO:'mail-wr1-f65.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.099 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 209.85.221.65 mail-wr1-f65.google.com 209.85.221.65 mail-wr1-f65.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] test_driver: implement virDomainPMSuspendForDuration 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-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.26]); Tue, 13 Aug 2019 16:20:41 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ilias Stamatis Reviewed-by: Daniel Henrique Barboza --- src/test/test_driver.c | 79 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 5f5c512571..d21a69c7ed 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4090,6 +4090,84 @@ static int testDomainSetMetadata(virDomainPtr dom, return ret; } + +static int +testDomainPMSuspendForDuration(virDomainPtr dom, + unsigned int target, + unsigned long long duration, + unsigned int flags) +{ + virDomainObjPtr vm; + testDriverPtr privconn =3D dom->conn->privateData; + virObjectEventPtr event_suspend =3D NULL; + virObjectEventPtr event_shutdown =3D NULL; + int ret =3D -1; + + virCheckFlags(0, -1); + + if (duration) { + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("Duration not supported. Use 0 for now")); + return -1; + } + + if (target >=3D VIR_NODE_SUSPEND_TARGET_LAST) { + virReportError(VIR_ERR_INVALID_ARG, + _("Unknown suspend target: %u"), + target); + return -1; + } + + if (!(vm =3D testDomObjFromDomain(dom))) + return -1; + + if (virDomainObjGetState(vm, NULL) !=3D VIR_DOMAIN_RUNNING) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain is not running")); + goto cleanup; + } + + if (vm->def->pm.s3 || vm->def->pm.s4) { + if (vm->def->pm.s3 =3D=3D VIR_TRISTATE_BOOL_NO && + (target =3D=3D VIR_NODE_SUSPEND_TARGET_MEM || + target =3D=3D VIR_NODE_SUSPEND_TARGET_HYBRID)) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("S3 state is disabled for this domain")); + goto cleanup; + } + + if (vm->def->pm.s4 =3D=3D VIR_TRISTATE_BOOL_NO && + target =3D=3D VIR_NODE_SUSPEND_TARGET_DISK) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("S4 state is disabled for this domain")); + goto cleanup; + } + } + + virDomainObjSetState(vm, VIR_DOMAIN_PMSUSPENDED, + VIR_DOMAIN_PMSUSPENDED_UNKNOWN); + event_suspend =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_PMSUSPENDED, + VIR_DOMAIN_EVENT_SUSPENDED_PAUSE= D); + virObjectEventStateQueue(privconn->eventState, event_suspend); + + if (target =3D=3D VIR_NODE_SUSPEND_TARGET_DISK) { + testDomainShutdownState(dom, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN); + event_shutdown =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_STOPPED, + VIR_DOMAIN_EVENT_STOPPED_SH= UTDOWN); + if (!vm->persistent) + virDomainObjListRemove(privconn->domains, vm); + } + + ret =3D 0; + cleanup: + virDomainObjEndAPI(&vm); + virObjectEventStateQueue(privconn->eventState, event_shutdown); + return ret; +} + + #define TEST_TOTAL_CPUTIME 48772617035LL static int @@ -9415,6 +9493,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainSendKey =3D testDomainSendKey, /* 5.5.0 */ .domainGetMetadata =3D testDomainGetMetadata, /* 1.1.3 */ .domainSetMetadata =3D testDomainSetMetadata, /* 1.1.3 */ + .domainPMSuspendForDuration =3D testDomainPMSuspendForDuration, /* 5.7= .0 */ .domainGetCPUStats =3D testDomainGetCPUStats, /* 5.6.0 */ .domainSendProcessSignal =3D testDomainSendProcessSignal, /* 5.5.0 */ .connectGetCPUModelNames =3D testConnectGetCPUModelNames, /* 1.1.3 */ -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Feb 7 17:34:31 2026 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1565713268; cv=none; d=zoho.com; s=zohoarc; b=eHVMXnMM0TAUQKD2qnnFvzcFrdPsvsGFmczu2sRtz6l/H7yCVJevcdppsRmsjt3kbhw74aHO+5KgMGmKMGPm5b+r0nB3EpAzFBURG5U0U53E2VdphOpniRNIc5lrGADBqidHzU0Det3jVA4mtVWWLNbyEIq+TQvSSJ+Fnu9ib48= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565713268; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=M1Bhj2d9sEjgU6sgVJENkPQIZm61lKP7bURjCJViBUw=; b=gfWKjpnKgffXoi8r2ILixP6YlGdeWhuO4Fuy8ZNIEQNFvJO3EKaUqNOo3Sc5lAm3i08Fk9tWor9/iEqAIUNOgmwLzVyXCCHXPUMq0E5aPo6Dd5B9OM0KlhVjerJGX2tw4Jf9+jVBYXGXvlM2fSeKNnFYq3hHX9ahf/dc9oFtdYc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565713268531367.1998821017563; Tue, 13 Aug 2019 09:21:08 -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 306AC769EA; Tue, 13 Aug 2019 16:21:07 +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 04C201000329; Tue, 13 Aug 2019 16:21:07 +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 BE65BE207; Tue, 13 Aug 2019 16:21:06 +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 x7DGL5di012267 for ; Tue, 13 Aug 2019 12:21:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 557743480D; Tue, 13 Aug 2019 16:21:05 +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 4F7C33480B for ; Tue, 13 Aug 2019 16:21:02 +0000 (UTC) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F4F9306E171 for ; Tue, 13 Aug 2019 16:21:01 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id b16so11597482wrq.9 for ; Tue, 13 Aug 2019 09:21:01 -0700 (PDT) Received: from archlap.localdomain ([185.32.231.210]) by smtp.gmail.com with ESMTPSA id f192sm1402686wmg.30.2019.08.13.09.20.58 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 13 Aug 2019 09:20:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ACuFCOAb/Pp0bX50DKQ2juXgjJQIZ1kBvzFPDr1SOJU=; b=qQUkfBSduc+9/CRbJ3k0/j+jSNV/0H8zb0qynCd2fM5mxvHJAVAMJWWPNJceh0IZhU UGePz5OijtXE+EgdAQg6gH0sf3RSzuZaVuArxotlQ20bQaPFmUC1qeiZdw021iM1vCzj z2zsfW1qhJi4+wgHyhYNuLSaXrdSQ+NW8JtE/kmql2tRErNvEIQkB+UclKXlqs92ZWNS kDjcUYKDocSwrK0KYp4IOZKxdoegyV4fdple5RPLJU5YBpm74M3Z341KjUFbECKr3n0x qR4DbNgUA4Ianvmr8JuGwdVrzsyrUDWsBqErPvLwM3/LZr6QQCAJFeKdr/4gH8NOX/ZH iR1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ACuFCOAb/Pp0bX50DKQ2juXgjJQIZ1kBvzFPDr1SOJU=; b=cqWwlf4mdpCv1n7npzqWLu9EI8XUWFe5+a1EC7egc+oTiucDu48EHMnZijuJwt5hFi Dd9tF9xsY+1MUiV8HAjCw8qNY44S5Nrb02sgfmmOSJONbywTe4KtgjYalAbgXoAvFQ1D plDaeF3vTDu1WN3QD3DAPgrVwvWZewfwqzOcfAIO4EgK7uLVn0U+5VObphp/iDHJE7MY mdbgV5Rxph6PwYmduGsk+ToZKuO65jxf7PdHbXpaeU4tb2mQCSAXvcyLDF+YLkl9mcTf FcuAZppWHwXQuNncduDmh0NE8gQvP/sj92tXgDRisy6Ah86UcyPUaoyFXxsEOfE2i87t eoPw== X-Gm-Message-State: APjAAAUZ8AG5gcJM/5ieEdEn206DlUc2TDXPpy27XsP1VBPi5asU+LT/ V4gvf/D+KNx5y5AFjostqwqU8/hqOq4= X-Google-Smtp-Source: APXvYqyflMaL6J1emCOMtrJvoZfz+UPbqo77G/y8hrQ+GWPSyyHs2WIKaUibYytch5/ifusgsA4FbQ== X-Received: by 2002:adf:f386:: with SMTP id m6mr44473379wro.313.1565713259731; Tue, 13 Aug 2019 09:20:59 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Tue, 13 Aug 2019 19:20:00 +0300 Message-Id: <20190813162000.20788-3-stamatis.iliass@gmail.com> In-Reply-To: <20190813162000.20788-1-stamatis.iliass@gmail.com> References: <20190813162000.20788-1-stamatis.iliass@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 13 Aug 2019 16:21:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 13 Aug 2019 16:21:01 +0000 (UTC) for IP:'209.85.221.67' DOMAIN:'mail-wr1-f67.google.com' HELO:'mail-wr1-f67.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.505 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.221.67 mail-wr1-f67.google.com 209.85.221.67 mail-wr1-f67.google.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 2/2] test_driver: implement virDomainPMWakeup 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-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.27]); Tue, 13 Aug 2019 16:21:07 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ilias Stamatis Reviewed-by: Daniel Henrique Barboza --- src/test/test_driver.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index d21a69c7ed..b2a9baf361 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4168,6 +4168,42 @@ testDomainPMSuspendForDuration(virDomainPtr dom, } +static int +testDomainPMWakeup(virDomainPtr dom, + unsigned int flags) +{ + virDomainObjPtr vm; + virObjectEventPtr event =3D NULL; + testDriverPtr privconn =3D dom->conn->privateData; + int ret =3D -1; + + virCheckFlags(0, -1); + + if (!(vm =3D testDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainObjCheckActive(vm) < 0) + goto cleanup; + + if (virDomainObjGetState(vm, NULL) !=3D VIR_DOMAIN_PMSUSPENDED) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Unable to wake up: guest is not in suspended sta= te")); + goto cleanup; + } + + virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_WAKEUP= ); + + event =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_START= ED, + VIR_DOMAIN_EVENT_STARTED_WAK= EUP); + + ret =3D 0; + cleanup: + virDomainObjEndAPI(&vm); + virObjectEventStateQueue(privconn->eventState, event); + return ret; +} + + #define TEST_TOTAL_CPUTIME 48772617035LL static int @@ -9494,6 +9530,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainGetMetadata =3D testDomainGetMetadata, /* 1.1.3 */ .domainSetMetadata =3D testDomainSetMetadata, /* 1.1.3 */ .domainPMSuspendForDuration =3D testDomainPMSuspendForDuration, /* 5.7= .0 */ + .domainPMWakeup =3D testDomainPMWakeup, /* 5.7.0 */ .domainGetCPUStats =3D testDomainGetCPUStats, /* 5.6.0 */ .domainSendProcessSignal =3D testDomainSendProcessSignal, /* 5.5.0 */ .connectGetCPUModelNames =3D testConnectGetCPUModelNames, /* 1.1.3 */ -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list