[libvirt] [PATCH] util: implement virProcessGetStartTime on GNU/kFreeBSD
by Pino Toscano
Use the virProcessGetStartTime implementation also when only the kernel
is FreeBSD, such as on GNU/kFreeBSD.
---
src/util/virprocess.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index e6b78ef..43118f8 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -36,11 +36,11 @@
# include <sched.h>
#endif
-#if defined(__FreeBSD__) || HAVE_BSD_CPU_AFFINITY
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || HAVE_BSD_CPU_AFFINITY
# include <sys/param.h>
#endif
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# include <sys/sysctl.h>
# include <sys/user.h>
#endif
@@ -937,7 +937,7 @@ int virProcessGetStartTime(pid_t pid,
VIR_FREE(buf);
return ret;
}
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
int virProcessGetStartTime(pid_t pid,
unsigned long long *timestamp)
{
--
2.1.0
9 years
[libvirt] [PATCH] bhyve: implement domainGetOSType
by Roman Bogorodskiy
---
src/bhyve/bhyve_driver.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index d44cf2c..efba0ae 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -465,6 +465,27 @@ bhyveDomainIsPersistent(virDomainPtr domain)
}
static char *
+bhyveDomainGetOSType(virDomainPtr dom)
+{
+ virDomainObjPtr vm;
+ char *ret = NULL;
+
+ if (!(vm = bhyveDomObjFromDomain(dom)))
+ goto cleanup;
+
+ if (virDomainGetOSTypeEnsureACL(dom->conn, vm->def) < 0)
+ goto cleanup;
+
+ if (VIR_STRDUP(ret, virDomainOSTypeToString(vm->def->os.type)) < 0)
+ goto cleanup;
+
+ cleanup:
+ if (vm)
+ virObjectUnlock(vm);
+ return ret;
+}
+
+static char *
bhyveDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
{
virDomainObjPtr vm;
@@ -1487,6 +1508,7 @@ static virHypervisorDriver bhyveHypervisorDriver = {
.domainDefineXML = bhyveDomainDefineXML, /* 1.2.2 */
.domainDefineXMLFlags = bhyveDomainDefineXMLFlags, /* 1.2.12 */
.domainUndefine = bhyveDomainUndefine, /* 1.2.2 */
+ .domainGetOSType = bhyveDomainGetOSType, /* 1.2.21 */
.domainGetXMLDesc = bhyveDomainGetXMLDesc, /* 1.2.2 */
.domainIsActive = bhyveDomainIsActive, /* 1.2.2 */
.domainIsPersistent = bhyveDomainIsPersistent, /* 1.2.2 */
--
2.6.1
9 years
[libvirt] [PATCH] qemu: Resolve agent deadlock
by John Ferlan
If we have a shutdown of a VM by a qemu agent while an agent EOF occurs
at relatively the same time, it's possible that a deadlock occurs depending
on what happens first.
Assume qemuProcessHandleAgentEOF runs first, with the vm->lock it clears
priv->agent, then clears the vm->lock.
After some agent call such as qemuDomainShutdownFlags will call
qemuDomainObjExitAgent in a worker thread with the agent lock. It
will then reference the priv->agent field:
hasRefs = virObjectUnref(priv->agent);
in order to determine whether there are references. However, since
priv->agent is NULL, this returns false, so the subsquent:
if (hasRefs)
virObjectUnlock(priv->agent);
will not unlock the agent. Eventually the EOF thread will attempt
to call qemuAgentClose which will try to lock the agent, but cannot
since it's still locked.
This patch resolves this issue by keeping a copy of the priv->agent
address prior to releasing the vm->lock in qemuDomainObjEnterAgent.
Then rather than assuming priv->agent is valid, use the copy of the
agent pointer for the subsequent agent call and qemuDomainObjExitAgent.
Within qemuDomainObjExitAgent, use the agent copy in order to release
the agent lock, then get the vm->lock again and decide whether to
clear the priv->agent based on whether any references still exist.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Recent upstream patch:
http://www.redhat.com/archives/libvir-list/2015-September/msg00971.html
attempted to undo commit id '1020a504' which appears to be the wrong
approach since it would still have the vm->lock during the qemuAgentClose.
src/qemu/qemu_domain.c | 11 +++---
src/qemu/qemu_domain.h | 4 +--
src/qemu/qemu_driver.c | 90 +++++++++++++++++++++++++++++++++-----------------
3 files changed, 67 insertions(+), 38 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 890d8ed..a908df8 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1868,19 +1868,20 @@ qemuDomainObjEnterAgent(virDomainObjPtr obj)
* Should be paired with an earlier qemuDomainObjEnterAgent() call
*/
void
-qemuDomainObjExitAgent(virDomainObjPtr obj)
+qemuDomainObjExitAgent(virDomainObjPtr obj,
+ qemuAgentPtr agent)
{
qemuDomainObjPrivatePtr priv = obj->privateData;
bool hasRefs;
- hasRefs = virObjectUnref(priv->agent);
+ hasRefs = virObjectUnref(agent);
if (hasRefs)
- virObjectUnlock(priv->agent);
+ virObjectUnlock(agent);
virObjectLock(obj);
- VIR_DEBUG("Exited agent (agent=%p vm=%p name=%s)",
- priv->agent, obj, obj->def->name);
+ VIR_DEBUG("Exited agent (agent=%p vm=%p name=%s hasRefs=%d)",
+ agent, obj, obj->def->name, hasRefs);
priv->agentStart = 0;
if (!hasRefs)
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 64cd7e1..def31a9 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -296,8 +296,8 @@ int qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver,
void qemuDomainObjEnterAgent(virDomainObjPtr obj)
ATTRIBUTE_NONNULL(1);
-void qemuDomainObjExitAgent(virDomainObjPtr obj)
- ATTRIBUTE_NONNULL(1);
+void qemuDomainObjExitAgent(virDomainObjPtr obj, qemuAgentPtr agent)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
void qemuDomainObjEnterRemote(virDomainObjPtr obj)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a2cc002..b8c9ff7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1994,9 +1994,10 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
qemuDomainSetFakeReboot(driver, vm, isReboot);
if (useAgent) {
+ qemuAgentPtr agent = priv->agent;
qemuDomainObjEnterAgent(vm);
- ret = qemuAgentShutdown(priv->agent, agentFlag);
- qemuDomainObjExitAgent(vm);
+ ret = qemuAgentShutdown(agent, agentFlag);
+ qemuDomainObjExitAgent(vm, agent);
}
/* If we are not enforced to use just an agent, try ACPI
@@ -2087,9 +2088,10 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
qemuDomainSetFakeReboot(driver, vm, isReboot);
if (useAgent) {
+ qemuAgentPtr agent = priv->agent;
qemuDomainObjEnterAgent(vm);
- ret = qemuAgentShutdown(priv->agent, agentFlag);
- qemuDomainObjExitAgent(vm);
+ ret = qemuAgentShutdown(agent, agentFlag);
+ qemuDomainObjExitAgent(vm, agent);
}
/* If we are not enforced to use just an agent, try ACPI
@@ -4864,6 +4866,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
qemuAgentCPUInfoPtr cpuinfo = NULL;
int ncpuinfo;
qemuDomainObjPrivatePtr priv;
+ qemuAgentPtr agent;
size_t i;
virCgroupPtr cgroup_temp = NULL;
char *mem_mask = NULL;
@@ -4924,6 +4927,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
}
if (flags & VIR_DOMAIN_VCPU_GUEST) {
+
if (!qemuDomainAgentAvailable(vm, true))
goto endjob;
@@ -4935,19 +4939,20 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
goto endjob;
}
+ agent = priv->agent;
qemuDomainObjEnterAgent(vm);
- ncpuinfo = qemuAgentGetVCPUs(priv->agent, &cpuinfo);
- qemuDomainObjExitAgent(vm);
+ ncpuinfo = qemuAgentGetVCPUs(agent, &cpuinfo);
+ qemuDomainObjExitAgent(vm, agent);
- if (ncpuinfo < 0)
+ if (ncpuinfo < 0 || agent != priv->agent)
goto endjob;
if (qemuAgentUpdateCPUInfo(nvcpus, cpuinfo, ncpuinfo) < 0)
goto endjob;
qemuDomainObjEnterAgent(vm);
- ret = qemuAgentSetVCPUs(priv->agent, cpuinfo, ncpuinfo);
- qemuDomainObjExitAgent(vm);
+ ret = qemuAgentSetVCPUs(agent, cpuinfo, ncpuinfo);
+ qemuDomainObjExitAgent(vm, agent);
if (ret < 0)
goto endjob;
@@ -5515,6 +5520,8 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
goto cleanup;
if (flags & VIR_DOMAIN_VCPU_GUEST) {
+ qemuAgentPtr agent;
+
if (!virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("vCPU count provided by the guest agent can only be "
@@ -5534,9 +5541,10 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
goto endjob;
}
+ agent = priv->agent;
qemuDomainObjEnterAgent(vm);
- ncpuinfo = qemuAgentGetVCPUs(priv->agent, &cpuinfo);
- qemuDomainObjExitAgent(vm);
+ ncpuinfo = qemuAgentGetVCPUs(agent, &cpuinfo);
+ qemuDomainObjExitAgent(vm, agent);
endjob:
qemuDomainObjEndJob(driver, vm);
@@ -13513,14 +13521,16 @@ qemuDomainSnapshotFSFreeze(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
unsigned int nmountpoints)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
+ qemuAgentPtr agent;
int frozen;
if (!qemuDomainAgentAvailable(vm, true))
return -1;
+ agent = priv->agent;
qemuDomainObjEnterAgent(vm);
- frozen = qemuAgentFSFreeze(priv->agent, mountpoints, nmountpoints);
- qemuDomainObjExitAgent(vm);
+ frozen = qemuAgentFSFreeze(agent, mountpoints, nmountpoints);
+ qemuDomainObjExitAgent(vm, agent);
return frozen < 0 ? -2 : frozen;
}
@@ -13532,19 +13542,21 @@ qemuDomainSnapshotFSThaw(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
bool report)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
+ qemuAgentPtr agent;
int thawed;
virErrorPtr err = NULL;
if (!qemuDomainAgentAvailable(vm, report))
return -1;
+ agent = priv->agent;
qemuDomainObjEnterAgent(vm);
if (!report)
err = virSaveLastError();
- thawed = qemuAgentFSThaw(priv->agent);
+ thawed = qemuAgentFSThaw(agent);
if (!report)
virSetError(err);
- qemuDomainObjExitAgent(vm);
+ qemuDomainObjExitAgent(vm, agent);
virFreeError(err);
@@ -18146,6 +18158,7 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom,
{
virQEMUDriverPtr driver = dom->conn->privateData;
qemuDomainObjPrivatePtr priv;
+ qemuAgentPtr agent;
virDomainObjPtr vm;
int ret = -1;
@@ -18218,9 +18231,10 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom,
goto endjob;
}
+ agent = priv->agent;
qemuDomainObjEnterAgent(vm);
- ret = qemuAgentSuspend(priv->agent, target);
- qemuDomainObjExitAgent(vm);
+ ret = qemuAgentSuspend(agent, target);
+ qemuDomainObjExitAgent(vm, agent);
endjob:
qemuDomainObjEndJob(driver, vm);
@@ -18309,6 +18323,7 @@ qemuDomainQemuAgentCommand(virDomainPtr domain,
int ret = -1;
char *result = NULL;
qemuDomainObjPrivatePtr priv;
+ qemuAgentPtr agent;
virCheckFlags(0, NULL);
@@ -18338,9 +18353,10 @@ qemuDomainQemuAgentCommand(virDomainPtr domain,
goto endjob;
}
+ agent = priv->agent;
qemuDomainObjEnterAgent(vm);
- ret = qemuAgentArbitraryCommand(priv->agent, cmd, &result, timeout);
- qemuDomainObjExitAgent(vm);
+ ret = qemuAgentArbitraryCommand(agent, cmd, &result, timeout);
+ qemuDomainObjExitAgent(vm, agent);
if (ret < 0)
VIR_FREE(result);
@@ -18411,6 +18427,7 @@ qemuDomainFSTrim(virDomainPtr dom,
virDomainObjPtr vm;
int ret = -1;
qemuDomainObjPrivatePtr priv;
+ qemuAgentPtr agent;
virCheckFlags(0, -1);
@@ -18447,9 +18464,10 @@ qemuDomainFSTrim(virDomainPtr dom,
goto endjob;
}
+ agent = priv->agent;
qemuDomainObjEnterAgent(vm);
- ret = qemuAgentFSTrim(priv->agent, minimum);
- qemuDomainObjExitAgent(vm);
+ ret = qemuAgentFSTrim(agent, minimum);
+ qemuDomainObjExitAgent(vm, agent);
endjob:
qemuDomainObjEndJob(driver, vm);
@@ -18600,6 +18618,7 @@ qemuDomainGetTime(virDomainPtr dom,
virQEMUDriverPtr driver = dom->conn->privateData;
virDomainObjPtr vm = NULL;
qemuDomainObjPrivatePtr priv;
+ qemuAgentPtr agent;
int ret = -1;
int rv;
@@ -18625,9 +18644,10 @@ qemuDomainGetTime(virDomainPtr dom,
if (!qemuDomainAgentAvailable(vm, true))
goto endjob;
+ agent = priv->agent;
qemuDomainObjEnterAgent(vm);
- rv = qemuAgentGetTime(priv->agent, seconds, nseconds);
- qemuDomainObjExitAgent(vm);
+ rv = qemuAgentGetTime(agent, seconds, nseconds);
+ qemuDomainObjExitAgent(vm, agent);
if (rv < 0)
goto endjob;
@@ -18650,6 +18670,7 @@ qemuDomainSetTime(virDomainPtr dom,
{
virQEMUDriverPtr driver = dom->conn->privateData;
qemuDomainObjPrivatePtr priv;
+ qemuAgentPtr agent;
virDomainObjPtr vm;
bool rtcSync = flags & VIR_DOMAIN_TIME_SYNC;
int ret = -1;
@@ -18689,9 +18710,10 @@ qemuDomainSetTime(virDomainPtr dom,
if (!qemuDomainAgentAvailable(vm, true))
goto endjob;
+ agent = priv->agent;
qemuDomainObjEnterAgent(vm);
- rv = qemuAgentSetTime(priv->agent, seconds, nseconds, rtcSync);
- qemuDomainObjExitAgent(vm);
+ rv = qemuAgentSetTime(agent, seconds, nseconds, rtcSync);
+ qemuDomainObjExitAgent(vm, agent);
if (rv < 0)
goto endjob;
@@ -19647,6 +19669,7 @@ qemuDomainGetFSInfo(virDomainPtr dom,
{
virQEMUDriverPtr driver = dom->conn->privateData;
qemuDomainObjPrivatePtr priv;
+ qemuAgentPtr agent;
virDomainObjPtr vm;
int ret = -1;
@@ -19672,9 +19695,10 @@ qemuDomainGetFSInfo(virDomainPtr dom,
if (!qemuDomainAgentAvailable(vm, true))
goto endjob;
+ agent = priv->agent;
qemuDomainObjEnterAgent(vm);
- ret = qemuAgentGetFSInfo(priv->agent, info, vm->def);
- qemuDomainObjExitAgent(vm);
+ ret = qemuAgentGetFSInfo(agent, info, vm->def);
+ qemuDomainObjExitAgent(vm, agent);
endjob:
qemuDomainObjEndJob(driver, vm);
@@ -19692,6 +19716,7 @@ qemuDomainInterfaceAddresses(virDomainPtr dom,
{
virQEMUDriverPtr driver = dom->conn->privateData;
qemuDomainObjPrivatePtr priv = NULL;
+ qemuAgentPtr agent;
virDomainObjPtr vm = NULL;
int ret = -1;
@@ -19723,9 +19748,10 @@ qemuDomainInterfaceAddresses(virDomainPtr dom,
if (!qemuDomainAgentAvailable(vm, true))
goto endjob;
+ agent = priv->agent;
qemuDomainObjEnterAgent(vm);
- ret = qemuAgentGetInterfaces(priv->agent, ifaces);
- qemuDomainObjExitAgent(vm);
+ ret = qemuAgentGetInterfaces(agent, ifaces);
+ qemuDomainObjExitAgent(vm, agent);
endjob:
qemuDomainObjEndJob(driver, vm);
@@ -19850,6 +19876,7 @@ qemuDomainSetUserPassword(virDomainPtr dom,
{
virQEMUDriverPtr driver = dom->conn->privateData;
qemuDomainObjPrivatePtr priv;
+ qemuAgentPtr agent;
virDomainObjPtr vm;
int ret = -1;
int rv;
@@ -19876,10 +19903,11 @@ qemuDomainSetUserPassword(virDomainPtr dom,
if (!qemuDomainAgentAvailable(vm, true))
goto endjob;
+ agent = priv->agent;
qemuDomainObjEnterAgent(vm);
- rv = qemuAgentSetUserPassword(priv->agent, user, password,
+ rv = qemuAgentSetUserPassword(agent, user, password,
flags & VIR_DOMAIN_PASSWORD_ENCRYPTED);
- qemuDomainObjExitAgent(vm);
+ qemuDomainObjExitAgent(vm, agent);
if (rv < 0)
goto endjob;
--
2.1.0
9 years
[libvirt] [PATCH 0/4] improve virsh attache-interface
by Pavel Hrdina
Pavel Hrdina (4):
virsh-domain: use correct base for virStrToLong_ui
virsh-nodedev: makes struct and functions for NodeDevice list
available
virsh-domain: update attach-interface to support type=hostdev
virsh.pod: update and improve a attach-interface section
tools/virsh-domain.c | 120 ++++++++++++++++++++++++++++++++++++++++++--------
tools/virsh-nodedev.c | 16 +++----
tools/virsh-nodedev.h | 11 +++++
tools/virsh.pod | 85 +++++++++++++++++++++--------------
4 files changed, 170 insertions(+), 62 deletions(-)
--
2.6.2
9 years
[libvirt] [PATCH] locking: Add io_timeout to sanlock
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1251190
So, if domain loses access to storage, sanlock tries to kill it
after some timeout. So far, the default is 80 seconds. But for
some scenarios this might not be enough. We should allow users to
adjust the timeout according to their needs.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/locking/libvirt_sanlock.aug | 1 +
src/locking/lock_driver_sanlock.c | 8 +++++++-
src/locking/sanlock.conf | 7 +++++++
src/locking/test_libvirt_sanlock.aug.in | 1 +
4 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/locking/libvirt_sanlock.aug b/src/locking/libvirt_sanlock.aug
index a78a444..8843590 100644
--- a/src/locking/libvirt_sanlock.aug
+++ b/src/locking/libvirt_sanlock.aug
@@ -22,6 +22,7 @@ module Libvirt_sanlock =
| int_entry "host_id"
| bool_entry "require_lease_for_disks"
| bool_entry "ignore_readonly_and_shared_disks"
+ | int_entry "io_timeout"
| str_entry "user"
| str_entry "group"
let comment = [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ]
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index e052875..f1dbbaf 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -73,6 +73,7 @@ struct _virLockManagerSanlockDriver {
int hostID;
bool autoDiskLease;
char *autoDiskLeasePath;
+ unsigned int io_timeout;
/* under which permissions does sanlock run */
uid_t user;
@@ -151,6 +152,10 @@ static int virLockManagerSanlockLoadConfig(const char *configFile)
else
driver->requireLeaseForDisks = !driver->autoDiskLease;
+ p = virConfGetValue(conf, "io_timeout");
+ CHECK_TYPE("io_timeout", VIR_CONF_ULONG);
+ if (p) driver->io_timeout = p->l;
+
p = virConfGetValue(conf, "user");
CHECK_TYPE("user", VIR_CONF_STRING);
if (p) {
@@ -338,7 +343,7 @@ static int virLockManagerSanlockSetupLockspace(void)
* or we can fallback to polling.
*/
retry:
- if ((rv = sanlock_add_lockspace(&ls, 0)) < 0) {
+ if ((rv = sanlock_add_lockspace_timeout(&ls, 0, driver->io_timeout)) < 0) {
if (-rv == EINPROGRESS && --retries) {
#ifdef HAVE_SANLOCK_INQ_LOCKSPACE
/* we have this function which blocks until lockspace change the
@@ -404,6 +409,7 @@ static int virLockManagerSanlockInit(unsigned int version,
driver->requireLeaseForDisks = true;
driver->hostID = 0;
driver->autoDiskLease = false;
+ driver->io_timeout = 0;
driver->user = (uid_t) -1;
driver->group = (gid_t) -1;
if (VIR_STRDUP(driver->autoDiskLeasePath, LOCALSTATEDIR "/lib/libvirt/sanlock") < 0) {
diff --git a/src/locking/sanlock.conf b/src/locking/sanlock.conf
index e5566ef..3a1a51c 100644
--- a/src/locking/sanlock.conf
+++ b/src/locking/sanlock.conf
@@ -54,6 +54,13 @@
#require_lease_for_disks = 1
#
+# Sanlock is able to kill qemu processes on IO timeout. By its internal
+# implementation, the current default is 80 seconds. If you need to adjust
+# the value change the following variable. Value of zero means use the
+# default sanlock timeout.
+#io_timeout = 0
+
+#
# The combination of user and group under which the sanlock
# daemon runs. Libvirt will chown created files (like
# content of disk_lease_dir) to make sure sanlock daemon can
diff --git a/src/locking/test_libvirt_sanlock.aug.in b/src/locking/test_libvirt_sanlock.aug.in
index ef98ea6..7f66f81 100644
--- a/src/locking/test_libvirt_sanlock.aug.in
+++ b/src/locking/test_libvirt_sanlock.aug.in
@@ -6,5 +6,6 @@ module Test_libvirt_sanlock =
{ "disk_lease_dir" = "/var/lib/libvirt/sanlock" }
{ "host_id" = "1" }
{ "require_lease_for_disks" = "1" }
+{ "io_timeout" = "0" }
{ "user" = "root" }
{ "group" = "root" }
--
2.4.10
9 years
[libvirt] [PATCH 0/4] HACKING: Improve handling
by Andrea Bolognani
Generate the HACKING file at dist time like we're already doing for
NEWS, AUTHORS and ChangeLog.
The file shouldn't be tracked by git as it's not a source file but
rather a generated one; because of this, it should also be generated
in $(builddir) as opposed to $(top_srcdir).
Cheers.
Andrea Bolognani (4):
HACKING: Generate inside the build directory
HACKING: Remove generated copy
HACKING: Add to ignore file
HACKING: Include in EXTRA_DIST
.gitignore | 1 +
HACKING | 1008 -----------------------------------------------------------
Makefile.am | 3 +-
cfg.mk | 3 +-
4 files changed, 4 insertions(+), 1011 deletions(-)
delete mode 100644 HACKING
--
2.4.3
9 years
[libvirt] [PATCH v2 0/2] reorder usb controllers correctly
by Pavel Hrdina
new in v2:
- used git format-patch -b
- added a test case
Pavel Hrdina (2):
domain-conf: reorder usb controllers so the master is first
test: add test case for usb controller order
src/conf/domain_conf.c | 21 +++++++++----
.../qemuxml2argv-controller-usb-order.xml | 32 ++++++++++++++++++++
.../qemuxml2xmlout-controller-usb-order.xml | 34 ++++++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
4 files changed, 83 insertions(+), 5 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-controller-usb-order.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-controller-usb-order.xml
--
2.6.2
9 years
[libvirt] [PATCH] domain-conf: reorder usb controllers so the master is first
by Pavel Hrdina
USB controllers can share the same 'index' which indicates, that there
is some sort of master-companion relationship. Reorder the controllers
in XML in to place the master controller before its companions. This is
required by QEMU to not fail with error message:
error: internal error: process exited while connecting to monitor:
2015-10-26T16:25:17.630265Z qemu-system-x86_64:
-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x6:
USB bus 'usb.0' not found
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1166452
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/conf/domain_conf.c | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0c559d2..3f22de2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13397,6 +13397,7 @@ void virDomainControllerInsertPreAlloced(virDomainDefPtr def,
int idx;
/* Tenatively plan to insert controller at the end. */
int insertAt = -1;
+ virDomainControllerDefPtr current = NULL;
/* Then work backwards looking for controllers of
* the same type. If we find a controller with a
@@ -13404,17 +13405,27 @@ void virDomainControllerInsertPreAlloced(virDomainDefPtr def,
* that position
*/
for (idx = (def->ncontrollers - 1); idx >= 0; idx--) {
- /* If bus matches and current controller is after
- * new controller, then new controller should go here */
- if (def->controllers[idx]->type == controller->type &&
- def->controllers[idx]->idx > controller->idx) {
- insertAt = idx;
- } else if (def->controllers[idx]->type == controller->type &&
- insertAt == -1) {
- /* Last controller with match bus is before the
- * new controller, then put new controller just after
- */
- insertAt = idx + 1;
+ current = def->controllers[idx];
+ if (current->type == controller->type) {
+ if (current->idx > controller->idx) {
+ /* If bus matches and current controller is after
+ * new controller, then new controller should go here
+ * */
+ insertAt = idx;
+ } else if (controller->info.mastertype == VIR_DOMAIN_CONTROLLER_MASTER_NONE &&
+ current->info.mastertype != VIR_DOMAIN_CONTROLLER_MASTER_NONE &&
+ current->idx == controller->idx) {
+ /* If bus matches and index matches and new controller is
+ * master and current isn't a master, then new controller
+ * should go here to be placed before its companion
+ */
+ insertAt = idx;
+ } else if (insertAt == -1) {
+ /* Last controller with match bus is before the
+ * new controller, then put new controller just after
+ */
+ insertAt = idx + 1;
+ }
}
}
--
2.6.2
9 years
[libvirt] [PATCH v2 0/5] qemu: hostdev: Unify naming
by Andrea Bolognani
Changes in v2:
* make new names consistent with virHostdev (thanks John)
* rename virHostdevUpdateDomainActiveDevices() as well
- this was the only function in virHostdev that didn't
conform to the module's naming conventions
Cheers.
Andrea Bolognani (5):
hostdev: Rename virHostdevUpdateDomainActiveDevices()
qemu: hostdev: Unify naming for qemuHostdevPrepare*Devices()
qemu: hostdev: Unify naming for qemuHostdevReAttach*Devices()
qemu: hostdev: Unify naming for qemuHostdevUpdateActive*Devices()
qemu: hostdev: Introduce qemuHostdevUpdateActiveDomainDevices()
src/libvirt_private.syms | 2 +-
src/libxl/libxl_driver.c | 2 +-
src/qemu/qemu_hostdev.c | 108 +++++++++++++++++++++++++++--------------------
src/qemu/qemu_hostdev.h | 69 +++++++++++++++---------------
src/qemu/qemu_hotplug.c | 20 ++++-----
src/qemu/qemu_process.c | 14 ++----
src/util/virhostdev.c | 2 +-
src/util/virhostdev.h | 2 +-
8 files changed, 117 insertions(+), 102 deletions(-)
--
2.4.3
9 years
[libvirt] [PATCH] tests: Fix virnetdaemontest to be skipped in non-yajl environment
by Prerna
When libvirt is compiled without yajl-devel, virnetdaemontest fails.
This causes 'make check' to fail with nondescript errors, such as following:
[snip]...............................
PASS: read-bufsiz
PASS: read-non-seekable
PASS: start
TEST: virsh-uriprecedence
.... 4 OK
PASS: virsh-uriprecedence
PASS: vcpupin
/home/prerna/trees/libvirt/tests/virsh-all: skipping test:
This test is very expensive, so it is disabled by default.
To run it anyway, rerun: make check VIR_TEST_EXPENSIVE=1
SKIP: virsh-all
PASS: virsh-optparse
PASS: virsh-schedinfo
PASS: virsh-synopsis
PASS: virsh-undefine
=======================================
1 of 108 tests failed
(7 tests were not run)
Please report to libvir-list(a)redhat.com
=======================================
make[2]: *** [check-TESTS] Error 1
make[2]: Leaving directory `/home/prerna/build/libvirt/tests'
make[1]: *** [check-am] Error 2
make[1]: Leaving directory `/home/prerna/build/libvirt/tests'
make: *** [check-recursive] Error 1
.....................................
This patch skips virnetdaemontest in absence of yajl-devel, so that
make check gracefully runs to completion.
Signed-off-by: Prerna Saxena <saxenap.ltc(a)gmail.com>
---
tests/virnetdaemontest.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c
index 24cbd54..17d1f7f 100644
--- a/tests/virnetdaemontest.c
+++ b/tests/virnetdaemontest.c
@@ -290,6 +290,11 @@ mymain(void)
{
int ret = 0;
+#if !WITH_YAJL
+ fputs("libvirt not compiled with yajl, skipping this test\n", stderr);
+ return EXIT_AM_SKIP;
+#endif
+
if (virInitialize() < 0 ||
virEventRegisterDefaultImpl() < 0) {
virDispatchError(NULL);
--
1.7.1
9 years