#define CHANGE_MEDIA_TIMEOUT 5000
+/* Timeout in miliseconds for device removal. PPC64 domains
+ * can experience a bigger delay in unplug operations during
+ * heavy guest activity (vcpu being the most notable case), thus
+ * the timeout for PPC64 is also bigger. */
+#define QEMU_UNPLUG_TIMEOUT 1000ull * 5
+#define QEMU_UNPLUG_TIMEOUT_PPC64 1000ull * 10
+
/* Wait up to 5 seconds for device removal to finish. */
unsigned long long qemuDomainRemoveDeviceWaitTime = 1000ull * 5;
priv->unplug.eventSeen = false;
}
+
+unsigned long long
+qemuDomainGetUnplugTimeout(virDomainObjPtr vm)
+{
+ if (qemuDomainIsPSeries(vm->def))
+ return QEMU_UNPLUG_TIMEOUT_PPC64;
+
+ return QEMU_UNPLUG_TIMEOUT;
+}
+
+
/* Returns:
* -1 Unplug of the device failed
*
if (virTimeMillisNow(&until) < 0)
return 1;
- until += qemuDomainRemoveDeviceWaitTime;
+ until += qemuDomainGetUnplugTimeout(vm);
while (priv->unplug.alias) {
if ((rc = virDomainObjWaitUntil(vm, until)) == 1)
virDomainObjPtr vm,
const char *id,
qemuDomainAsyncJob asyncJob);
+
+unsigned long long qemuDomainGetUnplugTimeout(virDomainObjPtr vm);
libvirhostcpumock.la \
libdomaincapsmock.la \
libvirfilecachemock.la \
+ libqemuhotplugmock.la \
$(NULL)
if WITH_REMOTE
libqemucpumock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
libqemucpumock_la_LIBADD = $(MOCKLIBS_LIBS)
+libqemuhotplugmock_la_SOURCES = \
+ qemuhotplugmock.c
+libqemuhotplugmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libqemuhotplugmock_la_LIBADD = $(MOCKLIBS_LIBS)
+
qemuxml2argvtest_SOURCES = \
qemuxml2argvtest.c testutilsqemu.c testutilsqemu.h \
testutils.c testutils.h \
testutils.c testutils.h \
testutilsqemu.c testutilsqemu.h \
$(NULL)
-qemuhotplugtest_LDADD = libqemumonitortestutils.la $(qemu_LDADDS)
+qemuhotplugtest_LDADD = \
+ libqemutestdriver.la \
+ libqemumonitortestutils.la \
+ $(qemu_LDADDS) \
+ $(NULL)
qemublocktest_SOURCES = \
qemublocktest.c \
qemusecuritymock.c \
qemufirmwaretest.c \
qemuvhostusertest.c \
+ qemuhotplugmock.c \
$(QEMUMONITORTESTUTILS_SOURCES)
endif ! WITH_QEMU
--- /dev/null
+/*
+ * Copyright (C) 2019 IBM Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+
+#include "qemu/qemu_hotplug.h"
+#include "conf/domain_conf.h"
+
+unsigned long long
+qemuDomainGetUnplugTimeout(virDomainObjPtr vm G_GNUC_UNUSED)
+{
+ /* Wait only 100ms for DEVICE_DELETED event. Give a greater
+ * timeout in case of PSeries guest to be consistent with the
+ * original logic. */
+ if (qemuDomainIsPSeries(vm->def))
+ return 200;
+ return 100;
+}
VIR_TEST_MAIN_PRELOAD(mymain,
VIR_TEST_MOCK("virpci"),
- VIR_TEST_MOCK("virprocess"));
+ VIR_TEST_MOCK("virprocess"),
+ VIR_TEST_MOCK("qemuhotplug"));