[libvirt] [PATCH] virsh: fix mingw failure on creating nonblocking pipe
by Eric Blake
* .gnulib: Update to latest, for nonblocking module.
* bootstrap.conf (gnulib_modules): Add nonblocking.
* src/util/util.c (virSetBlocking): Defer to gnulib.
---
Matthias, does this work for you on your mingw build? So far,
I have only tested that it cross-compiles, and that the new
gnulib module passes its self-test when run in isolation on mingw.
.gnulib | 2 +-
bootstrap.conf | 1 +
src/util/util.c | 22 ++--------------------
3 files changed, 4 insertions(+), 21 deletions(-)
diff --git a/.gnulib b/.gnulib
index 790645d..dec3475 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 790645d837f8084991421107fba639b110d58335
+Subproject commit dec3475763be252103922a887920012eeb32dc26
diff --git a/bootstrap.conf b/bootstrap.conf
index 733c354..ca0c3de 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -49,6 +49,7 @@ mkstemp
mkstemps
mktempd
netdb
+nonblocking
perror
physmem
pipe-posix
diff --git a/src/util/util.c b/src/util/util.c
index 035036b..e54b02b 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -77,6 +77,7 @@
#include "verify.h"
#include "files.h"
#include "command.h"
+#include "nonblocking.h"
#ifndef NSIG
# define NSIG 32
@@ -246,26 +247,7 @@ virArgvToString(const char *const *argv)
}
int virSetBlocking(int fd, bool blocking) {
-#ifndef WIN32
- int flags;
- if ((flags = fcntl(fd, F_GETFL)) < 0)
- return -1;
- if (blocking)
- flags &= ~O_NONBLOCK;
- else
- flags |= O_NONBLOCK;
- if ((fcntl(fd, F_SETFL, flags)) < 0)
- return -1;
-#else
- unsigned long flag = blocking ? 0 : 1;
-
- /* This is actually Gnulib's replacement rpl_ioctl function.
- * We can't call ioctlsocket directly in any case.
- */
- if (ioctl (fd, FIONBIO, (void *) &flag) == -1)
- return -1;
-#endif
- return 0;
+ return set_nonblocking_flag (fd, blocking);
}
int virSetNonBlock(int fd) {
--
1.7.4
13 years, 8 months
[libvirt] [libvirt-php] Remove strip from installation
by Lyre
Make it able to generate debuginfo package.
---
configure.ac | 1 -
src/Makefile.am | 2 +-
2 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8149349..5ebe416 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,7 +11,6 @@ AC_LANG([C])
AC_PROG_INSTALL
AC_PROG_SED
AC_PROG_AWK
-AC_CHECK_TOOL([STRIP], [strip])
AC_CHECK_TOOL([ECHO], [echo])
AC_CHECK_TOOL([RM], [rm])
diff --git a/src/Makefile.am b/src/Makefile.am
index edb5df4..76ebee6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -13,7 +13,7 @@ build:
$(ECHO) "Extension compiled as $(PACKAGE).so"
install-exec-local:
- $(INSTALL) -m 644 -D --strip $(PACKAGE).so $(DESTDIR)$(PHPEDIR)/$(PACKAGE).so
+ $(INSTALL) -m 644 -D $(PACKAGE).so $(DESTDIR)$(PHPEDIR)/$(PACKAGE).so
$(INSTALL) -m 755 -d $(DESTDIR)$(PHPCDIR)
$(ECHO) "extension=$(PACKAGE).so" > $(DESTDIR)$(PHPCDIR)/libvirt-php.ini
--
1.7.3.4
�
13 years, 8 months
[libvirt] [PATCH] Fix libxl driver startup
by Daniel Veillard
When you happen to have a libvirtd binary compiled with the
libxenlight driver (say you have installed xen-4.1 libraries)
but not running a xen enabled system, then libvirtd fails to start.
The cause is that libxlStartup() returns -1 when failing to initialize
the library, and this propagates to virStateInitialize() which consider
this a failure. We should only exit libxlStartup with an error code
if something like an allocation error occurs, not if the driver failed
to initialize.
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
13 years, 8 months
[libvirt] [PATCH] virsh: Fix documentation for memtune command
by Jiri Denemark
Commit 78ba748ef14c520ff1c4af2b5b0a44586ac49c8c claims to fix
documentation for swap_hard_limit virsh memtune option but it only fixes
documentation in formatdomain.html and libvirt.h. This patch completes
the task by fixing "virsh help memtune" output and memtune section of
virsh man page.
---
tools/virsh.c | 2 +-
tools/virsh.pod | 29 +++++++++++++++++++++++++++--
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index faeaf47..8816812 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -3201,7 +3201,7 @@ static const vshCmdOptDef opts_memtune[] = {
{"soft-limit", VSH_OT_INT, VSH_OFLAG_NONE,
N_("Memory during contention in kilobytes")},
{"swap-hard-limit", VSH_OT_INT, VSH_OFLAG_NONE,
- N_("Max swap in kilobytes")},
+ N_("Max memory plus swap in kilobytes")},
{"min-guarantee", VSH_OT_INT, VSH_OFLAG_NONE,
N_("Min guaranteed memory in kilobytes")},
{NULL, 0, 0, NULL}
diff --git a/tools/virsh.pod b/tools/virsh.pod
index e882261..ca9e401 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -611,12 +611,37 @@ use the virsh B<edit> command instead to update its XML <memory> element.
=item B<memtune> I<domain-id> optional I<--hard-limit> B<kilobytes>
optional I<--soft-limit> B<kilobytes> optional I<--swap-hard-limit>
-B<kilobytes> -I<--min-guarantee> B<kilobytes>
+B<kilobytes> optional I<--min-guarantee> B<kilobytes>
Allows you to display or set the domain memory parameters. Without
flags, the current settings are displayed; with a flag, the
appropriate limit is adjusted if supported by the hypervisor. LXC and
-QEMU/KVM supports I<--hard-limit>, I<--soft-limit>, and I<--swap-hard-limit>.
+QEMU/KVM support I<--hard-limit>, I<--soft-limit>, and I<--swap-hard-limit>.
+
+=over 4
+
+=item I<--hard-limit>
+
+The maximum memory the guest can use. The units for this value are kilobytes
+(i.e. blocks of 1024 bytes).
+
+=item I<--soft-limit>
+
+The memory limit to enforce during memory contention. The units for this value
+are kilobytes (i.e. blocks of 1024 bytes).
+
+=item I<--swap-hard-limit>
+
+The maximum memory plus swap the guest can use. The units for this value are
+kilobytes (i.e. blocks of 1024 bytes). This has to be more than hard-limit
+value provided.
+
+=item I<--min-guarantee>
+
+The guaranteed minimum memory allocation for the guest. The units for this
+value are kilobytes (i.e. blocks of 1024 bytes).
+
+=back
=item B<blkiotune> I<domain-id> optional I<--weight> B<weight>
--
1.7.4.1
13 years, 8 months
[libvirt] [PATCHv8 0/4] libvirt/qemu - persistent modification of inactive domans.
by KAMEZAWA Hiroyuki
Hi, this is v8. This one implements a new method for rollback in domain changes
in patch 2/4. And I dropped "verify new device is.." patch which was 4/4 in v7.
Then, totarl numbers of patches are not changed. I'll add NIC support when
this patch goes.
1/4 ..... a base patch for all devices. (not changed much)
2/4 ..... copy-sync-undo for synchronized update of domain definition.
3/4 ..... allow persistent addtion of disks to invalid domain.
4/4 ..... address conflic check.
Thanks,
-Kame
13 years, 8 months
[libvirt] [PATCH v2] qemu: Ignore libvirt debug messages in qemu log
by Jiri Denemark
qemu driver uses a 4K buffer for reading qemu log file. This is enough
when only qemu's output is present in the log file. However, when
debugging messages are turned on, intermediate libvirt process fills the
log with a bunch of debugging messages before it executes qemu binary.
In such a case the buffer may become too small. However, we are not
really interested in libvirt messages so they can be filtered out from
the buffer.
---
Notes:
Version 2:
- add a comment to virLogFormatString() that this new code relies on the log
message format
- temporarily replace '\n' with '\0' to provide a bound for strstr()
src/qemu/qemu_process.c | 50 +++++++++++++++++++++++++++++++++++++---------
src/util/logging.c | 8 +++++++
2 files changed, 48 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e31e1b4..2fc2b6c 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -762,11 +762,23 @@ qemuProcessReadLogOutput(virDomainObjPtr vm,
{
int retries = (timeout*10);
int got = 0;
+ char *debug = NULL;
+ int ret = -1;
+ char *filter_next = buf;
+
buf[0] = '\0';
+ /* This relies on log message format generated by virLogFormatString() and
+ * might need to be modified when message format changes. */
+ if (virAsprintf(&debug, ": %d: debug : ", vm->pid) < 0) {
+ virReportOOMError();
+ return -1;
+ }
+
while (retries) {
- ssize_t func_ret, ret;
+ ssize_t func_ret, bytes;
int isdead = 0;
+ char *eol;
func_ret = func(vm, buf, fd);
@@ -775,32 +787,47 @@ qemuProcessReadLogOutput(virDomainObjPtr vm,
/* Any failures should be detected before we read the log, so we
* always have something useful to report on failure. */
- ret = saferead(fd, buf+got, buflen-got-1);
- if (ret < 0) {
+ bytes = saferead(fd, buf+got, buflen-got-1);
+ if (bytes < 0) {
virReportSystemError(errno,
_("Failure while reading %s log output"),
what);
- return -1;
+ goto cleanup;
}
- got += ret;
+ got += bytes;
buf[got] = '\0';
+
+ /* Filter out debug messages from intermediate libvirt process */
+ while ((eol = strchr(filter_next, '\n'))) {
+ *eol = '\0';
+ if (strstr(filter_next, debug)) {
+ memmove(filter_next, eol + 1, got - (eol - buf));
+ got -= eol + 1 - filter_next;
+ } else {
+ filter_next = eol + 1;
+ *eol = '\n';
+ }
+ }
+
if (got == buflen-1) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("Out of space while reading %s log output: %s"),
what, buf);
- return -1;
+ goto cleanup;
}
if (isdead) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("Process exited while reading %s log output: %s"),
what, buf);
- return -1;
+ goto cleanup;
}
- if (func_ret <= 0)
- return func_ret;
+ if (func_ret <= 0) {
+ ret = func_ret;
+ goto cleanup;
+ }
usleep(100*1000);
retries--;
@@ -809,7 +836,10 @@ qemuProcessReadLogOutput(virDomainObjPtr vm,
qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("Timed out while reading %s log output: %s"),
what, buf);
- return -1;
+
+cleanup:
+ VIR_FREE(debug);
+ return ret;
}
diff --git a/src/util/logging.c b/src/util/logging.c
index 48c0cfd..9d18752 100644
--- a/src/util/logging.c
+++ b/src/util/logging.c
@@ -660,6 +660,14 @@ virLogFormatString(char **msg,
const char *str)
{
int ret;
+
+ /*
+ * Be careful when changing the following log message formatting, we rely
+ * on it when stripping libvirt debug messages from qemu log files. So when
+ * changing this, you might also need to change the code there.
+ * virLogFormatString() function name is mentioned there so it's sufficient
+ * to just grep for it to find the right place.
+ */
if ((funcname != NULL)) {
ret = virAsprintf(msg, "%02d:%02d:%02d.%03d: %d: %s : %s:%lld : %s\n",
time_info->tm_hour, time_info->tm_min,
--
1.7.4.1
13 years, 8 months
[libvirt] [PATCH] qemu: Fix improper logic of qemuCgroupSetup
by Osier Yang
It throws errors as long as the cgroup controller is not available,
regardless of whether we really want to use it to do setup or not,
which is not what we want, fixing it with throwing error when need
to use the controller.
And change "VIR_WARN" to "qemuReportError" for memory controller
incidentally.
---
src/qemu/qemu_cgroup.c | 78 +++++++++++++++++++++++++----------------------
1 files changed, 41 insertions(+), 37 deletions(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 8cf45da..7e88a67 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -294,8 +294,8 @@ int qemuSetupCgroup(struct qemud_driver *driver,
}
}
- if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
- if (vm->def->blkio.weight != 0) {
+ if (vm->def->blkio.weight != 0) {
+ if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
rc = virCgroupSetBlkioWeight(cgroup, vm->def->blkio.weight);
if(rc != 0) {
virReportSystemError(-rc,
@@ -303,48 +303,52 @@ int qemuSetupCgroup(struct qemud_driver *driver,
vm->def->name);
goto cleanup;
}
+ } else {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Block I/O tuning is not available on this host"));
}
- } else {
- qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Block I/O tuning is not available on this host"));
}
- if ((rc = qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_MEMORY))) {
- if (vm->def->mem.hard_limit != 0) {
- rc = virCgroupSetMemoryHardLimit(cgroup, vm->def->mem.hard_limit);
- if (rc != 0) {
- virReportSystemError(-rc,
- _("Unable to set memory hard limit for domain %s"),
- vm->def->name);
- goto cleanup;
+ if (vm->def->mem.hard_limit != 0 ||
+ vm->def->mem.soft_limit != 0 ||
+ vm->def->mem.swap_hard_limit != 0) {
+ if ((rc = qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_MEMORY))) {
+ if (vm->def->mem.hard_limit != 0) {
+ rc = virCgroupSetMemoryHardLimit(cgroup, vm->def->mem.hard_limit);
+ if (rc != 0) {
+ virReportSystemError(-rc,
+ _("Unable to set memory hard limit for domain %s"),
+ vm->def->name);
+ goto cleanup;
+ }
}
- }
- if (vm->def->mem.soft_limit != 0) {
- rc = virCgroupSetMemorySoftLimit(cgroup, vm->def->mem.soft_limit);
- if (rc != 0) {
- virReportSystemError(-rc,
- _("Unable to set memory soft limit for domain %s"),
- vm->def->name);
- goto cleanup;
+ if (vm->def->mem.soft_limit != 0) {
+ rc = virCgroupSetMemorySoftLimit(cgroup, vm->def->mem.soft_limit);
+ if (rc != 0) {
+ virReportSystemError(-rc,
+ _("Unable to set memory soft limit for domain %s"),
+ vm->def->name);
+ goto cleanup;
+ }
}
- }
- if (vm->def->mem.swap_hard_limit != 0) {
- rc = virCgroupSetMemSwapHardLimit(cgroup, vm->def->mem.swap_hard_limit);
- if (rc != 0) {
- virReportSystemError(-rc,
- _("Unable to set swap hard limit for domain %s"),
- vm->def->name);
- goto cleanup;
+ if (vm->def->mem.swap_hard_limit != 0) {
+ rc = virCgroupSetMemSwapHardLimit(cgroup, vm->def->mem.swap_hard_limit);
+ if (rc != 0) {
+ virReportSystemError(-rc,
+ _("Unable to set swap hard limit for domain %s"),
+ vm->def->name);
+ goto cleanup;
+ }
}
+ } else {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Memory tuning is not available on this host"));
}
- } else {
- VIR_WARN("Memory cgroup is disabled in qemu configuration file: %s",
- vm->def->name);
}
- if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
- if (vm->def->cputune.shares != 0) {
+ if (vm->def->cputune.shares != 0) {
+ if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
rc = virCgroupSetCpuShares(cgroup, vm->def->cputune.shares);
if(rc != 0) {
virReportSystemError(-rc,
@@ -352,10 +356,10 @@ int qemuSetupCgroup(struct qemud_driver *driver,
vm->def->name);
goto cleanup;
}
+ } else {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("CPU tuning is not available on this host"));
}
- } else {
- qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("CPU tuning is not available on this host"));
}
done:
--
1.7.4
13 years, 8 months
[libvirt] [PATCH] free tmp after unlinking it
by Wen Congyang
---
src/qemu/qemu_driver.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index dd12dc8..5aa715e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5065,9 +5065,9 @@ endjob:
vm = NULL;
cleanup:
- VIR_FREE(tmp);
VIR_FORCE_CLOSE(fd);
unlink (tmp);
+ VIR_FREE(tmp);
if (vm)
virDomainObjUnlock(vm);
return ret;
--
1.7.1
13 years, 8 months