From 4a6ee53581b3735a6231b52148eef07028a3fdd1 Mon Sep 17 00:00:00 2001 From: Ilias Stamatis Date: Tue, 4 Jun 2019 15:17:43 +0200 Subject: [PATCH] test_driver: implement virDomainSendProcessSignal Only succeed when @pid_value is 1, since according to the docs this is the minimum requirement for any driver to implement this API. Since this is test driver, we assume that any signal from the supported list can be sent to pid 1 and we therefore succeed every time. Signed-off-by: Ilias Stamatis Reviewed-by: Erik Skultety --- src/test/test_driver.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) mode change 100644 => 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 8ef843b203..b95aaf41ca --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2954,6 +2954,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 = -1; + virDomainObjPtr vm = NULL; + + virCheckFlags(0, -1); + + if (pid_value != 1) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("only sending a signal to pid 1 is supported")); + return -1; + } + + if (signum >= VIR_DOMAIN_PROCESS_SIGNAL_LAST) { + virReportError(VIR_ERR_INVALID_ARG, + _("signum value %d is out of range"), + signum); + return -1; + } + + if (!(vm = testDomObjFromDomain(dom))) + goto cleanup; + + /* do nothing */ + ret = 0; + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} static int testNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *freemems, @@ -7199,6 +7233,7 @@ static virHypervisorDriver testHypervisorDriver = { .domainSendKey = testDomainSendKey, /* 5.5.0 */ .domainGetMetadata = testDomainGetMetadata, /* 1.1.3 */ .domainSetMetadata = testDomainSetMetadata, /* 1.1.3 */ + .domainSendProcessSignal = testDomainSendProcessSignal, /* 5.5.0 */ .connectGetCPUModelNames = testConnectGetCPUModelNames, /* 1.1.3 */ .domainManagedSave = testDomainManagedSave, /* 1.1.4 */ .domainHasManagedSaveImage = testDomainHasManagedSaveImage, /* 1.1.4 */