tests: Move domainEventState initialization to qemuTestDriverInit

Under the test environment, driver->domainEventState is uninitialized. If a
disk gets dropped, it will attempt to queue an event which will cause a
segmentation fault. This crash does not occur during normal use.

This patch moves driver->domainEventState initialization from qemuhotplugtest
to qemuTestDriverInit in testutilsqemu (Credit goes to Michal Privoznik as he
had already provided the diff).

An additional test case is added to test dropping of disks with startupPolicy
set as optional.

Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Rayhan Faizel
2024-07-04 03:10:13 +05:30
committed by Michal Privoznik
parent f67b12ba35
commit d666426718
6 changed files with 99 additions and 3 deletions

View File

@@ -501,9 +501,6 @@ mymain(void)
virEventRegisterDefaultImpl();
if (!(driver.domainEventState = virObjectEventStateNew()))
return EXIT_FAILURE;
driver.lockManager = virLockManagerPluginNew("nop", "qemu",
driver.config->configBaseDir,
0);