From nobody Sat Apr 20 06:20:12 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=1559654358; cv=none; d=zoho.com; s=zohoarc; b=FmXaGtJV62ZWzd6EwLiqsfd4rFlG4wcUkR4VXBZQo9cjcUUNO9O7+JCFo2c468m3oA1wV31bTGuaKsSUgLBM78RAdb8HfR7fZMzte47T0hFsQZIIlE8ghG1qblMLxU2CBjUheBfiqQ8jmtljH5WIc2NmypRVmlg/RFF0XUEBgdA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559654358; 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=HPIeG4Zia6r5SUcHOuTJ8j4sY4HHMgttM5i7ZGoT87s=; b=V+CDMA4AIx3cNxyXd0Xj94yjMdI4A4eNbxCW6sew8MrkqqYr6OKwukm2JGlgU6cGYAwct+tcXzXKh/LKYy8XAnUDv9SKtBHfwHCdW7ppI9UzqPT/ffARS9ibCSXLM+iHcVpULUc+kVl39Okmgexo0EJSG6TRzMWT9oygwGnX1B8= 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 1559654358518237.63079507692237; Tue, 4 Jun 2019 06:19:18 -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 C7FE1C0828B6; Tue, 4 Jun 2019 13:18:49 +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 0F0A460C91; Tue, 4 Jun 2019 13:18: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 5396E206D2; Tue, 4 Jun 2019 13:18:31 +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 x54DIUcs003260 for ; Tue, 4 Jun 2019 09:18:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id ADF3D19C69; Tue, 4 Jun 2019 13:18:30 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A827E2BE79 for ; Tue, 4 Jun 2019 13:18:28 +0000 (UTC) Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.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 9CAE53091D55 for ; Tue, 4 Jun 2019 13:18:12 +0000 (UTC) Received: by mail-ed1-f68.google.com with SMTP id y17so478517edr.0 for ; Tue, 04 Jun 2019 06:18:12 -0700 (PDT) Received: from archpc.localdomain (x8d1ee222.agdsn.tu-dresden.de. [141.30.226.34]) by smtp.gmail.com with ESMTPSA id m6sm291864ede.2.2019.06.04.06.18.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jun 2019 06:18:09 -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=XQtXhOfCtz5qbZVJcCKxvTURsOXAmHeeFY6lgZzZh08=; b=hHTRIfpCRmuz4DVCHoHcElUemCZ4bJfsuy51pok3l8n+ds0e/Jbl6cPJ8hrcxk0JZK +cofPjf46f87NvE4e4+D+Qyc6CZyeHXtB5x0Lv10J1JIbVp/0vav1dbfSwWKRxvaiHYG ZBoi+cNrkn50TM7IzZvGIq7scNtiEiL2d62rk5fW4bn9RAeGUDCzp/mQHtxGoSAZ8q8F m/h7uhOZfjCkOXFbX6kXSZLZLuyOYHNOXTv9UC7UyrC/ewnn/hH2oPA4RWeU8xti02bj YPQ6ggdP3D83bkqEXKlqDhtcCmJ6OCqMKlcpVfX9y4q5PiyvOPKwfVE/FeA5f7CPIRkM XW+Q== 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=XQtXhOfCtz5qbZVJcCKxvTURsOXAmHeeFY6lgZzZh08=; b=f2xX5cbCKIQNeEt3+3oKRTIYsimnuFc1LdSY09g0RFVi2vJAlC5hA0tp1//ToKU6Vg Rrl3a+ZmwamiwSh6NVEA6ojuEeIZ6xpoQEIdJQQL3KKMe+oFU5aNn28nbTfOFvo9TIVD aZGuw1ScPQX3xs8J/ebL+5dyd0Q+urAGhaMbFROVmyuSc3BsVbI8QYfUR0BuZy/ut3Vt 3ZVhADUBqb2CPBXGZqmoV9O7sApMYvNavkPUcH6dtKLIKofv+VeiEmJE1tS7JJrr2BrN 92tZDfXP6Q38NMrtzYLOUGMdnPyh0vN/oY9cVXYD06ktPcwRMIxdyHlLPkznsPJ1L31G Bd6g== X-Gm-Message-State: APjAAAU4qEn6xaI75i2WG4E+TOaHMENjNFoSzxdHIa7wnYX+stJEDJGa Gh7pdeezbGXVfqN7fMd/ZnK8SYQu/8s= X-Google-Smtp-Source: APXvYqxOGxYBlZuAeu6VEh1f21PyrYtt/x54e7IJdNgAlu5dudEKlpUzrGcuQh0kl8095/IKJYOyqA== X-Received: by 2002:a17:906:f84c:: with SMTP id ks12mr29225021ejb.270.1559654290878; Tue, 04 Jun 2019 06:18:10 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Tue, 4 Jun 2019 15:17:43 +0200 Message-Id: <20190604131743.17204-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.42]); Tue, 04 Jun 2019 13:18:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 04 Jun 2019 13:18:12 +0000 (UTC) for IP:'209.85.208.68' DOMAIN:'mail-ed1-f68.google.com' HELO:'mail-ed1-f68.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.109 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 209.85.208.68 mail-ed1-f68.google.com 209.85.208.68 mail-ed1-f68.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] test_driver: implement virDomainSendProcessSignal 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 04 Jun 2019 13:19:11 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Only succeed when @pid_value is 1, since according to the docs this is the minimum requirement for any driver to implement this API. >From man 2 kill: The only signals that can be sent to process ID 1, the init process, are those for which init has explicitly installed signal handlers. Regarding sending SIGTERM and SIGKILL to init, the test driver domains pretend to run Linux, and on Linux init/systemd explicitly ignores these signals. Correspondingly, we can assume that no signal handlers are installed for any other signal and succeed by doing nothing. Signed-off-by: Ilias Stamatis Reviewed-by: Erik Skultety --- Alternatively, we could succeed when @pid_value is any number or belongs to a set of specific numbers. src/test/test_driver.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) mode change 100644 =3D> 100755 src/test/test_driver.c diff --git a/src/test/test_driver.c b/src/test/test_driver.c old mode 100644 new mode 100755 index cae2521b21..490a605a77 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2825,6 +2825,40 @@ static int testDomainSetMetadata(virDomainPtr dom, return ret; } +static int +testDomainSendProcessSignal(virDomainPtr dom, + long long pid_value, + unsigned int signum, + unsigned int flags) +{ + int ret =3D -1; + virDomainObjPtr vm =3D NULL; + + virCheckFlags(0, -1); + + if (pid_value !=3D 1) { + virReportError(VIR_ERR_INVALID_ARG, + _("only sending a signal to pid 1 is supported")); + return -1; + } + + if (signum >=3D VIR_DOMAIN_PROCESS_SIGNAL_LAST) { + virReportError(VIR_ERR_INVALID_ARG, + _("signum value %d is out of range"), + signum); + return -1; + } + + if (!(vm =3D testDomObjFromDomain(dom))) + goto cleanup; + + /* do nothing */ + ret =3D 0; + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} static int testNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *freemems, @@ -7027,6 +7061,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainScreenshot =3D testDomainScreenshot, /* 1.0.5 */ .domainGetMetadata =3D testDomainGetMetadata, /* 1.1.3 */ .domainSetMetadata =3D testDomainSetMetadata, /* 1.1.3 */ + .domainSendProcessSignal =3D testDomainSendProcessSignal, /* 5.5.0 */ .connectGetCPUModelNames =3D testConnectGetCPUModelNames, /* 1.1.3 */ .domainManagedSave =3D testDomainManagedSave, /* 1.1.4 */ .domainHasManagedSaveImage =3D testDomainHasManagedSaveImage, /* 1.1.4= */ -- 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list