mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
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 <stamatis.iliass@gmail.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
fbed24210e
commit
4a6ee53581
35
src/test/test_driver.c
Normal file → Executable file
35
src/test/test_driver.c
Normal file → Executable file
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user