[libvirt] [PATCH] A description error about libvirtd manpage
by Jingjing Shao
To fix the bug The description of --timeout should be updated in libvirtd manpage
https://bugzilla.redhat.com/show_bug.cgi?id=1325066
According to the description, delete the part:
"Be aware that resources such as autostart
networks will result in never reaching the timeout, even when there are
no client connections."
---
daemon/libvirtd.pod | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/daemon/libvirtd.pod b/daemon/libvirtd.pod
index 3b819a2..5adf8a2 100644
--- a/daemon/libvirtd.pod
+++ b/daemon/libvirtd.pod
@@ -57,9 +57,7 @@ Use this name for the PID file, overriding the default value.
=item B<-t, --timeout> I<SECONDS>
Exit after timeout period (in seconds) elapse with no client connections
-or registered resources. Be aware that resources such as autostart
-networks will result in never reaching the timeout, even when there are
-no client connections.
+or registered resources.
=item B<-v, --verbose>
--
1.8.3.1
8 years, 4 months
[libvirt] [PATCH] conf: Don't free the constructed string in virDomainGetBlkioParametersAssignFromDef
by Peter Krempa
virTypedParameterAssign steals the string rather than copying it into
the typed parameter and thus freeing it leads to a crash when attempting
to serialize the results.
This was introduced in commit 9f50f6e2 and later made an universal
helper in 32e6339c.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1351473
---
src/conf/domain_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ef266af..5e2a467 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -24944,7 +24944,7 @@ virDomainGetBlkioParametersAssignFromDef(virDomainDefPtr def,
if (virTypedParameterAssign(&(params[(*nparams)++]), name, \
VIR_TYPED_PARAM_STRING, data) < 0) \
goto error; \
- VIR_FREE(data); \
+ data = NULL; \
}
/* blkiotune.device_weight */
--
2.9.0
8 years, 4 months
[libvirt] [PATCH v2] conf: def: Avoid unnecessary allocation of 'perf' events definition
by Peter Krempa
Some code paths already assume that it is allocated since it was always
allocated by virDomainPerfDefParseXML. Make it member of virDomainDef
directly so that we don't have to allocate it all the time.
This fixes crash when attempting to connect to an existing process via
virDomainQemuAttach since we would not allocate it in that code path.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1350688
---
src/conf/domain_conf.c | 12 ++----------
src/conf/domain_conf.h | 2 +-
src/qemu/qemu_driver.c | 6 +++---
src/qemu/qemu_process.c | 8 ++++----
4 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ef266af..7d40f26 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2671,8 +2671,6 @@ void virDomainDefFree(virDomainDefPtr def)
VIR_FREE(def->keywrap);
- VIR_FREE(def->perf);
-
if (def->namespaceData && def->ns.free)
(def->ns.free)(def->namespaceData);
@@ -13136,19 +13134,14 @@ virDomainPerfDefParseXML(virDomainDefPtr def,
if ((n = virXPathNodeSet("./perf/event", ctxt, &nodes)) < 0)
return n;
- if (VIR_ALLOC(def->perf) < 0)
- goto cleanup;
-
for (i = 0; i < n; i++) {
- if (virDomainPerfEventDefParseXML(def->perf, nodes[i]) < 0)
+ if (virDomainPerfEventDefParseXML(&def->perf, nodes[i]) < 0)
goto cleanup;
}
ret = 0;
cleanup:
- if (ret < 0)
- VIR_FREE(def->perf);
VIR_FREE(nodes);
return ret;
}
@@ -23388,8 +23381,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
virBufferAddLit(buf, "</pm>\n");
}
- if (def->perf)
- virDomainPerfDefFormat(buf, def->perf);
+ virDomainPerfDefFormat(buf, &def->perf);
virBufferAddLit(buf, "<devices>\n");
virBufferAdjustIndent(buf, 2);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 7c5cbd9..e1990dc 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2140,7 +2140,7 @@ struct _virDomainDef {
virDomainPowerManagement pm;
- virDomainPerfDefPtr perf;
+ virDomainPerfDef perf;
virDomainOSDef os;
char *emulator;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 61d184b..0507be8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9642,7 +9642,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom,
if (enabled && virPerfEventEnable(priv->perf, type, vm->pid) < 0)
goto endjob;
- def->perf->events[type] = enabled ?
+ def->perf.events[type] = enabled ?
VIR_TRISTATE_BOOL_YES : VIR_TRISTATE_BOOL_NO;
}
@@ -9656,7 +9656,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom,
enabled = param->value.b;
type = virPerfEventTypeFromString(param->field);
- persistentDef->perf->events[type] = enabled ?
+ persistentDef->perf.events[type] = enabled ?
VIR_TRISTATE_BOOL_YES : VIR_TRISTATE_BOOL_NO;
}
@@ -9716,7 +9716,7 @@ qemuDomainGetPerfEvents(virDomainPtr dom,
bool perf_enabled;
if (flags & VIR_DOMAIN_AFFECT_CONFIG)
- perf_enabled = def->perf->events[i] == VIR_TRISTATE_BOOL_YES;
+ perf_enabled = def->perf.events[i] == VIR_TRISTATE_BOOL_YES;
else
perf_enabled = virPerfEventIsEnabled(priv->perf, i);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 63da600..a175a4d 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3139,12 +3139,12 @@ qemuDomainPerfRestart(virDomainObjPtr vm)
return -1;
for (i = 0; i < VIR_PERF_EVENT_LAST; i++) {
- if (def->perf->events[i] &&
- def->perf->events[i] == VIR_TRISTATE_BOOL_YES) {
+ if (def->perf.events[i] &&
+ def->perf.events[i] == VIR_TRISTATE_BOOL_YES) {
/* Failure to re-enable the perf event should not be fatal */
if (virPerfEventEnable(priv->perf, i, vm->pid) < 0)
- def->perf->events[i] = VIR_TRISTATE_BOOL_NO;
+ def->perf.events[i] = VIR_TRISTATE_BOOL_NO;
}
}
@@ -5217,7 +5217,7 @@ qemuProcessLaunch(virConnectPtr conn,
goto cleanup;
for (i = 0; i < VIR_PERF_EVENT_LAST; i++) {
- if (vm->def->perf->events[i] == VIR_TRISTATE_BOOL_YES &&
+ if (vm->def->perf.events[i] == VIR_TRISTATE_BOOL_YES &&
virPerfEventEnable(priv->perf, i, vm->pid) < 0)
goto cleanup;
}
--
2.9.0
8 years, 4 months
[libvirt] [PATCH] qemu: Avoid needless copies of static strings
by Jiri Denemark
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_hotplug.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index bf6430d..f88520f 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3931,7 +3931,8 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
{
qemuDomainObjPrivatePtr priv = vm->privateData;
time_t now = time(NULL);
- char expire_time [64];
+ const char *expire;
+ char *validTo = NULL;
const char *connected = NULL;
const char *password;
int ret = -1;
@@ -3962,19 +3963,18 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
if (ret != 0)
goto end_job;
- if (password[0] == '\0') {
- snprintf(expire_time, sizeof(expire_time), "now");
+ if (password[0] == '\0' ||
+ (auth->expires && auth->validTo <= now)) {
+ expire = "now";
} else if (auth->expires) {
- time_t lifetime = auth->validTo - now;
- if (lifetime <= 0)
- snprintf(expire_time, sizeof(expire_time), "now");
- else
- snprintf(expire_time, sizeof(expire_time), "%lu", (long unsigned)auth->validTo);
+ if (virAsprintf(&validTo, "%lu", (unsigned long) auth->validTo) < 0)
+ goto end_job;
+ expire = validTo;
} else {
- snprintf(expire_time, sizeof(expire_time), "never");
+ expire = "never";
}
- ret = qemuMonitorExpirePassword(priv->mon, type, expire_time);
+ ret = qemuMonitorExpirePassword(priv->mon, type, expire);
if (ret == -2) {
/* XXX we could fake this with a timer */
@@ -3991,6 +3991,7 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
if (qemuDomainObjExitMonitor(driver, vm) < 0)
ret = -1;
cleanup:
+ VIR_FREE(validTo);
virObjectUnref(cfg);
return ret;
}
--
2.9.0
8 years, 4 months
[libvirt] [PATCH 0/3] qemu: Fix auto-generation of SCSI controllers for hot-plugged SCSI disks and add tests
by Marc Hartmayer
This patch series fixes the auto-generation of SCSI controllers for hot-plugged
SCSI disks and hot-plugged SCSI hostdevs.
Additionally this patch series adds test cases for the auto-generation of SCSI
controllers to the test suite.
Marc Hartmayer (3):
qemu: hot-plug: Fix broken SCSI disk hot-plug
qemu: SCSI hostdev hot-plug: Fix automatic creation of SCSI
controllers
tests: Add test cases for SCSI disk hot-plug with QEMU
src/qemu/qemu_hotplug.c | 41 +++++++++++++-
tests/qemuhotplugtest.c | 29 ++++++++++
.../qemuhotplug-disk-scsi-2.xml | 8 +++
...-base-with-scsi-controller-live+disk-scsi-2.xml | 51 +++++++++++++++++
...se-without-scsi-controller-live+disk-scsi-2.xml | 66 ++++++++++++++++++++++
...argv-hotplug-base-with-scsi-controller-live.xml | 56 ++++++++++++++++++
...v-hotplug-base-without-scsi-controller-live.xml | 40 +++++++++++++
7 files changed, 288 insertions(+), 3 deletions(-)
create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-disk-scsi-2.xml
create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-hotplug-base-with-scsi-controller-live+disk-scsi-2.xml
create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-hotplug-base-without-scsi-controller-live+disk-scsi-2.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hotplug-base-with-scsi-controller-live.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hotplug-base-without-scsi-controller-live.xml
--
2.5.5
8 years, 4 months
[libvirt] [PATCH] docs: Warn against locked memory limit too high
by Jiri Denemark
https://bugzilla.redhat.com/show_bug.cgi?id=1046833
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
docs/formatdomain.html.in | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index f660aa6..b0b2f82 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -862,8 +862,11 @@
be allowed to swap them out. For QEMU/KVM this requires
<code>hard_limit</code> <a href="#elementsMemoryTuning">memory tuning</a>
element to be used and set to the maximum memory configured for the
- domain plus any memory consumed by the QEMU process itself.
- <span class="since">Since 1.0.6</span></dd>
+ domain plus any memory consumed by the QEMU process itself. Beware of
+ setting the memory limit too high (and thus allowing the domain to lock
+ most of the host's memory). Doing so may be dangerous to both the
+ domain and the host itself since the host's kernel may run out of
+ memory. <span class="since">Since 1.0.6</span></dd>
</dl>
--
2.9.0
8 years, 4 months
[libvirt] [PATCH 0/8] Fix build with clang
by Ján Tomko
I am not proud of the first patch.
I wrote the temporary bump for -Wframe-larger-than thinking
splitting it out would be too intrusive for the freeze, but
it did not turn out so bad.
Patch 7/8 does not fix anything.
Ján Tomko (8):
virFirewallAddRule: exchange first two parameters
virTypedParamsValidate: do not use STREQ_NULLABLE
build: disable -Wdouble-promotion
build: ignore some clang-specific warnings
Introudce VIR_WARNINGS_NO_UNUSED_VALUE
Temporarily bump maximum stack size
test/Makefile.am: drop WARN_CFLAGS from LDFLAGS
Split out -Wframe-larger-than warning from WARN_CLFAGS
daemon/Makefile.am | 3 +
m4/virt-compile-warnings.m4 | 15 ++++-
src/Makefile.am | 1 +
src/internal.h | 5 ++
src/nwfilter/nwfilter_ebiptables_driver.c | 84 +++++++++++++--------------
src/util/viratomic.h | 7 +++
src/util/virebtables.c | 8 +--
src/util/virfirewall.c | 8 +--
src/util/virfirewall.h | 4 +-
src/util/viriptables.c | 38 ++++++-------
src/util/virtypedparam.c | 2 +-
tests/Makefile.am | 3 +-
tests/virfirewalltest.c | 94 +++++++++++++++----------------
13 files changed, 150 insertions(+), 122 deletions(-)
--
2.7.3
8 years, 4 months
[libvirt] [libvirt-test-API][PATCH] Modify makefile to add check option.
by Ruifeng Bian
Use inspektor to check code style.
Change-Id: I8c238c785f8e5dbd585379cad0d4687d0d5b5ce2
Signed-off-by: Ruifeng Bian <rbian(a)redhat.com>
---
Makefile | 3 +++
selftests/check | 15 +++++++++++++++
2 files changed, 18 insertions(+)
create mode 100755 selftests/check
diff --git a/Makefile b/Makefile
index 91a95db..837f41d 100644
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,9 @@ dist:
@echo " "
@echo "the archive is $(APP).tar.gz"
+check:
+ selftests/check
+
clean:
@find . -name "*.pyc" -exec rm -f {} \;
@rm -rf log/ log.xml
diff --git a/selftests/check b/selftests/check
new file mode 100755
index 0000000..f064651
--- /dev/null
+++ b/selftests/check
@@ -0,0 +1,15 @@
+#!/bin/bash
+ret=0
+run_cmd() {
+ echo "Running '$1'"
+ $1
+ if [ $? != 0 ]; then
+ ret=1
+ fi
+ echo ""
+}
+run_cmd 'inspekt lint'
+run_cmd 'inspekt indent'
+run_cmd 'inspekt style'
+exit ${ret}
+
--
2.4.3
8 years, 4 months
[libvirt] [PATCH] vz: fixed null-pointer dereference in applying graphic params
by Olga Krishtal
Signed-off-by: Olga Krishtal <okrishtal(a)virtuozzo.com>
---
src/vz/vz_sdk.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index f4c2b3b..903440b 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -2790,6 +2790,7 @@ static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom,
if (!gr) {
pret = PrlVmCfg_SetVNCMode(sdkdom, PRD_DISABLED);
prlsdkCheckRetExit(pret, -1);
+ return 1;
}
pret = PrlVmCfg_SetVNCPassword(sdkdom, gr->data.vnc.auth.passwd ? : "");
--
1.8.3.1
8 years, 4 months