[libvirt] [PATCH 3/6] Add logrotate support for libvirtd.log
by Daniel Veillard
As the file may grow quite a bit especially with debug turned on.
* daemon/libvirtd.logrotate.in daemon/Makefile.am libvirt.spec.in:
add new logrotate file for the daemon log
Signed-off-by: Daniel Veillard <veillard(a)redhat.com>
---
daemon/Makefile.am | 10 +++++++++-
daemon/libvirtd.logrotate.in | 9 +++++++++
libvirt.spec.in | 1 +
3 files changed, 19 insertions(+), 1 deletions(-)
create mode 100644 daemon/libvirtd.logrotate.in
13 years, 8 months
[libvirt] [PATCH 1/6] Force all logs to go to the round robbin memory buffer
by Daniel Veillard
Initially only the log actually written out by libvirt were
saved on the memory buffer, this patch forces all informations
including info and debug to be saved in memory too. This is
useful to get full data in case of crash.
Signed-off-by: Daniel Veillard <veillard(a)redhat.com>
---
src/util/logging.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
13 years, 8 months
[libvirt] [PATCH] Attempt to improve an error message
by Daniel P. Berrange
Replace the 'Unknown failure' error message with something a
little bit more descriptive.
* src/util/virterror.c: Improve error message
---
src/util/virterror.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/util/virterror.c b/src/util/virterror.c
index f1b79c8..aaa3720 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -248,7 +248,7 @@ virErrorGenericFailure(virErrorPtr err)
err->code = VIR_ERR_INTERNAL_ERROR;
err->domain = VIR_FROM_NONE;
err->level = VIR_ERR_ERROR;
- err->message = strdup(_("Unknown failure"));
+ err->message = strdup(_("An error occurred, but the cause is unknown"));
}
--
1.7.4
13 years, 8 months
[libvirt] [PATCH] qemu: avoid double close on domain restore
by Eric Blake
qemudDomainSaveImageStartVM was evil - it closed the incoming fd
argument on some, but not all, code paths, without informing the
caller about that action. No wonder that this resulted in
double-closes: https://bugzilla.redhat.com/show_bug.cgi?id=672725
* src/qemu/qemu_driver.c (qemudDomainSaveImageStartVM): Alter
signature, to avoid double-close.
(qemudDomainRestore, qemudDomainObjRestore): Update callers.
---
src/qemu/qemu_driver.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7fc08e8..5acddcb 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3248,7 +3248,7 @@ static int ATTRIBUTE_NONNULL(6)
qemudDomainSaveImageStartVM(virConnectPtr conn,
struct qemud_driver *driver,
virDomainObjPtr vm,
- int fd,
+ int *fd,
pid_t read_pid,
const struct qemud_save_header *header,
const char *path)
@@ -3273,20 +3273,21 @@ qemudDomainSaveImageStartVM(virConnectPtr conn,
if (header->compressed != QEMUD_SAVE_FORMAT_RAW) {
intermediate_argv[0] = prog;
- intermediatefd = fd;
- fd = -1;
+ intermediatefd = *fd;
+ *fd = -1;
if (virExec(intermediate_argv, NULL, NULL,
- &intermediate_pid, intermediatefd, &fd, NULL, 0) < 0) {
+ &intermediate_pid, intermediatefd, fd, NULL, 0) < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to start decompression binary %s"),
intermediate_argv[0]);
+ *fd = intermediatefd;
goto out;
}
}
}
/* Set the migration source and start it up. */
- ret = qemuProcessStart(conn, driver, vm, "stdio", true, fd, path,
+ ret = qemuProcessStart(conn, driver, vm, "stdio", true, *fd, path,
VIR_VM_OP_RESTORE);
if (intermediate_pid != -1) {
@@ -3295,7 +3296,7 @@ qemudDomainSaveImageStartVM(virConnectPtr conn,
* wait forever to write to stdout, so we must manually kill it.
*/
VIR_FORCE_CLOSE(intermediatefd);
- VIR_FORCE_CLOSE(fd);
+ VIR_FORCE_CLOSE(*fd);
kill(intermediate_pid, SIGTERM);
}
@@ -3307,8 +3308,8 @@ qemudDomainSaveImageStartVM(virConnectPtr conn,
}
VIR_FORCE_CLOSE(intermediatefd);
- wait_ret = qemudDomainSaveImageClose(fd, read_pid, &status);
- fd = -1;
+ wait_ret = qemudDomainSaveImageClose(*fd, read_pid, &status);
+ *fd = -1;
if (read_pid != -1) {
if (wait_ret == -1) {
virReportSystemError(errno,
@@ -3398,7 +3399,7 @@ static int qemudDomainRestore(virConnectPtr conn,
if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
goto cleanup;
- ret = qemudDomainSaveImageStartVM(conn, driver, vm, fd,
+ ret = qemudDomainSaveImageStartVM(conn, driver, vm, &fd,
read_pid, &header, path);
if (qemuDomainObjEndJob(vm) == 0)
@@ -3449,7 +3450,7 @@ static int qemudDomainObjRestore(virConnectPtr conn,
virDomainObjAssignDef(vm, def, true);
def = NULL;
- ret = qemudDomainSaveImageStartVM(conn, driver, vm, fd,
+ ret = qemudDomainSaveImageStartVM(conn, driver, vm, &fd,
read_pid, &header, path);
cleanup:
--
1.7.4
13 years, 8 months
[libvirt] [PATCH] add additional event debug points
by Eric Blake
From: Daniel P. Berrange <berrange(a)redhat.com>
Followup to commit 2222bd24
---
I'm working on debugging a delayed event flush, and Daniel pointed
me to this patch of his that I'm finding useful. Any objections
to committing this upstream?
src/remote/remote_driver.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 0be9c56..4ca52ba 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -9977,7 +9977,6 @@ processCallDispatchMessage(virConnectPtr conn, struct private_data *priv,
/* An async message has come in while we were waiting for the
* response. Process it to pull it off the wire, and try again
*/
- VIR_DEBUG0("Encountered an event while waiting for a response");
if (in_open) {
VIR_DEBUG("Ignoring bogus event %d received while in open", hdr->proc);
@@ -10017,6 +10016,7 @@ processCallDispatchMessage(virConnectPtr conn, struct private_data *priv,
VIR_DEBUG("Unexpected event proc %d", hdr->proc);
break;
}
+ VIR_DEBUG("Event ready for queue %p %p", event, conn);
if (!event)
return -1;
@@ -10674,6 +10674,7 @@ static void remoteDomainEventDispatchFunc(virConnectPtr conn,
/* Drop the lock whle dispatching, for sake of re-entrancy */
remoteDriverUnlock(priv);
+ VIR_DEBUG("Dispatch event %p %p", event, conn);
virDomainEventDispatchDefaultFunc(conn, event, cb, cbopaque, NULL);
remoteDriverLock(priv);
}
@@ -10687,6 +10688,7 @@ remoteDomainEventQueueFlush(int timer ATTRIBUTE_UNUSED, void *opaque)
remoteDriverLock(priv);
+ VIR_DEBUG("Event queue flush %p", conn);
priv->domainEventDispatching = 1;
/* Copy the queue, so we're reentrant safe */
--
1.7.4
13 years, 8 months
[libvirt] [libvirt-snmp][PATCH] Cleanup autotools files to produce rpmlint compliant rpms.
by Michal Privoznik
Added manpage for libvirtMib_subagent and ChangeLog generation.
---
INSTALL | 48 ------------------------
INSTALL.1st | 48 ++++++++++++++++++++++++
Makefile.am | 17 ++++++++-
NEWS | 3 +
configure.ac | 2 +-
docs/Makefile.am | 10 +++++
docs/libvirtMib_subagent.pod | 84 ++++++++++++++++++++++++++++++++++++++++++
libvirt-snmp.spec.in | 4 +-
8 files changed, 164 insertions(+), 52 deletions(-)
delete mode 100644 ChangeLog
delete mode 100644 INSTALL
create mode 100644 INSTALL.1st
create mode 100644 docs/Makefile.am
create mode 100644 docs/libvirtMib_subagent.pod
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index e69de29..0000000
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index 31345d8..0000000
--- a/INSTALL
+++ /dev/null
@@ -1,48 +0,0 @@
-To create configure script just run:
- autoreconf -i
-
-which runs aclocal, autoconf, automake and all other
-GNU Autotools in right order producing configure script,
-Makefile.in, etc.
-
-Then just run:
- ./configure
-
-which will check for dependencies (see src/README.txt
-for further info).
-
-Now it's time for make:
- make
- su -c "make install"
-
-This compile all sources producing runable SNMP subagent
-libvirtMib_subagent, which is installed right after.
-But before we run it, we need to edit /etc/snmp/snmpd.conf
-so it contains this two lines:
-
-rwcommunity public
-master agentx
-
-and then restart snmpd:
- /etc/init.d/snmpd restart
-
-Now it's the right time to run the subagent (as root):
- libvirtMib_subagent -f -L
-
-From now on, you can use SNMP tools to manipulate domains.
-E.g. to list domains:
- snmpwalk -m ALL -v 2c -c public localhost libvirtMIB
-or:
- snmptable -m ALL -v 2c -c public -Cb localhost libvirtGuestTable
-
-Note -m ALL switch witch load all MIBs installed.
-This is needed since we do have libvirt's MIB in
-the right place, but default it won't be loaded.
-The other way of solving this problem is to edit
-snmp.config, usually located in /etc/snmp/, or
-/usr/local/share/snmp.conf or per-user configuration
-$HOME/.snmp/snmp.conf. Or you can just run:
- net-snmp-config --snmpconfpath
-
-All you need to do is add:
- mibs +LIBVIRT-MIB
diff --git a/INSTALL.1st b/INSTALL.1st
new file mode 100644
index 0000000..31345d8
--- /dev/null
+++ b/INSTALL.1st
@@ -0,0 +1,48 @@
+To create configure script just run:
+ autoreconf -i
+
+which runs aclocal, autoconf, automake and all other
+GNU Autotools in right order producing configure script,
+Makefile.in, etc.
+
+Then just run:
+ ./configure
+
+which will check for dependencies (see src/README.txt
+for further info).
+
+Now it's time for make:
+ make
+ su -c "make install"
+
+This compile all sources producing runable SNMP subagent
+libvirtMib_subagent, which is installed right after.
+But before we run it, we need to edit /etc/snmp/snmpd.conf
+so it contains this two lines:
+
+rwcommunity public
+master agentx
+
+and then restart snmpd:
+ /etc/init.d/snmpd restart
+
+Now it's the right time to run the subagent (as root):
+ libvirtMib_subagent -f -L
+
+From now on, you can use SNMP tools to manipulate domains.
+E.g. to list domains:
+ snmpwalk -m ALL -v 2c -c public localhost libvirtMIB
+or:
+ snmptable -m ALL -v 2c -c public -Cb localhost libvirtGuestTable
+
+Note -m ALL switch witch load all MIBs installed.
+This is needed since we do have libvirt's MIB in
+the right place, but default it won't be loaded.
+The other way of solving this problem is to edit
+snmp.config, usually located in /etc/snmp/, or
+/usr/local/share/snmp.conf or per-user configuration
+$HOME/.snmp/snmp.conf. Or you can just run:
+ net-snmp-config --snmpconfpath
+
+All you need to do is add:
+ mibs +LIBVIRT-MIB
diff --git a/Makefile.am b/Makefile.am
index fae2848..36590dc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1 +1,16 @@
-SUBDIRS=src/
+SUBDIRS=src/ docs/
+
+EXTRA_DIST = \
+ libvirt-snmp.spec libvirt-snmp.spec.in \
+ autobuild.sh \
+ autogen.sh
+
+rpm: clean
+ @(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz)
+
+.PHONY: gen-Changelog
+gen-ChangeLog:
+ if [ -d .git ]; then \
+ git log --oneline | sed 's/[0-9a-f]* \(.*\)/\1/' > ChangeLog; \
+ fi
+
diff --git a/NEWS b/NEWS
index e69de29..6023f6b 100644
--- a/NEWS
+++ b/NEWS
@@ -0,0 +1,3 @@
+0.0.1: Feb 3 2011:
+ - Initial revision
+ - Basic libvirt functionality (get/set domain status)
diff --git a/configure.ac b/configure.ac
index a5fcb4e..468fb07 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,5 +86,5 @@ fi
AC_SUBST([MIB_DIR])
-AC_OUTPUT(Makefile src/Makefile libvirt-snmp.spec)
+AC_OUTPUT(Makefile src/Makefile docs/Makefile libvirt-snmp.spec)
diff --git a/docs/Makefile.am b/docs/Makefile.am
new file mode 100644
index 0000000..a9c66fb
--- /dev/null
+++ b/docs/Makefile.am
@@ -0,0 +1,10 @@
+POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)"
+
+EXTRA_DIST = \
+ libvirtMib_subagent.pod
+
+dist_man1_MANS = libvirtMib_subagent.1
+
+libvirtMib_subagent.1: libvirtMib_subagent.pod
+ $(AM_V_GEN)$(POD2MAN) $< $(srcdir)/$@
+
diff --git a/docs/libvirtMib_subagent.pod b/docs/libvirtMib_subagent.pod
new file mode 100644
index 0000000..96faaab
--- /dev/null
+++ b/docs/libvirtMib_subagent.pod
@@ -0,0 +1,84 @@
+=head1 NAME
+
+libvirtMib_subagent - SNMP subagent for libvirt
+
+=head1 SYNOPSIS
+
+B<libvirtMib_subagent> [I<OPTIONS>] [I<LISTENING ADDRESSES>]
+
+=head1 DESCRIPTION
+
+The B<libvirtMib_subagent> provides SNMP functionality for libvirt.
+Therefore it is now possible to gather and set domain status over
+SNMP from one place. This allows to create views of entire platforms
+end to end.
+
+It communicates with SNMP agent over AgentX protocol (RFC 2741) and
+extends agent's set of infomation provided. Therefore, we need a running
+SNMP agent. This behaviour can be avoided using I<-M> option.
+
+The B<libvirtMib_subagent> understands these I<OPTIONS>:
+
+=over 4
+
+=item B<-f>
+
+Don't fork. Run in foreground.
+
+=item B<-D>[I<token>[,I<...>]]
+
+Turn on debugging output for the given TOKEN(s).
+Without any tokens specified, it defaults to printing
+all the tokens (which is equivalent to the keyword 'C<ALL>').
+You might want to try ALL for extremely verbose output.
+B<Note>: You can't put a space between the B<-D> and the I<token>s.
+
+=item B<-H>
+
+Display a list of configuration file directives
+understood by the agent and then exit.
+
+=item B<-M>
+
+Run as a normal SNMP Agent instead of an AgentX sub-agent.
+
+=item B<-x>I<ADDRESS>
+
+Connect to master agent at ADDRESS (default C</var/agentx/master>). The address
+can either be a Unix domain socket path, or the address of a network interface.
+The format is the same as the format of listening addresses described below.
+
+=item B<-L>
+
+Do not open a log file; print all messages to stderr.
+
+=back
+
+The last optional I<LISTENING ADDRESSES> specify on which addresses should
+subagent running in normal SNMP Agent mode listen for incoming requests.
+See B<snmpd> for further information.
+
+=head1 BUGS
+
+Report any bugs discovered to the libvirt community via the mailing list
+"http://libvirt.org/contact.html" or bug tracker "http://libvirt.org/bugs.html".
+Alternatively report bugs to your software distributor / vendor.
+
+=head1 AUTHORS
+
+Please refer to the AUTHORS file distributed with libvirt.
+
+=head1 COPYRIGHT
+
+Copyright (C) 2011 Red Hat, Inc., and the authors listed in the
+libvirt-snmp AUTHORS file.
+
+=head1 LICENSE
+
+libvirt-snmp is distributed under the terms of the GNU GPL v3.
+This is free software; see the source for copying conditions.
+There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
+
+=head1 SEE ALSO
+L<snmpd>, L<http://www.libvirt.org>
+
diff --git a/libvirt-snmp.spec.in b/libvirt-snmp.spec.in
index 6082a7a..3a55503 100644
--- a/libvirt-snmp.spec.in
+++ b/libvirt-snmp.spec.in
@@ -6,7 +6,7 @@ Summary: SNMP functionality for libvirt
Group: Development/Libraries
License: GPLv3
URL: http://libvirt.org
-Source0: libvirt-snmp-%{version}.tar.gz
+Source0: http://www.libvirt.org/sources/snmp/libvirt-snmp-%{version}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: net-snmp-perl net-snmp net-snmp-utils net-snmp-devel libvirt-devel
@@ -38,7 +38,7 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/libvirtMib_subagent
%{_datadir}/snmp/mibs/LIBVIRT-MIB.txt
%doc README NEWS ChangeLog AUTHORS
-
+%{_mandir}/man1/libvirtMib_subagent.1*
%changelog
--
1.7.4
13 years, 8 months