[libvirt] [PATCH] qemu: Don't fail to reboot domains with unresponsive agent
by zhang bo
just as what b8e25c35d7f80a2fadc0e51e95318e39db3d1687 did,
we fall back to the ACPI method when the guest agent is unresponsive in qemuDomainReboot.
Signed-off-by: YueWenyuan <yuewenyuan(a)huawei.com>
Signed-off-by: Zhang Bo <oscar.zhangbo(a)huawei.com>
---
src/qemu/qemu_driver.c | 67 +++++++++++++++++++++++++-------------------------
1 file changed, 34 insertions(+), 33 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6fc9696..964a9c5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2002,21 +2002,14 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
virDomainObjPtr vm;
int ret = -1;
qemuDomainObjPrivatePtr priv;
- bool useAgent = false;
+ bool useAgent = false, agentRequested, acpiRequested;
bool isReboot = true;
+ bool agentForced;
int agentFlag = QEMU_AGENT_SHUTDOWN_REBOOT;
virCheckFlags(VIR_DOMAIN_REBOOT_ACPI_POWER_BTN |
VIR_DOMAIN_REBOOT_GUEST_AGENT, -1);
- /* At most one of these two flags should be set. */
- if ((flags & VIR_DOMAIN_REBOOT_ACPI_POWER_BTN) &&
- (flags & VIR_DOMAIN_REBOOT_GUEST_AGENT)) {
- virReportInvalidArg(flags, "%s",
- _("flags for acpi power button and guest agent are mutually exclusive"));
- return -1;
- }
-
if (!(vm = qemuDomObjFromDomain(dom)))
goto cleanup;
@@ -2028,38 +2021,25 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
}
priv = vm->privateData;
+ agentRequested = flags & VIR_DOMAIN_REBOOT_GUEST_AGENT;
+ acpiRequested = flags & VIR_DOMAIN_REBOOT_ACPI_POWER_BTN;
if (virDomainRebootEnsureACL(dom->conn, vm->def, flags) < 0)
goto cleanup;
- if ((flags & VIR_DOMAIN_REBOOT_GUEST_AGENT) ||
- (!(flags & VIR_DOMAIN_REBOOT_ACPI_POWER_BTN) &&
- priv->agent))
+ /* Prefer agent unless we were requested to not to. */
+ if (agentRequested || (!flags && priv->agent))
useAgent = true;
- if (!useAgent) {
-#if WITH_YAJL
- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON)) {
- if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Reboot is not supported with this QEMU binary"));
- goto cleanup;
- }
- } else {
-#endif
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("Reboot is not supported without the JSON monitor"));
- goto cleanup;
-#if WITH_YAJL
- }
-#endif
- }
-
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup;
- if (useAgent && !qemuDomainAgentAvailable(vm, true))
- goto endjob;
+ agentForced = agentRequested && !acpiRequested;
+ if (useAgent && !qemuDomainAgentAvailable(vm, true)) {
+ if (agentForced)
+ goto endjob;
+ useAgent = false;
+ }
if (!virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_OPERATION_INVALID,
@@ -2071,7 +2051,28 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
qemuDomainObjEnterAgent(vm);
ret = qemuAgentShutdown(priv->agent, agentFlag);
qemuDomainObjExitAgent(vm);
- } else {
+ }
+
+ /* If we are not enforced to use just an agent, try ACPI
+ * shutdown as well in case agent did not succeed.
+ */
+ if ((!useAgent) ||
+ (ret < 0 && (acpiRequested || !flags))) {
+#if WITH_YAJL
+ if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON)) {
+ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("ACPI reboot is not supported with this QEMU binary"));
+ goto endjob;
+ }
+ } else {
+#endif
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("ACPI reboot is not supported without the JSON monitor"));
+ goto endjob;
+#if WITH_YAJL
+ }
+#endif
qemuDomainObjEnterMonitor(driver, vm);
ret = qemuMonitorSystemPowerdown(priv->mon);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
--
1.7.12.4
9 years, 8 months
[libvirt] [PATCH] bhyve: fix build in tests
by Roman Bogorodskiy
Commit 835cf84 dropped expectedVirtTypes argument for
virDomainDefParse*() functions, however bhyve tests still try to pass
that to virDomainDefParseFile(), therefore build fails.
Fix build by fixing virDomainDefParseFile() usage.
---
tests/bhyvexml2argvtest.c | 1 -
tests/bhyvexml2xmltest.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
index c5b0681..26d0075 100644
--- a/tests/bhyvexml2argvtest.c
+++ b/tests/bhyvexml2argvtest.c
@@ -32,7 +32,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
goto out;
if (!(vmdef = virDomainDefParseFile(xml, driver.caps, driver.xmlopt,
- 1 << VIR_DOMAIN_VIRT_BHYVE,
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
goto out;
diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c
index a1a3701..2e742cf 100644
--- a/tests/bhyvexml2xmltest.c
+++ b/tests/bhyvexml2xmltest.c
@@ -27,7 +27,6 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
goto fail;
if (!(def = virDomainDefParseString(inXmlData, driver.caps, driver.xmlopt,
- 1 << VIR_DOMAIN_VIRT_BHYVE,
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
goto fail;
--
2.3.5
9 years, 8 months
[libvirt] [PATCH] configure: Report --with-loader-nvram value in summary
by Cole Robinson
---
configure.ac | 1 +
1 file changed, 1 insertion(+)
diff --git a/configure.ac b/configure.ac
index 7f6fd7c..d5fb71d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2980,6 +2980,7 @@ AC_MSG_NOTICE([ XML Catalog: $XML_CATALOG_FILE])
AC_MSG_NOTICE([ Init script: $with_init_script])
AC_MSG_NOTICE([Char device locks: $with_chrdev_lock_files])
AC_MSG_NOTICE([ Default Editor: $DEFAULT_EDITOR])
+AC_MSG_NOTICE([ Loader/NVRAM: $with_loader_nvram])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Developer Tools])
AC_MSG_NOTICE([])
--
2.3.5
9 years, 8 months
[libvirt] [PATCH V2 0/2] Support libvirt's lock manager in the libxl driver
by Jim Fehlig
V2 of
https://www.redhat.com/archives/libvir-list/2015-April/msg00845.html
Patch 2 has been ACKed and pushed since it is independent of the
lock manager integration. Patch 1 has been changed to address
Daniel's comments. Patch 2 (was patch 3 in V1) is unchanged for
the time being.
Jim Fehlig (2):
locking: relax PID requirement
libxl: provide integration with lock manager
src/Makefile.am | 12 +++++++++
src/libxl/libvirtd_libxl.aug | 2 ++
src/libxl/libxl.conf | 10 ++++++++
src/libxl/libxl_conf.c | 14 +++++++++++
src/libxl/libxl_conf.h | 6 +++++
src/libxl/libxl_domain.c | 47 ++++++++++++++++++++++++++++++++++--
src/libxl/libxl_domain.h | 1 +
src/libxl/libxl_driver.c | 25 +++++++++++++++++++
src/libxl/libxl_migration.c | 6 +++++
src/libxl/test_libvirtd_libxl.aug.in | 1 +
src/locking/lock_daemon.c | 2 +-
src/locking/lock_daemon_dispatch.c | 16 ++++++------
src/locking/lock_driver_lockd.c | 7 ++----
13 files changed, 133 insertions(+), 16 deletions(-)
--
1.8.4.5
9 years, 8 months
[libvirt] [PATCH] spec: Fix libxl build with driver modules
by Cole Robinson
---
Pushed as build breaker
libvirt.spec.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 5d8a9d4..c5c6608 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -2127,6 +2127,9 @@ exit 0
%if %{with_libxl}
%files daemon-driver-libxl
%defattr(-, root, root)
+%config(noreplace) %{_sysconfdir}/libvirt/libxl.conf
+%{_datadir}/augeas/lenses/libvirtd_libxl.aug
+%{_datadir}/augeas/lenses/tests/test_libvirtd_libxl.aug
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/libxl/
%ghost %dir %{_localstatedir}/run/libvirt/libxl/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/libxl/
--
2.3.5
9 years, 8 months
[libvirt] [PATCH] configure: Fix --loader-nvram typo
by Cole Robinson
---
Pushed as trivial
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index aed0934..7f6fd7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2776,7 +2776,7 @@ AC_ARG_WITH([loader-nvram],
fi
AC_DEFINE_UNQUOTED([DEFAULT_LOADER_NVRAM],
["$withval"],
- [List of laoder:nvram pairs])])
+ [List of loader:nvram pairs])])
# Some GNULIB base64 symbols clash with a kerberos library
AC_DEFINE_UNQUOTED([isbase64],[libvirt_gl_isbase64],[Hack to avoid symbol clash])
--
2.3.5
9 years, 8 months
[libvirt] [PATCH] parallels: don't forget to unlock domain after successful virDomainObjListFindByUUID call
by Maxim Nestratov
Also a typo is fixed (s/detached/attached/)
Signed-off-by: Maxim Nestratov mnestratov(a)parallels.com
---
src/parallels/parallels_driver.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 46e6c3e..41908a5 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -1081,7 +1081,7 @@ static int parallelsDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
privdom = virDomainObjListFindByUUID(privconn->domains, dom->uuid);
if (privdom == NULL) {
parallelsDomNotFoundError(dom);
- goto cleanup;
+ return -1;
}
if (!(flags & VIR_DOMAIN_AFFECT_CONFIG)) {
@@ -1120,13 +1120,14 @@ static int parallelsDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
break;
default:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
- _("device type '%s' cannot be detached"),
+ _("device type '%s' cannot be attached"),
virDomainDeviceTypeToString(dev->type));
break;
}
ret = 0;
cleanup:
+ virObjectUnlock(privdom);
return ret;
}
--
1.7.1
9 years, 8 months
[libvirt] [PATCH 0/3] Support libvirt's lock manager in the libxl driver
by Jim Fehlig
Patch 1 relaxes the requirement of PID != 0 in the locking code.
danpb and I discussed this on IRC:
danpb: jimfehlig: it wouldn't be the end of the world if
you leave pid as 0
danpb: jimfehlig: it'd just loose some safety sanity check
in that scenario
Patch 2 introduces a config file for the libxl driver, with the lone
config entry 'autoballoon'. I thought this would make review easier,
vs adding all the config file support in patch 3, which is fairly
large as is.
Jim Fehlig (3):
locking: relax PID requirement
libxl: Introduce configuration file for libxl driver
libxl: provide integration with lock manager
libvirt.spec.in | 8 ++++
src/Makefile.am | 36 ++++++++++++++++-
src/libxl/libvirtd_libxl.aug | 44 +++++++++++++++++++++
src/libxl/libxl.conf | 22 +++++++++++
src/libxl/libxl_conf.c | 75 +++++++++++++++++++++++++++++++++---
src/libxl/libxl_conf.h | 11 ++++++
src/libxl/libxl_domain.c | 47 +++++++++++++++++++++-
src/libxl/libxl_domain.h | 1 +
src/libxl/libxl_driver.c | 34 ++++++++++++++++
src/libxl/libxl_migration.c | 6 +++
src/libxl/test_libvirtd_libxl.aug.in | 6 +++
src/locking/lock_daemon.c | 2 +-
src/locking/lock_daemon_dispatch.c | 49 +++++++----------------
src/locking/lock_driver_lockd.c | 7 +---
14 files changed, 298 insertions(+), 50 deletions(-)
create mode 100644 src/libxl/libvirtd_libxl.aug
create mode 100644 src/libxl/libxl.conf
create mode 100644 src/libxl/test_libvirtd_libxl.aug.in
--
1.8.4.5
9 years, 8 months
[libvirt] [PATCH 0/2] Add tox.ini to run tests with tox
by Victor Stinner
Tox is a convinient tool creating virtual environment to install
dependencies and run tests. To run all tests, just type "tox". To only
test a specific Python version, use "tox -e py34" (Python 3.4).
Victor Stinner (2):
sanitytest.py parameters are now optional
Add tox.ini to run tests on Python 2.6, 2.7 & 3.4
.gitignore | 1 +
sanitytest.py | 23 ++++++++++++++++++-----
tox.ini | 10 ++++++++++
3 files changed, 29 insertions(+), 5 deletions(-)
create mode 100644 tox.ini
--
2.1.0
9 years, 8 months
[libvirt] [PATCH v2] libvirt-python: add classifiers to setup.py
by Victor Stinner
Add the Python 3 classifier, needed by the caniusepython3 tool to check
if dependencies of a projects are Python 3 compatible:
https://caniusepython3.com/
---
setup.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index 79b048f..a8e9e86 100755
--- a/setup.py
+++ b/setup.py
@@ -325,4 +325,13 @@ setup(name = 'libvirt-python',
'sdist': my_sdist,
'rpm': my_rpm,
'test': my_test
- })
+ },
+ classifiers = [
+ "Development Status :: 5 - Production/Stable",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 2",
+ "Programming Language :: Python :: 3",
+ ]
+)
--
2.1.0
9 years, 8 months