From nobody Thu May 2 12:27: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; 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=1564739485; cv=none; d=zoho.com; s=zohoarc; b=ahXv94VN+WHa518CYt38jKYGffoyeRaxcVxXZh+f+O4i6le4nphLwbKCDaTM0OH4ipSHpnR0FFHRlKmjXhr3Nj9T4KY+Q1kM/F/oBhjnMXTlndeor9V2fS4EbfL5HeVhN6C6Bz7hvTbG1wFAq2AAN27ruCR3f1XFE/mQnFaNFfU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564739485; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=bUJBHuN+G078quaIUiCk1SNfppsEqg02dnmA1O0iw7I=; b=NxhayAZf6VZgvAu+dQUAT/FyLmFGksgBFvNnihZ4/TZKFdosJ8gzHQvUKshF9y9zU2Xn2i/RVNUoPvSf2BAnVYtCWoz8bADQr4gFEe73ePODpmrzX18+ETkdjBo4IfLr3y79wkRixTaJDOUM4tyaxWnWoRqCZjMtGU7jvxIxnAk= 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 15647394859891014.8423556791951; Fri, 2 Aug 2019 02:51:25 -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 0BEC0307D84B; Fri, 2 Aug 2019 09:51:24 +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 ECD525C207; Fri, 2 Aug 2019 09:51:22 +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 48FF241F53; Fri, 2 Aug 2019 09:51:19 +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 x729pHtp023335 for ; Fri, 2 Aug 2019 05:51:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 95FFA600D1; Fri, 2 Aug 2019 09:51:17 +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 8ECFB600C8 for ; Fri, 2 Aug 2019 09:51:14 +0000 (UTC) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) (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 3656D308FBA9 for ; Fri, 2 Aug 2019 09:51:13 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id l2so65703886wmg.0 for ; Fri, 02 Aug 2019 02:51:13 -0700 (PDT) Received: from archpc.localdomain (x8d1ee222.agdsn.tu-dresden.de. [141.30.226.34]) by smtp.gmail.com with ESMTPSA id c78sm103301875wmd.16.2019.08.02.02.51.10 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 02 Aug 2019 02:51:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=7ky+3h1fGz00TAt9+8o43QypfpziyxJDGhvyykIBmL8=; b=JL0tEOD7q55prH9Ypq4C0mrw7JWFpr2rDWPljAzDlA3zaNFLlZj42FRpIeEpAfHx6o wCV+X0nflszPKu0Y+E0EcRB7GVAqiMHPB765PzTShxwOOblFs4iXGYomr6ZqF4xmlenQ /TqbuRTFuqbYXb+hiPtaTfgBfLJiqCo44a+p+jS4J+zlwQluRWqF9gf7cmeNtSnszOhP AuDkoPcfXp49tK6MjG/kkYrWIGzq0nOgE7FjCyk9KBDBgwjD0rEnYlB6dYLw3G+GYPMj jzrNxYUQzEW0Dn1Mh3Zk4oe9pr9m88YKnKz6+zJjB2E299ue54ElYsyFrAqVNkmmu+i1 gjdQ== 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:mime-version :content-transfer-encoding; bh=7ky+3h1fGz00TAt9+8o43QypfpziyxJDGhvyykIBmL8=; b=PzB+9KPydUe2Qg+aKt4cZoN5RFUMJ6bNVjSHkZc90g3+2feGsyFTHkCCwIfotLXaHV wbm7bUYE0zoyfNuvp4mnD994RFj0HULBM09UphYSFV2DlKBXE4Pj2ufkPVKD/ETy8UcQ RSmovSKeO3nIGx4xGmrnfCHjbXzKSpB1v/mhBPELabC5nOd8D22fGtsVWPTnQs78efOj 6Svt/Ozhcfte0lRP+WsoAEehIH3Vo03DMSbWlJ3nHT950o0C6uJoFkc0rmljn1F7F91P NZWCFLOtjUIz8/3+QsmhQtoeczf0aA95uPZflP5lGuqqkBqPrnMqGn0zW/fgpG94RRwF L3Iw== X-Gm-Message-State: APjAAAVCpQa19/s+Bfk+PT//5LG/cf95ClV76wpDuJwE+iLWZmUi4D8j IsMRs7EIffEF6nALQq/jiOaImhS/cZUfxA== X-Google-Smtp-Source: APXvYqyGumyqctdEO3wa0uIjxKA5sfDirH7bCRMfFuVmDsMB/PlKxoE05GgCTtQal3sS6SWEjT06bw== X-Received: by 2002:a1c:1f4e:: with SMTP id f75mr3641218wmf.137.1564739471485; Fri, 02 Aug 2019 02:51:11 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Fri, 2 Aug 2019 11:51:05 +0200 Message-Id: <20190802095105.18190-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.43]); Fri, 02 Aug 2019 09:51:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 02 Aug 2019 09:51:13 +0000 (UTC) for IP:'209.85.128.68' DOMAIN:'mail-wm1-f68.google.com' HELO:'mail-wm1-f68.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.1 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.128.68 mail-wm1-f68.google.com 209.85.128.68 mail-wm1-f68.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] test_driver: implement virDomainSetLifecycleAction 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 02 Aug 2019 09:51:24 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ilias Stamatis --- src/test/test_driver.c | 58 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index aae9875194..71d6baa3da 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -7404,6 +7404,63 @@ testDomainMemoryPeek(virDomainPtr dom, } +static void +testDomainModifyLifecycleAction(virDomainDefPtr def, + virDomainLifecycle type, + virDomainLifecycleAction action) +{ + switch (type) { + case VIR_DOMAIN_LIFECYCLE_POWEROFF: + def->onPoweroff =3D action; + break; + case VIR_DOMAIN_LIFECYCLE_REBOOT: + def->onReboot =3D action; + break; + case VIR_DOMAIN_LIFECYCLE_CRASH: + def->onCrash =3D action; + break; + case VIR_DOMAIN_LIFECYCLE_LAST: + break; + } +} + + +static int +testDomainSetLifecycleAction(virDomainPtr dom, + unsigned int type, + unsigned int action, + unsigned int flags) +{ + virDomainObjPtr vm =3D NULL; + virDomainDefPtr def =3D NULL; + virDomainDefPtr persistentDef =3D NULL; + int ret =3D -1; + + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + + if (!virDomainDefLifecycleActionAllowed(type, action)) + return -1; + + if (!(vm =3D testDomObjFromDomain(dom))) + return -1; + + if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) + goto cleanup; + + if (def) + testDomainModifyLifecycleAction(def, type, action); + + if (persistentDef) + testDomainModifyLifecycleAction(persistentDef, type, action); + + ret =3D 0; + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + + /* * Snapshot APIs */ @@ -8698,6 +8755,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainHasManagedSaveImage =3D testDomainHasManagedSaveImage, /* 1.1.4= */ .domainManagedSaveRemove =3D testDomainManagedSaveRemove, /* 1.1.4 */ .domainMemoryPeek =3D testDomainMemoryPeek, /* 5.4.0 */ + .domainSetLifecycleAction =3D testDomainSetLifecycleAction, /* 5.7.0 */ .domainSnapshotNum =3D testDomainSnapshotNum, /* 1.1.4 */ .domainSnapshotListNames =3D testDomainSnapshotListNames, /* 1.1.4 */ -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list