[libvirt] [PATCHv2 1/3] conf: introduce 'autodeflate' attribute for memballoon device
by Dmitry Andreev
Excessive memory balloon inflation can cause invocation of OOM-killer,
when Linux is under severe memory pressure. QEMU memballoon device
has a feature to release some memory at the last moment before some
process will be get killed by OOM-killer.
Introduced attribute allows to enable or disable this feature.
---
docs/formatdomain.html.in | 10 ++++++++++
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 23 +++++++++++++++++++++++
src/conf/domain_conf.h | 1 +
4 files changed, 39 insertions(+)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index a8bd48e..7d04471 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5954,6 +5954,16 @@ qemu-kvm -net nic,model=? /dev/null
<li>'xen' — default with Xen</li>
</ul>
</dd>
+ <dt><code>autodeflate</code></dt>
+ <dd>
+ <p>
+ The optional <code>autodeflate</code> attribute allows to
+ enable/disable (values "on"/"off", respectively) the ability of the
+ QEMU virtio memory balloon to release some memory at the last moment
+ before a guest's process get killed by OOM-killer.
+ <span class="since">Since 1.3.1, QEMU and KVM only</span>
+ </p>
+ </dd>
<dt><code>period</code></dt>
<dd>
<p>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 4804c69..512a268 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3415,6 +3415,11 @@
<value>none</value>
</choice>
</attribute>
+ <optional>
+ <attribute name="autodeflate">
+ <ref name="virOnOff"/>
+ </attribute>
+ </optional>
<interleave>
<optional>
<ref name="alias"/>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5200c27..0786d08 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11312,6 +11312,7 @@ virDomainMemballoonDefParseXML(xmlNodePtr node,
unsigned int flags)
{
char *model;
+ char *deflate;
virDomainMemballoonDefPtr def;
xmlNodePtr save = ctxt->node;
unsigned int period = 0;
@@ -11332,6 +11333,13 @@ virDomainMemballoonDefParseXML(xmlNodePtr node,
goto error;
}
+ if ((deflate = virXMLPropString(node, "autodeflate")) &&
+ (def->autodeflate = virTristateSwitchTypeFromString(deflate)) <= 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("invalid autodeflate attribute value '%s'"), deflate);
+ goto error;
+ }
+
ctxt->node = node;
if (virXPathUInt("string(./stats/@period)", ctxt, &period) < -1) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -11350,6 +11358,7 @@ virDomainMemballoonDefParseXML(xmlNodePtr node,
cleanup:
VIR_FREE(model);
+ VIR_FREE(deflate);
ctxt->node = save;
return def;
@@ -17223,6 +17232,15 @@ virDomainMemballoonDefCheckABIStability(virDomainMemballoonDefPtr src,
return false;
}
+ if (src->autodeflate != dst->autodeflate) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Target balloon autodeflate attribute value "
+ "'%s' does not match source '%s'"),
+ virTristateSwitchTypeToString(dst->autodeflate),
+ virTristateSwitchTypeToString(src->autodeflate));
+ return false;
+ }
+
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
return false;
@@ -20400,6 +20418,11 @@ virDomainMemballoonDefFormat(virBufferPtr buf,
}
virBufferAsprintf(buf, "<memballoon model='%s'", model);
+
+ if (def->autodeflate != VIR_TRISTATE_SWITCH_ABSENT)
+ virBufferAsprintf(buf, " autodeflate='%s'",
+ virTristateSwitchTypeToString(def->autodeflate));
+
virBufferAdjustIndent(&childrenBuf, indent + 2);
if (def->period)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 952d3cc..31a0a05 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1634,6 +1634,7 @@ struct _virDomainMemballoonDef {
int model;
virDomainDeviceInfo info;
int period; /* seconds between collections */
+ int autodeflate; /* enum virTristateSwitch */
};
struct _virDomainNVRAMDef {
--
1.8.3.1
8 years, 10 months
[libvirt] [PATCH] storage: Clean up error path for create buildPool failure
by John Ferlan
Commit id 'aeb1078ab' added a buildPool option and failure path which
calls virStoragePoolObjRemove, which unlocks the pool, clears the 'pool'
variable, and goto cleanup. However, at cleanup virStoragePoolObjUnlock
is called without check if pool is non NULL.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/storage/storage_driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 0bb577f..81c0b8c 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -930,7 +930,8 @@ storagePoolCreate(virStoragePoolPtr obj,
cleanup:
VIR_FREE(stateFile);
- virStoragePoolObjUnlock(pool);
+ if (pool)
+ virStoragePoolObjUnlock(pool);
return ret;
}
--
2.5.0
8 years, 10 months
[libvirt] [PATCHv2] conf: rework code around 'append' attribute to make coverity happy
by Dmitry Mishin
Additionally fixed condition to use proper type define, thanks to John Ferlan
Signed-off-by: Dmitry Mishin <dim(a)virtuozzo.com>
---
src/conf/domain_conf.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f210c0b..9d47846 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1723,10 +1723,11 @@ virDomainChrSourceDefCopy(virDomainChrSourceDefPtr dest,
switch (src->type) {
case VIR_DOMAIN_CHR_TYPE_FILE:
- dest->data.file.append = src->data.file.append;
case VIR_DOMAIN_CHR_TYPE_PTY:
case VIR_DOMAIN_CHR_TYPE_DEV:
case VIR_DOMAIN_CHR_TYPE_PIPE:
+ if (src->type == VIR_DOMAIN_CHR_TYPE_FILE)
+ dest->data.file.append = src->data.file.append;
if (VIR_STRDUP(dest->data.file.path, src->data.file.path) < 0)
return -1;
break;
@@ -9386,12 +9387,12 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
switch ((virDomainChrType) def->type) {
case VIR_DOMAIN_CHR_TYPE_FILE:
- if (!append)
- append = virXMLPropString(cur, "append");
case VIR_DOMAIN_CHR_TYPE_PTY:
case VIR_DOMAIN_CHR_TYPE_DEV:
case VIR_DOMAIN_CHR_TYPE_PIPE:
case VIR_DOMAIN_CHR_TYPE_UNIX:
+ if (!append && def->type == VIR_DOMAIN_CHR_TYPE_FILE)
+ append = virXMLPropString(cur, "append");
/* PTY path is only parsed from live xml. */
if (!path &&
(def->type != VIR_DOMAIN_CHR_TYPE_PTY ||
@@ -9476,15 +9477,15 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
break;
case VIR_DOMAIN_CHR_TYPE_FILE:
- if (append &&
+ case VIR_DOMAIN_CHR_TYPE_PTY:
+ case VIR_DOMAIN_CHR_TYPE_DEV:
+ case VIR_DOMAIN_CHR_TYPE_PIPE:
+ if (append && def->type == VIR_DOMAIN_CHR_TYPE_FILE &&
(def->data.file.append = virTristateSwitchTypeFromString(append)) <= 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid append attribute value '%s'"), append);
goto error;
}
- case VIR_DOMAIN_CHR_TYPE_PTY:
- case VIR_DOMAIN_CHR_TYPE_DEV:
- case VIR_DOMAIN_CHR_TYPE_PIPE:
if (!path &&
def->type != VIR_DOMAIN_CHR_TYPE_PTY) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -20071,7 +20072,7 @@ virDomainChrSourceDefFormat(virBufferPtr buf,
virBufferEscapeString(buf, "<source path='%s'",
def->data.file.path);
if (def->type == VIR_DOMAIN_CHR_TYPE_FILE &&
- def->data.file.append)
+ def->data.file.append != VIR_TRISTATE_SWITCH_ABSENT)
virBufferAsprintf(buf, " append='%s'",
virTristateSwitchTypeToString(def->data.file.append));
virDomainSourceDefFormatSeclabel(buf, nseclabels, seclabels, flags);
--
1.8.3.1
8 years, 10 months
[libvirt] [PATCH] docs: Describe new 'append' attribute for chardevs source
by Dmitry Mishin
Signed-off-by: Dmitry Mishin <dim(a)virtuozzo.com>
---
docs/formatdomain.html.in | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index a8bd48e..9bbd548 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5227,7 +5227,7 @@ qemu-kvm -net nic,model=? /dev/null
<target port='0'/>
</serial>
<serial type='file'>
- <source path='/tmp/file'>
+ <source path='/tmp/file' append='on'>
<seclabel model='dac' relabel='no'/>
</source>
<target port='0'/>
@@ -5264,6 +5264,14 @@ qemu-kvm -net nic,model=? /dev/null
</p>
<p>
+ If the interface presented to host is <code>file</code>, the
+ <code>source</code> element may contain an optional attribute
+ <code>append</code> that specifies whether or not the information in the
+ file should be preserved on domain restart. Allowed values are
+ <code>on</code> and <code>off</code> (default).
+ </p>
+
+ <p>
Each character device element has an optional
sub-element <code><address></code> which can tie the
device to a
--
1.8.3.1
8 years, 10 months
[libvirt] [PATCH] qemu: add reporting of vCPU wait time
by Daniel P. Berrange
The VIR_DOMAIN_STATS_VCPU flag to virDomainListGetStats
enables reporting of stats about vCPUs. Currently we
only report the cumulative CPU running time and the
execution state.
This adds reporting of the wait time - time the vCPU
wants to run, but the host schedular has something else
running ahead of it.
The data is reported per-vCPU eg
$ virsh domstats --vcpu demo
Domain: 'demo'
vcpu.current=4
vcpu.maximum=4
vcpu.0.state=1
vcpu.0.time=1420000000
vcpu.0.wait=18403928
vcpu.1.state=1
vcpu.1.time=130000000
vcpu.1.wait=10612111
vcpu.2.state=1
vcpu.2.time=110000000
vcpu.2.wait=12759501
vcpu.3.state=1
vcpu.3.time=90000000
vcpu.3.wait=21825087
In implementing this I notice our reporting of CPU execute
time has very poor granularity, since we are getting it
from /proc/$PID/stat. As a future enhancement we should
prefer to get CPU execute time from /proc/$PID/schedstat
or /proc/$PID/sched (if either exist on the running kernel)
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/qemu/qemu_driver.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 96 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 783a7cd..5293294 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1361,6 +1361,80 @@ static char *qemuConnectGetCapabilities(virConnectPtr conn) {
static int
+qemuGetSchedInfo(unsigned long long *cpuWait,
+ pid_t pid, pid_t tid)
+{
+ char *proc = NULL;
+ char *data = NULL;
+ char **lines = NULL;
+ size_t i;
+ int ret = -1;
+ double val;
+
+ *cpuWait = 0;
+
+ /* In general, we cannot assume pid_t fits in int; but /proc parsing
+ * is specific to Linux where int works fine. */
+ if (tid)
+ ret = virAsprintf(&proc, "/proc/%d/task/%d/sched", (int)pid, (int)tid);
+ else
+ ret = virAsprintf(&proc, "/proc/%d/sched", (int)pid);
+ if (ret < 0)
+ goto cleanup;
+
+ /* The file is not guaranteed to exist (needs CONFIG_SCHED_DEBUG) */
+ if (access(proc, R_OK) < 0)
+ return 0;
+
+ if (virFileReadAll(proc, (1<<16), &data) < 0)
+ goto cleanup;
+
+ lines = virStringSplit(data, "\n", 0);
+ if (!lines)
+ goto cleanup;
+
+ for (i = 0; lines[i] != NULL; i++) {
+ const char *line = lines[i];
+
+ /* Needs CONFIG_SCHEDSTATS. The second check
+ * is the old name the kernel used in past */
+ if (STRPREFIX(line, "se.statistics.wait_sum") ||
+ STRPREFIX(line, "se.wait_sum")) {
+ line = strchr(line, ':');
+ if (!line) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing separate in sched info '%s'"),
+ lines[i]);
+ goto cleanup;
+ }
+ line++;
+ while (*line == ' ') {
+ line++;
+ }
+
+ if (virStrToDouble(line, NULL, &val) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to parse sched info value '%s'"),
+ line);
+ goto cleanup;
+ }
+
+ *cpuWait = (unsigned long long)(val * 1000000);
+ break;
+ }
+ }
+
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(data);
+ VIR_FREE(proc);
+ VIR_FREE(lines);
+ return ret;
+}
+
+
+static int
qemuGetProcessInfo(unsigned long long *cpuTime, int *lastCpu, long *vm_rss,
pid_t pid, int tid)
{
@@ -1424,6 +1498,7 @@ qemuGetProcessInfo(unsigned long long *cpuTime, int *lastCpu, long *vm_rss,
static int
qemuDomainHelperGetVcpus(virDomainObjPtr vm,
virVcpuInfoPtr info,
+ unsigned long long *cpuwait,
int maxinfo,
unsigned char *cpumaps,
int maplen)
@@ -1476,6 +1551,11 @@ qemuDomainHelperGetVcpus(virDomainObjPtr vm,
virBitmapFree(map);
}
+ if (cpuwait) {
+ if (qemuGetSchedInfo(&(cpuwait[i]), vm->pid, vcpupid) < 0)
+ return -1;
+ }
+
ncpuinfo++;
}
@@ -5517,7 +5597,7 @@ qemuDomainGetVcpus(virDomainPtr dom,
goto cleanup;
}
- ret = qemuDomainHelperGetVcpus(vm, info, maxinfo, cpumaps, maplen);
+ ret = qemuDomainHelperGetVcpus(vm, info, NULL, maxinfo, cpumaps, maplen);
cleanup:
virDomainObjEndAPI(&vm);
@@ -19089,6 +19169,7 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
int ret = -1;
char param_name[VIR_TYPED_PARAM_FIELD_LENGTH];
virVcpuInfoPtr cpuinfo = NULL;
+ unsigned long long *cpuwait = NULL;
if (virTypedParamsAddUInt(&record->params,
&record->nparams,
@@ -19104,10 +19185,12 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
virDomainDefGetVcpusMax(dom->def)) < 0)
return -1;
- if (VIR_ALLOC_N(cpuinfo, virDomainDefGetVcpus(dom->def)) < 0)
- return -1;
+ if (VIR_ALLOC_N(cpuinfo, virDomainDefGetVcpus(dom->def)) < 0 ||
+ VIR_ALLOC_N(cpuwait, virDomainDefGetVcpus(dom->def)) < 0)
+ goto cleanup;
- if (qemuDomainHelperGetVcpus(dom, cpuinfo, virDomainDefGetVcpus(dom->def),
+ if (qemuDomainHelperGetVcpus(dom, cpuinfo, cpuwait,
+ virDomainDefGetVcpus(dom->def),
NULL, 0) < 0) {
virResetLastError();
ret = 0; /* it's ok to be silent and go ahead */
@@ -19136,12 +19219,21 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
param_name,
cpuinfo[i].cpuTime) < 0)
goto cleanup;
+ snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
+ "vcpu.%zu.wait", i);
+ if (virTypedParamsAddULLong(&record->params,
+ &record->nparams,
+ maxparams,
+ param_name,
+ cpuwait[i]) < 0)
+ goto cleanup;
}
ret = 0;
cleanup:
VIR_FREE(cpuinfo);
+ VIR_FREE(cpuwait);
return ret;
}
--
2.5.0
8 years, 10 months
[libvirt] [PATCH v2] qemu: Connect to guest agent iff needed
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1293351
I've came across a bit of a silly scenario, but long story short:
after domain was resumed, the virDomainSetTime() API hung for 5
seconds after which it failed with an error. Problem was, that
there is no guest agent installed in the domain. But this got me
thinking and digging into the code. So even though we do listen
to VSERPORT_CHANGE events and connect and disconnect ourselves to
guest agent, we still do connect to the guest agent at both
domain startup and resume. This is a bit silly as it produces the
delay - basically, because we connect to the guest agent,
priv->agent is not NULL. Therefore qemuDomainAgentAvailable()
will return true. And the place where we hang? Well,
historically, when there was no VSERPORT_CHANGE event, we used a
dummy ping command to the guest which has 5 seconds timeout. And
it's still there and effective. So there's where the delay comes
from.
What's the resolution? Well, I'm introducing new capability
QEMU_CAPS_VSERPORT_CHANGE that is enabled iff qemu is capable of
the event. And, during domain startup, reconnect after resume and
attach we do connect to the agent socket iff the capability is
NOT set.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_domain.c | 11 ++++-------
src/qemu/qemu_domain.h | 2 +-
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_process.c | 25 +++++++++++++++++++------
src/qemu/qemu_process.h | 4 +++-
tests/qemucapabilitiesdata/caps_2.1.1-1.caps | 1 +
tests/qemucapabilitiesdata/caps_2.4.0-1.caps | 1 +
tests/qemucapabilitiesdata/caps_2.5.0-1.caps | 1 +
10 files changed, 34 insertions(+), 16 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 6e5d203..9e11af9 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -308,6 +308,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"virtio-tablet", /* 205 */
"virtio-input-host",
+ "vserport-change-event",
);
@@ -1479,6 +1480,7 @@ struct virQEMUCapsStringFlags virQEMUCapsEvents[] = {
{ "SPICE_MIGRATE_COMPLETED", QEMU_CAPS_SEAMLESS_MIGRATION },
{ "DEVICE_DELETED", QEMU_CAPS_DEVICE_DEL_EVENT },
{ "MIGRATION", QEMU_CAPS_MIGRATION_EVENT },
+ { "VSERPORT_CHANGE", QEMU_CAPS_VSERPORT_CHANGE },
};
struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 61d6379..983faf6 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -335,6 +335,7 @@ typedef enum {
/* 205 */
QEMU_CAPS_VIRTIO_TABLET, /* -device virtio-tablet-{device,pci} */
QEMU_CAPS_VIRTIO_INPUT_HOST, /* -device virtio-input-host-{device,pci} */
+ QEMU_CAPS_VSERPORT_CHANGE, /* VSERPORT_CHANGE event */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index bb8d47f..1c546f8 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3650,10 +3650,9 @@ qemuDomainSupportsBlockJobs(virDomainObjPtr vm,
* Returns the pointer to the channel definition that is used to access the
* guest agent if the agent is configured or NULL otherwise.
*/
-virDomainChrSourceDefPtr
+virDomainChrDefPtr
qemuFindAgentConfig(virDomainDefPtr def)
{
- virDomainChrSourceDefPtr config = NULL;
size_t i;
for (i = 0; i < def->nchannels; i++) {
@@ -3662,13 +3661,11 @@ qemuFindAgentConfig(virDomainDefPtr def)
if (channel->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO)
continue;
- if (STREQ_NULLABLE(channel->target.name, "org.qemu.guest_agent.0")) {
- config = &channel->source;
- break;
- }
+ if (STREQ_NULLABLE(channel->target.name, "org.qemu.guest_agent.0"))
+ return channel;
}
- return config;
+ return NULL;
}
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index cff48d7..ca88f8a 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -487,7 +487,7 @@ int qemuDomainAlignMemorySizes(virDomainDefPtr def);
void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def,
virDomainMemoryDefPtr mem);
-virDomainChrSourceDefPtr qemuFindAgentConfig(virDomainDefPtr def);
+virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
bool qemuDomainMachineIsQ35(const virDomainDef *def);
bool qemuDomainMachineIsI440FX(const virDomainDef *def);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e8ba3a6..fc00073 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4486,7 +4486,7 @@ processSerialChangedEvent(virQEMUDriverPtr driver,
if (STREQ_NULLABLE(dev.data.chr->target.name, "org.qemu.guest_agent.0")) {
if (newstate == VIR_DOMAIN_CHR_DEVICE_STATE_CONNECTED) {
if (!priv->agent) {
- if ((rc = qemuConnectAgent(driver, vm)) == -2)
+ if ((rc = qemuConnectAgent(driver, vm, true)) == -2)
goto endjob;
if (rc < 0)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f274068..3aca227 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -198,16 +198,29 @@ static qemuAgentCallbacks agentCallbacks = {
int
-qemuConnectAgent(virQEMUDriverPtr driver, virDomainObjPtr vm)
+qemuConnectAgent(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ bool force)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
int ret = -1;
qemuAgentPtr agent = NULL;
- virDomainChrSourceDefPtr config = qemuFindAgentConfig(vm->def);
+ virDomainChrDefPtr config = qemuFindAgentConfig(vm->def);
if (!config)
return 0;
+ if (!force &&
+ virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VSERPORT_CHANGE) &&
+ config->state == VIR_DOMAIN_CHR_DEVICE_STATE_DISCONNECTED) {
+ /* With newer qemus capable of VSERPORT_CHANGE event, we are connecting and
+ * disconnecting to the guest agent as it connects or disconnects to the
+ * channel within the guest. So, it's important to connect here iff we are
+ * running qemu not capable of the event or we are called from the event
+ * callback (@force == true). */
+ return 0;
+ }
+
if (virSecurityManagerSetDaemonSocketLabel(driver->securityManager,
vm->def) < 0) {
VIR_ERROR(_("Failed to set security context for agent for %s"),
@@ -223,7 +236,7 @@ qemuConnectAgent(virQEMUDriverPtr driver, virDomainObjPtr vm)
virObjectUnlock(vm);
agent = qemuAgentOpen(vm,
- config,
+ &config->source,
&agentCallbacks);
virObjectLock(vm);
@@ -3525,7 +3538,7 @@ qemuProcessReconnect(void *opaque)
goto error;
/* Failure to connect to agent shouldn't be fatal */
- if ((ret = qemuConnectAgent(driver, obj)) < 0) {
+ if ((ret = qemuConnectAgent(driver, obj, false)) < 0) {
if (ret == -2)
goto error;
@@ -4950,7 +4963,7 @@ qemuProcessLaunch(virConnectPtr conn,
goto cleanup;
/* Failure to connect to agent shouldn't be fatal */
- if ((rv = qemuConnectAgent(driver, vm)) < 0) {
+ if ((rv = qemuConnectAgent(driver, vm, false)) < 0) {
if (rv == -2)
goto cleanup;
@@ -5665,7 +5678,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
goto error;
/* Failure to connect to agent shouldn't be fatal */
- if ((ret = qemuConnectAgent(driver, vm)) < 0) {
+ if ((ret = qemuConnectAgent(driver, vm, false)) < 0) {
if (ret == -2)
goto error;
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index 85e3a06..555181f 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -151,6 +151,8 @@ int qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver,
virDomainDiskDefPtr qemuProcessFindDomainDiskByAlias(virDomainObjPtr vm,
const char *alias);
-int qemuConnectAgent(virQEMUDriverPtr driver, virDomainObjPtr vm);
+int qemuConnectAgent(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ bool force);
#endif /* __QEMU_PROCESS_H__ */
diff --git a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
index 1098dcf..332b85a 100644
--- a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
+++ b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
@@ -159,4 +159,5 @@
<flag name='rtl8139'/>
<flag name='e1000'/>
<flag name='virtio-net'/>
+ <flag name='vserport-change-event'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_2.4.0-1.caps b/tests/qemucapabilitiesdata/caps_2.4.0-1.caps
index d67a48d..1a5fe81 100644
--- a/tests/qemucapabilitiesdata/caps_2.4.0-1.caps
+++ b/tests/qemucapabilitiesdata/caps_2.4.0-1.caps
@@ -167,4 +167,5 @@
<flag name='virtio-mouse'/>
<flag name='virtio-tablet'/>
<flag name='virtio-input-host'/>
+ <flag name='vserport-change-event'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_2.5.0-1.caps b/tests/qemucapabilitiesdata/caps_2.5.0-1.caps
index f4f3673..8b3586a 100644
--- a/tests/qemucapabilitiesdata/caps_2.5.0-1.caps
+++ b/tests/qemucapabilitiesdata/caps_2.5.0-1.caps
@@ -168,4 +168,5 @@
<flag name='virtio-mouse'/>
<flag name='virtio-tablet'/>
<flag name='virtio-input-host'/>
+ <flag name='vserport-change-event'/>
</qemuCaps>
--
2.4.10
8 years, 10 months
[libvirt] [PATCH 00/10] various test fixes and input devices handling
by Pavel Hrdina
This patch series is a follow up for [1]. The first patch fixes one missed path
for calling virDomainDefPostParse after parsing driver specific configuration.
Then there is a bunch of tests improvements to help developers handle large
updates of expected output files. It helped me with the last patch, that
updates XML files after the input device fixes.
And there is a v2 of intput device cleanup patch, now it add implicit input
devices into config XML and uses driver's post parse functions to do that.
[1] https://www.redhat.com/archives/libvir-list/2015-December/msg00188.html
Pavel Hrdina (10):
xen: move virDomainDefPostParse to xenParseSxpr
tests: introduce VIR_TEST_REGENERATE_OUTPUT flag
tests.testutils: use VIR_TEST_REGENERATE_OUTPUT for
virTestDifferenceFull
tests.testutils: use virTestDifferenceFull in virtTestCompareToFile
tests: use virtTestDifferenceFull in tests where we have output file
tests: skip regeneration for problematic test
tests: regenerate all outputs using VIR_TEST_REGENERATE_OUTPUT flag
tests.nwfilterebiptablestest: swap actual and expected
device: cleanup input device code
tests: update test XML files to follow input changes
src/Makefile.am | 4 +-
src/conf/domain_conf.c | 77 +-----------
src/libxl/libxl_domain.c | 5 +
src/qemu/qemu_domain.c | 22 ++++
src/xen/xen_driver.c | 5 +
src/xen/xend_internal.c | 6 +-
src/xenapi/xenapi_driver.c | 5 +
src/xenconfig/xen_common.c | 22 ++++
src/xenconfig/xen_common.h | 2 +
src/xenconfig/xen_sxpr.c | 22 ++--
src/xenconfig/xen_sxpr.h | 9 +-
.../disk_snapshot_redefine.xml | 2 +
.../external_vm_redefine.xml | 2 +
tests/domainsnapshotxml2xmlout/full_domain.xml | 2 +
tests/domainsnapshotxml2xmlout/metadata.xml | 2 +
tests/domainsnapshotxml2xmltest.c | 2 +-
tests/interfacexml2xmltest.c | 2 +-
tests/lxcconf2xmltest.c | 2 +-
tests/nodedevxml2xmltest.c | 2 +-
tests/nwfilterebiptablestest.c | 14 +--
tests/qemuargv2xmltest.c | 18 ++-
tests/qemuhotplugtest.c | 11 +-
.../qemuhotplug-hotplug-base+disk-scsi.xml | 2 +
.../qemuhotplug-hotplug-base+disk-usb.xml | 2 +
.../qemuhotplug-hotplug-base+disk-virtio.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-bios-nvram.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml | 2 +
.../qemuxml2argv-blkiotune-device.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-blkiotune.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml | 6 +-
.../qemuxml2argvdata/qemuxml2argv-boot-floppy.xml | 6 +-
.../qemuxml2argv-boot-menu-disable.xml | 2 +
.../qemuxml2argv-boot-menu-enable-with-timeout.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-boot-multi.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-boot-network.xml | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-boot-order.xml | 2 +
.../qemuxml2argv-channel-guestfwd.xml | 2 +
.../qemuxml2argv-channel-virtio.xml | 2 +
.../qemuxml2argv-chardev-label.xml | 2 +
.../qemuxml2argv-clock-catchup.xml | 2 +
.../qemuxml2argv-clock-localtime.xml | 6 +-
.../qemuxml2argv-clock-timer-hyperv-rtc.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-clock-utc.xml | 6 +-
.../qemuxml2argv-console-compat.xml | 6 +-
.../qemuxml2argv-console-virtio-many.xml | 2 +
.../qemuxml2argv-cpu-eoi-disabled.xml | 2 +
.../qemuxml2argv-cpu-eoi-enabled.xml | 2 +
.../qemuxml2argv-cpu-host-kvmclock.xml | 2 +
.../qemuxml2argv-cpu-host-model-features.xml | 2 +
.../qemuxml2argv-cpu-host-passthrough-features.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-cpu-kvmclock.xml | 2 +
.../qemuxml2argv-cpu-numa-disjoint.xml | 2 +
.../qemuxml2argv-cpu-numa-memshared.xml | 2 +
...xml2argv-cputune-iothreadsched-zeropriority.xml | 2 +
.../qemuxml2argv-cputune-numatune.xml | 2 +
.../qemuxml2argv-cputune-zero-shares.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-cputune.xml | 2 +
.../qemuxml2argv-disk-active-commit.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-disk-aio.xml | 2 +
.../qemuxml2argv-disk-cdrom-empty.xml | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml | 6 +-
.../qemuxml2argv-disk-copy_on_read.xml | 2 +
.../qemuxml2argv-disk-drive-boot-cdrom.xml | 7 +-
.../qemuxml2argv-disk-drive-boot-disk.xml | 7 +-
.../qemuxml2argv-disk-drive-cache-directsync.xml | 2 +
.../qemuxml2argv-disk-drive-cache-unsafe.xml | 2 +
.../qemuxml2argv-disk-drive-cache-v2-none.xml | 6 +-
.../qemuxml2argv-disk-drive-cache-v2-wb.xml | 2 +
.../qemuxml2argv-disk-drive-cache-v2-wt.xml | 2 +
.../qemuxml2argv-disk-drive-copy-on-read.xml | 2 +
...muxml2argv-disk-drive-error-policy-enospace.xml | 2 +
.../qemuxml2argv-disk-drive-error-policy-stop.xml | 2 +
...rgv-disk-drive-error-policy-wreport-rignore.xml | 2 +
.../qemuxml2argv-disk-drive-fat.xml | 2 +
.../qemuxml2argv-disk-drive-fmt-qcow.xml | 2 +
.../qemuxml2argv-disk-drive-network-gluster.xml | 2 +
.../qemuxml2argv-disk-drive-network-iscsi-auth.xml | 2 +
.../qemuxml2argv-disk-drive-network-iscsi.xml | 2 +
.../qemuxml2argv-disk-drive-network-nbd-export.xml | 2 +
...xml2argv-disk-drive-network-nbd-ipv6-export.xml | 2 +
.../qemuxml2argv-disk-drive-network-nbd-ipv6.xml | 2 +
.../qemuxml2argv-disk-drive-network-nbd-unix.xml | 2 +
.../qemuxml2argv-disk-drive-network-nbd.xml | 2 +
.../qemuxml2argv-disk-drive-network-rbd-auth.xml | 2 +
...emuxml2argv-disk-drive-network-rbd-ceph-env.xml | 2 +
.../qemuxml2argv-disk-drive-network-rbd-ipv6.xml | 2 +
.../qemuxml2argv-disk-drive-network-rbd.xml | 2 +
.../qemuxml2argv-disk-drive-network-sheepdog.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-disk-floppy.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-disk-many.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-disk-mirror.xml | 2 +
.../qemuxml2argv-disk-scsi-device.xml | 2 +
.../qemuxml2argv-disk-scsi-disk-vpd.xml | 2 +
...qemuxml2argv-disk-scsi-lun-passthrough-sgio.xml | 2 +
.../qemuxml2argv-disk-scsi-megasas.xml | 2 +
.../qemuxml2argv-disk-scsi-virtio-scsi.xml | 2 +
.../qemuxml2argv-disk-scsi-vscsi.xml | 2 +
.../qemuxml2argv-disk-source-pool-mode.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-disk-usb.xml | 2 +
.../qemuxml2argv-disk-virtio-scsi-cmd_per_lun.xml | 2 +
.../qemuxml2argv-disk-virtio-scsi-ioeventfd.xml | 2 +
.../qemuxml2argv-disk-virtio-scsi-max_sectors.xml | 2 +
.../qemuxml2argv-disk-virtio-scsi-num_queues.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-disk-virtio.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml | 2 +
.../qemuxml2argv-encrypted-disk.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-eoi-disabled.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-eoi-enabled.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml | 2 +
.../qemuxml2argv-floppy-drive-fat.xml | 2 +
.../qemuxml2argv-graphics-vnc-policy.xml | 4 +-
.../qemuxml2argv-graphics-vnc-sasl.xml | 4 +-
.../qemuxml2argv-graphics-vnc-socket.xml | 4 +-
.../qemuxml2argv-graphics-vnc-tls.xml | 4 +-
.../qemuxml2argv-graphics-vnc-websocket.xml | 4 +-
.../qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml | 4 +-
.../qemuxml2argv-hostdev-pci-address.xml | 6 +-
.../qemuxml2argv-hostdev-scsi-large-unit.xml | 2 +
.../qemuxml2argv-hostdev-scsi-lsi-iscsi-auth.xml | 2 +
.../qemuxml2argv-hostdev-scsi-lsi-iscsi.xml | 2 +
.../qemuxml2argv-hostdev-scsi-lsi.xml | 2 +
.../qemuxml2argv-hostdev-scsi-rawio.xml | 2 +
.../qemuxml2argv-hostdev-scsi-readonly.xml | 2 +
.../qemuxml2argv-hostdev-scsi-sgio.xml | 2 +
.../qemuxml2argv-hostdev-scsi-shareable.xml | 2 +
...qemuxml2argv-hostdev-scsi-virtio-iscsi-auth.xml | 2 +
.../qemuxml2argv-hostdev-scsi-virtio-iscsi.xml | 2 +
.../qemuxml2argv-hostdev-scsi-virtio-scsi.xml | 2 +
.../qemuxml2argv-hostdev-usb-address.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-hostdev-vfio.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-hotplug-base.xml | 2 +
.../qemuxml2argv-hugepages-pages.xml | 2 +
.../qemuxml2argv-hugepages-pages2.xml | 2 +
.../qemuxml2argv-hugepages-pages3.xml | 2 +
.../qemuxml2argv-hugepages-shared.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-hyperv-off.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-hyperv-panic.xml | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-hyperv.xml | 6 +-
.../qemuxml2argv-input-usbmouse.xml | 2 +
.../qemuxml2argv-input-usbtablet.xml | 2 +
.../qemuxml2argv-interface-driver.xml | 2 +
.../qemuxml2argv-iothreads-disk.xml | 2 +
.../qemuxml2argv-iothreads-ids-partial.xml | 2 +
.../qemuxml2argv-iothreads-ids.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-iothreads.xml | 2 +
.../qemuxml2argv-kvm-features-off.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-kvm-features.xml | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-kvmclock.xml | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-lease.xml | 2 +
.../qemuxml2argv-machine-aeskeywrap-off-argv.xml | 4 +-
.../qemuxml2argv-machine-aeskeywrap-on-argv.xml | 4 +-
.../qemuxml2argv-machine-core-off.xml | 6 +-
.../qemuxml2argv-machine-core-on.xml | 6 +-
.../qemuxml2argv-machine-deakeywrap-off-argv.xml | 4 +-
.../qemuxml2argv-machine-deakeywrap-on-argv.xml | 4 +-
.../qemuxml2argv-machine-keywrap-none-argv.xml | 4 +-
.../qemuxml2argv-memory-hotplug-dimm.xml | 2 +
.../qemuxml2argv-memory-hotplug-nonuma.xml | 2 +
.../qemuxml2argv-memory-hotplug.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-migrate.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-minimal.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.xml | 2 +
.../qemuxml2argv-misc-disable-s3.xml | 6 +-
.../qemuxml2argv-misc-disable-suspends.xml | 6 +-
.../qemuxml2argv-misc-enable-s4.xml | 6 +-
.../qemuxml2argv-misc-no-reboot.xml | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.xml | 2 +
.../qemuxml2argv-net-eth-ifname.xml | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-net-eth.xml | 6 +-
.../qemuxml2argv-net-hostdev-vfio.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-net-hostdev.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-net-midonet.xml | 2 +
.../qemuxml2argv-net-openvswitch.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-net-udp.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-net-user.xml | 2 +
.../qemuxml2argv-net-vhostuser.xml | 2 +
.../qemuxml2argv-net-virtio-device.xml | 2 +
.../qemuxml2argv-net-virtio-disable-offloads.xml | 2 +
.../qemuxml2argv-net-virtio-network-portgroup.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-net-virtio.xml | 2 +
.../qemuxml2argv-nographics-vga.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-nosharepages.xml | 6 +-
.../qemuxml2argv-numad-static-vcpu-no-numatune.xml | 2 +
.../qemuxml2argv-numatune-memnode-no-memory.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-panic-double.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-panic-isa.xml | 2 +
.../qemuxml2argv-panic-no-address.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-pci-rom.xml | 2 +
.../qemuxml2argv-pci-serial-dev-chardev.xml | 2 +
.../qemuxml2argv-pcie-root-port-too-many.xml | 2 +
.../qemuxml2argv-pcie-root-port.xml | 2 +
.../qemuxml2argv-pcie-switch-downstream-port.xml | 2 +
.../qemuxml2argv-pcie-switch-upstream-port.xml | 2 +
.../qemuxml2argv-pcihole64-none.xml | 2 +
.../qemuxml2argv-pcihole64-q35.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-pcihole64.xml | 2 +
.../qemuxml2argv-pmu-feature-off.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-pseries-disk.xml | 2 +-
.../qemuxml2argv-pv-spinlock-disabled.xml | 2 +
.../qemuxml2argv-pv-spinlock-enabled.xml | 2 +
.../qemuxml2argv-qemu-ns-no-env.xml | 2 +
.../qemuxml2argv-reboot-timeout-disabled.xml | 6 +-
.../qemuxml2argv-reboot-timeout-enabled.xml | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-restore-v2.xml | 2 +
.../qemuxml2argv-seclabel-dac-none.xml | 2 +
.../qemuxml2argv-seclabel-device-multiple.xml | 2 +
.../qemuxml2argv-seclabel-dynamic-baselabel.xml | 2 +
.../qemuxml2argv-seclabel-dynamic-none.xml | 2 +
.../qemuxml2argv-seclabel-dynamic-override.xml | 2 +
.../qemuxml2argv-seclabel-static-labelskip.xml | 2 +
.../qemuxml2argv-seclabel-static.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml | 6 +-
.../qemuxml2argvdata/qemuxml2argv-serial-file.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-serial-many.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml | 2 +
.../qemuxml2argv-serial-spiceport-nospice.xml | 2 +
.../qemuxml2argv-serial-tcp-telnet.xml | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-serial-unix.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-shmem.xml | 2 +
.../qemuxml2argv-smbios-multiple-type2.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-smbios.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-smp.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-sound-device.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-sound.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-tap-vhost.xml | 2 +
.../qemuxml2argv-tpm-passthrough.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml | 2 +
.../qemuxml2argv-vcpu-placement-static.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-vhost_queues.xml | 2 +
.../qemuxml2argv-video-virtio-gpu-device.xml | 2 +
.../qemuxml2argv-video-virtio-gpu-virgl.xml | 2 +
.../qemuxml2argv-virtio-input-passthrough.xml | 2 +
.../qemuxml2argvdata/qemuxml2argv-virtio-input.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.xml | 2 +
.../qemuxml2argv-virtio-rng-egd.xml | 2 +
.../qemuxml2argv-virtio-rng-random.xml | 2 +
tests/qemuxml2argvdata/qemuxml2argv-watchdog.xml | 6 +-
.../qemuxml2xmlout-balloon-device-auto.xml | 2 +
.../qemuxml2xmlout-balloon-device-period.xml | 2 +
.../qemuxml2xmlout-bios-nvram-os-interleave.xml | 2 +
...muxml2xmlout-boot-menu-disable-with-timeout.xml | 2 +
.../qemuxml2xmlout-channel-virtio-auto.xml | 2 +
.../qemuxml2xmlout-channel-virtio-state-active.xml | 2 +
...emuxml2xmlout-channel-virtio-state-inactive.xml | 2 +
.../qemuxml2xmlout-console-compat-auto.xml | 2 +
.../qemuxml2xmlout-console-compat2.xml | 2 +
.../qemuxml2xmlout-console-virtio.xml | 2 +
.../qemuxml2xmlout-controller-usb-order.xml | 2 +
.../qemuxml2xmlout-cpu-empty.xml | 2 +
.../qemuxml2xmlout-cpu-numa-disordered.xml | 2 +
.../qemuxml2xmlout-cpu-numa-no-memory-element.xml | 2 +
.../qemuxml2xmlout-cpu-numa1.xml | 2 +
.../qemuxml2xmlout-cpu-numa2.xml | 2 +
.../qemuxml2xmlout-cputune-iothreads.xml | 2 +
.../qemuxml2xmlout-cputune-iothreadsched.xml | 2 +
.../qemuxml2xmlout-default-kvm-host-arch.xml | 2 +
.../qemuxml2xmlout-default-qemu-host-arch.xml | 2 +
.../qemuxml2xmlout-disk-backing-chains-active.xml | 2 +
...qemuxml2xmlout-disk-backing-chains-inactive.xml | 2 +
.../qemuxml2xmlout-disk-drive-discard.xml | 2 +
.../qemuxml2xmlout-disk-mirror-old-inactive.xml | 2 +
.../qemuxml2xmlout-disk-mirror-old.xml | 2 +
.../qemuxml2xmlout-disk-mirror.xml | 2 +
.../qemuxml2xmlout-disk-scsi-device-auto.xml | 2 +
.../qemuxml2xmlout-disk-source-pool.xml | 2 +
...qemuxml2xmlout-hostdev-scsi-autogen-address.xml | 2 +
.../qemuxml2xmlout-memtune-unlimited.xml | 2 +
.../qemuxml2xmloutdata/qemuxml2xmlout-memtune.xml | 2 +
.../qemuxml2xmlout-metadata-duplicate.xml | 2 +
.../qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml | 2 +
...emuxml2xmlout-numad-auto-memory-vcpu-cpuset.xml | 2 +
...ad-auto-memory-vcpu-no-cpuset-and-placement.xml | 2 +
.../qemuxml2xmlout-numad-auto-vcpu-no-numatune.xml | 2 +
.../qemuxml2xmlout-numatune-auto-prefer.xml | 2 +
.../qemuxml2xmlout-numatune-memnode.xml | 2 +
tests/qemuxml2xmloutdata/qemuxml2xmlout-panic.xml | 2 +
.../qemuxml2xmlout-pci-autoadd-addr.xml | 2 +
.../qemuxml2xmlout-pci-autoadd-idx.xml | 2 +
.../qemuxml2xmlout-pci-bridge-many-disks.xml | 2 +
.../qemuxml2xmlout-pcie-root.xml | 2 +
.../qemuxml2xmlout-pcihole64-gib.xml | 2 +
.../qemuxml2xmlout-pmu-feature.xml | 2 +
tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml | 2 +
.../qemuxml2xmlout-seclabel-dynamic-labelskip.xml | 2 +
.../qemuxml2xmlout-seclabel-dynamic-relabel.xml | 2 +
.../qemuxml2xmlout-seclabel-none.xml | 2 +
.../qemuxml2xmlout-serial-target-port-auto.xml | 2 +
.../qemuxml2xmlout-tap-vhost-incorrect.xml | 2 +
.../qemuxml2xmlout-usb-ich9-ehci-addr.xml | 2 +
.../qemuxml2xmlout-usb-redir-filter-version.xml | 2 +
.../qemuxml2xmlout-usb-redir-filter.xml | 2 +
tests/qemuxml2xmltest.c | 8 +-
tests/sexpr2xmldata/sexpr2xml-boot-grub.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-bridge-ipaddr.xml | 2 +
.../sexpr2xml-disk-block-shareable.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-disk-block.xml | 2 +
.../sexpr2xml-disk-drv-blktap-qcow.xml | 2 +
.../sexpr2xml-disk-drv-blktap-raw.xml | 2 +
.../sexpr2xml-disk-drv-blktap2-raw.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-disk-file.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-net-bridged.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-net-e1000.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-net-routed.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-pci-devs.xml | 2 +
.../sexpr2xml-pv-bootloader-cmdline.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-pv-bootloader.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-pv-localtime.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml | 2 +
tests/sexpr2xmldata/sexpr2xml-pv.xml | 2 +
tests/testutils.c | 134 ++++++++++++++++++---
tests/testutils.h | 8 ++
tests/vboxsnapshotxmltest.c | 2 +-
tests/vmx2xmldata/vmx2xml-graphics-vnc.xml | 2 -
tests/xmconfigdata/test-paravirt-vcpu.xml | 2 +
320 files changed, 913 insertions(+), 221 deletions(-)
--
2.6.3
8 years, 10 months
[libvirt] Reboot with SR-IOV devices confuses IOMMU (bug #1294677)
by Jakub Kicinski
Hi!
I hit an issue with PCI passthrough - after I reboot the VM IOMMU
mappings are incorrect and devices will access invalid memory.
The issue is quite easy to reproduce, I'm using NICs (e.g. Intel 40
Gig Ethernet NICs hit the issue reliably, I wasn't able to get
Mellanox NICs to work reliably due to other bugs) but you could
probably just pass through any PCI device which does a bit of DMA.
With NICs I do the following to reproduce:
- configure the NIC for SR-IOV passthrough [1];
- create two standard VMs;
- configure VMs with 4GB current allocation and 15GB maximum
allocation of memory (my machines have 32 or 64GB total);
- pass a VF to each machine;
Note1: the current/maximum allocation of memory seem to play a role
here. I'm not 100% sure, however, if it causes the bug or just
makes it more likely to be triggered.
Note2: I leave <on_reboot>restart</on_reboot> so that VMs can reboot.
I was able to reproduce easily on 3 distinct machines: dual CPU
Haswell E, single CPU Haswell E, single Sandy Bridge EP.
With the VMs created above do the following:
(1) boot;
(2) configure VF interfaces;
(3) run ping -c30 to confirm they can communicate;
(4) run iperf -P4 -t30 between the machines;
(5) reboot;
(6) goto 2;
First time (fresh after boot) ping and iperf should work fine. After
first reboot, there should already be communication problems. From
traffic inspection with tcpdump it appears that VFs receive zeroed
packets. Only some of the packets are zeroed so depending on your luck
the communication may work for a while or just have limited throughput.
Usually it breaks down when ARP or important TCP segment gets placed in
area that device reads as zero. Reboot will not fix this condition,
shutdown/start will.
I reproduced this with fully up-to-date Ubuntu 14.04 (both host and VM).
I also tried kernel from linux-next.git (4ef7675344d68) and qemu from
tip of their git (38a762f) and bug is still there. libvirt in Ubuntu
14.04 is at 1.2.2.
As already said - I reproduce this easily within a minute on a range of
machines. If someone looks into this and have problems hitting the bug
- please let me know.
Kuba
[1] For Intel NICs supported by i40e:
http://www.intel.es/content/www/es/es/embedded/products/networking/xl710-...
8 years, 10 months
[libvirt] [PATCH] rbd: Return VIR_STORAGE_FILE_RAW as format for RBD volumes
by Wido den Hollander
This used to return 'unkown' and that was not correct.
A vol-dumpxml now returns:
<volume type='network'>
<name>image3</name>
<key>libvirt/image3</key>
<source>
</source>
<capacity unit='bytes'>10737418240</capacity>
<allocation unit='bytes'>10737418240</allocation>
<target>
<path>libvirt/image3</path>
<format type='raw'/>
</target>
</volume>
The RBD driver will now error out if a different format than RAW
is provided when creating a volume.
Signed-off-by: Wido den Hollander <wido(a)widodh.nl>
---
src/conf/storage_conf.c | 3 ++-
src/storage/storage_backend_rbd.c | 13 +++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 9b8abea..7c81bab 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -220,7 +220,8 @@ static virStoragePoolTypeInfo poolTypeInfo[] = {
},
.volOptions = {
.defaultFormat = VIR_STORAGE_FILE_RAW,
- .formatToString = virStoragePoolFormatDiskTypeToString,
+ .formatFromString = virStorageVolumeFormatFromString,
+ .formatToString = virStorageFileFormatTypeToString,
}
},
{.poolType = VIR_STORAGE_POOL_SHEEPDOG,
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index cdbfdee..80684eb 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -306,6 +306,7 @@ static int volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr vol,
vol->target.capacity = info.size;
vol->target.allocation = info.obj_size * info.num_objs;
vol->type = VIR_STORAGE_VOL_NETWORK;
+ vol->target.format = VIR_STORAGE_FILE_RAW;
VIR_FREE(vol->target.path);
if (virAsprintf(&vol->target.path, "%s/%s",
@@ -557,6 +558,12 @@ virStorageBackendRBDCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
{
vol->type = VIR_STORAGE_VOL_NETWORK;
+ if (vol->target.format != VIR_STORAGE_FILE_RAW) {
+ virReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("only RAW volumes are supported by this storage pool"));
+ return -VIR_ERR_NO_SUPPORT;
+ }
+
VIR_FREE(vol->target.path);
if (virAsprintf(&vol->target.path, "%s/%s",
pool->def->source.name,
@@ -603,6 +610,12 @@ virStorageBackendRBDBuildVol(virConnectPtr conn,
goto cleanup;
}
+ if (vol->target.format != VIR_STORAGE_FILE_RAW) {
+ virReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("only RAW volumes are supported by this storage pool"));
+ goto cleanup;
+ }
+
if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source) < 0)
goto cleanup;
--
1.9.1
8 years, 10 months
[libvirt] [PATCH 0/3] Various Valgrind fixes
by Michael Chapman
Valgrind reported a couple of memory leaks and jumps conditional on
uninitialized values.
Happy New Year!
Michael Chapman (3):
qemu: do not copy out non-existent block job info
qemu: do not leak NBD disk data in migration cookie
storage: do not leak storage pool XML filename
src/qemu/qemu_driver.c | 4 ++--
src/qemu/qemu_migration.c | 5 +++--
src/storage/storage_driver.c | 10 +++++-----
3 files changed, 10 insertions(+), 9 deletions(-)
--
2.4.3
8 years, 10 months