[libvirt] [PATCH] Make QEMU text monitor parsing more robust
by Daniel P. Berrange
The QEMU 0.10.0 release (and possibly other 0.10.x) has a bug where
it sometimes/often forgets to display the initial monitor greeting
line, soley printing a (qemu). This in turn confuses the text
console parsing because it has a '(qemu)' it is not expecting. The
confusion results in a negative malloc. Bad things follow.
This re-writes the text console handling to be more robust. The key
idea is that it should only look for a (qemu), once it has seen the
original command echo'd back. This ensures it'll skip the bogus stray
(qemu) with broken QEMUs.
* src/qemu/qemu_monitor.c: Add some (disabled) debug code
* src/qemu/qemu_monitor_text.c: Re-write way command replies
are detected
---
src/qemu/qemu_monitor.c | 28 +++++++++++
src/qemu/qemu_monitor_text.c | 102 +++++++++++++++++++++++++++--------------
2 files changed, 95 insertions(+), 35 deletions(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index abb763c..103cf28 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -39,6 +39,8 @@
#define VIR_FROM_THIS VIR_FROM_QEMU
+#define QEMU_DEBUG_RAW_IO 0
+
struct _qemuMonitor {
virMutex lock;
virCond notify;
@@ -163,6 +165,24 @@ char *qemuMonitorEscapeShell(const char *in)
}
+#if QEMU_DEBUG_RAW_IO
+#include <c-ctype.h>
+static char * qemuMonitorEscapeNonPrintable(const char *text)
+{
+ int i;
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+ for (i = 0 ; text[i] != '\0' ; i++) {
+ if (c_isprint(text[i]) ||
+ text[i] == '\n' ||
+ (text[i] == '\r' && text[i+1] == '\n'))
+ virBufferVSprintf(&buf,"%c", text[i]);
+ else
+ virBufferVSprintf(&buf, "0x%02x", text[i]);
+ }
+ return virBufferContentAndReset(&buf);
+}
+#endif
+
void qemuMonitorLock(qemuMonitorPtr mon)
{
virMutexLock(&mon->lock);
@@ -282,7 +302,15 @@ qemuMonitorIOProcess(qemuMonitorPtr mon)
if (mon->msg && mon->msg->txOffset == mon->msg->txLength)
msg = mon->msg;
+#if QEMU_DEBUG_RAW_IO
+ char *str1 = qemuMonitorEscapeNonPrintable(msg ? msg->txBuffer : "");
+ char *str2 = qemuMonitorEscapeNonPrintable(mon->buffer);
+ VIR_ERROR("Process %d %p %p [[[[%s]]][[[%s]]]", (int)mon->bufferOffset, mon->msg, msg, str1, str2);
+ VIR_FREE(str1);
+ VIR_FREE(str2);
+#else
VIR_DEBUG("Process %d", (int)mon->bufferOffset);
+#endif
if (mon->json)
len = qemuMonitorJSONIOProcess(mon,
mon->buffer, mon->bufferOffset,
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 0d5ad79..72cb2bb 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -94,46 +94,78 @@ int qemuMonitorTextIOProcess(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
/* Look for a non-zero reply followed by prompt */
if (msg && !msg->finished) {
- const char *end;
-
- /* We might get a prompt for a password */
- end = strstr(data + used, PASSWORD_PROMPT);
- if (end) {
- VIR_DEBUG("Woooo passwowrd [%s]", data + used);
- if (msg->passwordHandler) {
- size_t consumed;
- /* Try and handle the prompt */
- if (msg->passwordHandler(mon, msg,
- data + used,
- len - used,
- msg->passwordOpaque) < 0)
- return -1;
+ char *start = NULL;
+ char *end = NULL;
+ char *skip;
- /* Skip over prompt now */
- consumed = (end + strlen(PASSWORD_PROMPT))
- - (data + used);
- used += consumed;
- } else {
- errno = EACCES;
- return -1;
+ /* If we're here, we've already sent the command. We now
+ * strip the trailing '\r' because it makes the matching
+ * code that follows a little easier ie we can just strstr()
+ * for the original command
+ */
+ if (msg->txLength > 0) {
+ char *tmp;
+ if ((tmp = strchr(msg->txBuffer, '\r'))) {
+ *tmp = '\0';
}
}
- /* We use the arrival of BASIC_PROMPT to detect when we've got a
- * complete reply available from a command */
- end = strstr(data + used, BASIC_PROMPT);
- if (end) {
- /* QEMU echos the command back to us, full of control
- * character junk that we don't want. Fortunately this
- * is all terminated by LINE_ENDING, so we can easily
- * skip over the control character junk */
- const char *start = strstr(data + used, LINE_ENDING);
- if (!start)
- start = data + used;
- else
- start += strlen(LINE_ENDING);
- int want = end - start;
+ /* QEMU echos the command back to us, full of control
+ * character junk that we don't want. We have to skip
+ * over this junk by looking for the first complete
+ * repetition of our command. Then we can look for
+ * the prompt that is supposed to follow
+ *
+ * NB, we can't optimize by immediately looking for
+ * LINE_ENDING, because QEMU 0.10 has bad problems
+ * when initially connecting where it might write a
+ * prompt in the wrong place. So we must not look
+ * for LINE_ENDING, or BASIC_PROMPT until we've
+ * seen our original command echod.
+ */
+ skip = strstr(data + used, msg->txBuffer);
+
+ /* After the junk we should have a line ending... */
+ if (skip) {
+ start = strstr(skip + strlen(msg->txBuffer), LINE_ENDING);
+ }
+
+ /* ... then our command reply data, following by a (qemu) prompt */
+ if (start) {
+ char *passwd;
+ start += strlen(LINE_ENDING);
+
+ /* We might get a prompt for a password before the (qemu) prompt */
+ passwd = strstr(start, PASSWORD_PROMPT);
+ if (passwd) {
+ VIR_DEBUG("Seen a passwowrd prompt [%s]", data + used);
+ if (msg->passwordHandler) {
+ int i;
+ /* Try and handle the prompt */
+ if (msg->passwordHandler(mon, msg,
+ start,
+ passwd - start + strlen(PASSWORD_PROMPT),
+ msg->passwordOpaque) < 0)
+ return -1;
+
+ /* Blank out the password prompt so we don't re-trigger
+ * if we have to go back to sleep for more I/O */
+ for (i = 0 ; i < strlen(PASSWORD_PROMPT) ; i++)
+ start[i] = ' ';
+
+ /* Handled, so skip forward over password prompt */
+ start = passwd;
+ } else {
+ errno = EACCES;
+ return -1;
+ }
+ }
+ end = strstr(start, BASIC_PROMPT);
+ }
+
+ if (start && end) {
+ int want = end - start;
/* Annoyingly some commands may not have any reply data
* at all upon success, but since we've detected the
* BASIC_PROMPT we can reasonably reliably cope */
--
1.6.5.2
14 years, 11 months
[libvirt] Functions issues
by Jaromír Červenka
Hi,
while writing SharpLibVirt I ran into several problems with some functions:
virDomainInterfaceStats
------------------------------------
It is not possible get any result, because of error "invalid argument
in invalid path, 'user.0' is not a known interface". But inside LOG
for this domain is
"... -net user,vlan=0,name=user.0 ... "
It is not possible get stats for nic.0 also. Tested on KVM hypervisor.
virStoragePoolIsActive and virStoragePoolIsPersistent
-------------------------------------------------------------------------------
Both cause crash of libvirt deamon. I dont know why.
Tested on 0.7.4 and Qemu 0.11.0
Thanks for answer,
Jaromír Červenka
Official openSUSE community member
Web: http://www.cervajz.com/
Jabber: cervajz(a)cervajz.com
MSN: jara.cervenka(a)seznam.cz
Tel.: +420 607 592 687
Alt. e-mails:
jaromir.cervenka(a)opensuse.org,
jaromir.cervenka(a)speel.cz
14 years, 11 months
[libvirt] [PATCH] Use AM_PATH_PYTHON and python-config to detect Python configuration
by Matthias Bolte
Using AM_PATH_PYTHON solves the site-packages directory problem. At least
in Ubuntu with Python 2.6 and later site-packages is renamed to dist-packages
and site-packages is not part of sys.path anymore. So installing the libvirt
Python bindings to site-packages renders them unusable, because they can be
imported from there without manually including site-packages into sys.path.
AM_PATH_PYTHON detects the correct site-packages/dist-packages directory.
python-config --includes gives the correct include path for the Python header
files. The old probing code stays there as fallback mechanism.
* configure.in: use AM_PATH_PYTHON and python-config
* python/Makefile.am: remove -I because PYTHON_INCLUDES contains it now
---
configure.in | 110 +++++++++++++++++++++++++---------------------------
python/Makefile.am | 2 +-
2 files changed, 54 insertions(+), 58 deletions(-)
diff --git a/configure.in b/configure.in
index f735bba..d6e5979 100644
--- a/configure.in
+++ b/configure.in
@@ -1414,75 +1414,71 @@ AC_ARG_WITH([python],
PYTHON_VERSION=
PYTHON_INCLUDES=
-PYTHON_SITE_PACKAGES=
-PYTHON_TESTS=
pythondir=
if test "$with_python" != "no" ; then
if test -x "$with_python/bin/python"
then
- echo Found python in $with_python/bin/python
+ AC_MSG_NOTICE(Found python in $with_python/bin/python)
PYTHON="$with_python/bin/python"
+ with_python=yes
else
- if test -x "$with_python"
- then
- echo Found python in $with_python
- PYTHON="$with_python"
- else
- if test -x "$PYTHON"
- then
- echo Found python in environment PYTHON=$PYTHON
- with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
- else
- AC_PATH_PROG([PYTHON], [python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5])
- fi
- fi
- fi
- if test "$PYTHON" != ""
- then
- PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
- echo Found Python version $PYTHON_VERSION
- fi
- if test "$PYTHON_VERSION" != ""
- then
- if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
- -d $with_python/lib/python$PYTHON_VERSION/site-packages
- then
- PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
- PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
- else
- if test -r $prefix/include/python$PYTHON_VERSION/Python.h
- then
- PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
- PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
- else
- if test -r /usr/include/python$PYTHON_VERSION/Python.h
- then
- PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
- PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
- else
- echo could not find python$PYTHON_VERSION/Python.h
- fi
- fi
- if test ! -d "$PYTHON_SITE_PACKAGES"
- then
- PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
- fi
- fi
+ if test -x "$with_python"
+ then
+ AC_MSG_NOTICE(Found python in $with_python)
+ PYTHON="$with_python"
+ with_python=yes
+ else
+ if test -x "$PYTHON"
+ then
+ AC_MSG_NOTICE(Found python in environment PYTHON=$PYTHON)
+ with_python=yes
+ fi
+ fi
fi
- if test "$with_python" != "yes"
- then
- pythondir='$(PYTHON_SITE_PACKAGES)'
+
+ if test "$with_python" == "yes" ; then
+ AM_PATH_PYTHON(,, [:])
+
+ if test "$PYTHON" != : ; then
+ PYTHON_CONFIG="$PYTHON-config"
+
+ if test -x "$PYTHON_CONFIG"
+ then
+ PYTHON_INCLUDES=`$PYTHON_CONFIG --includes`
+ else
+ if test -r $PYTHON_EXEC_PREFIX/include/python$PYTHON_VERSION/Python.h
+ then
+ PYTHON_INCLUDES=-I$PYTHON_EXEC_PREFIX/include/python$PYTHON_VERSION
+ else
+ if test -r $prefix/include/python$PYTHON_VERSION/Python.h
+ then
+ PYTHON_INCLUDES=-I$prefix/include/python$PYTHON_VERSION
+ else
+ if test -r /usr/include/python$PYTHON_VERSION/Python.h
+ then
+ PYTHON_INCLUDES=-I/usr/include/python$PYTHON_VERSION
+ else
+ AC_MSG_NOTICE([Could not find python$PYTHON_VERSION/Python.h, disabling bindings])
+ with_python=no
+ fi
+ fi
+ fi
+ fi
+ else
+ AC_MSG_NOTICE([Could not find python interpreter, disabling bindings])
+ with_python=no
+ fi
else
- pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+ AC_MSG_NOTICE([Could not find python in $with_python, disabling bindings])
+ with_python=no
fi
-else
- PYTHON=
fi
-AM_CONDITIONAL([WITH_PYTHON], test "$PYTHON_INCLUDES" != "")
-AC_SUBST([pythondir])
+AM_CONDITIONAL([WITH_PYTHON], [test "$with_python" = "yes"])
AC_SUBST([PYTHON_VERSION])
AC_SUBST([PYTHON_INCLUDES])
-AC_SUBST([PYTHON_SITE_PACKAGES])
+AC_SUBST([pythondir])
+
+
AC_MSG_CHECKING([whether this host is running a Xen kernel])
RUNNING_XEN=
diff --git a/python/Makefile.am b/python/Makefile.am
index cda6559..736631e 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -4,7 +4,7 @@ SUBDIRS= . tests
INCLUDES = \
$(WARN_CFLAGS) \
- -I$(PYTHON_INCLUDES) \
+ $(PYTHON_INCLUDES) \
-I$(top_srcdir)/include \
-I$(top_builddir)/include \
-I$(top_builddir)/$(subdir)
--
1.6.0.4
14 years, 11 months
[libvirt] [PATCH] Add missing commas to the 0.7.4 news section
by Matthias Bolte
---
docs/news.html.in | 428 ++++++++++++++++++++++++++--------------------------
1 files changed, 214 insertions(+), 214 deletions(-)
diff --git a/docs/news.html.in b/docs/news.html.in
index 47d7f42..3586071 100644
--- a/docs/news.html.in
+++ b/docs/news.html.in
@@ -3,240 +3,240 @@
<body>
<h1 >Releases</h1>
<p>Here is the list of official releases, however since it is early on in the
-development of libvirt, it is preferable when possible to just use the <a href="downloads.html">CVS version or snapshot</a>, contact the mailing list
+development of libvirt, it is preferable when possible to just use the <a href="downloads.html">GIT version or snapshot</a>, contact the mailing list
and check the <a href="ChangeLog.html">ChangeLog</a> to gauge progress.</p>
<h3>0.7.4: Nov 20 2009</h3>
<ul>
<li>Features:
- Implement a node device backend using libudev (David Allan)
- New APIs for checking some object properties (Daniel P. Berrange)
- Fully asynchronous monitor I/O processing (Daniel P. Berrange)
- add MAC address based port filtering to qemu (Gerhard Stenzel)
+ Implement a node device backend using libudev (David Allan),
+ New APIs for checking some object properties (Daniel P. Berrange),
+ Fully asynchronous monitor I/O processing (Daniel P. Berrange),
+ add MAC address based port filtering to qemu (Gerhard Stenzel),
Support for IPv6 / multiple addresses per interfaces (Laine Stump)
</li>
<li>Documentation:
- Document overriding domain interface target (Cole Robinson)
- 514532 Fix man page, most operation are synchronous (Daniel Veillard)
- Fix typo in error message (Matthew Booth)
- esx: Add documentation to the website (Matthias Bolte)
- AppArmor updates of examples (Jamie Strandboge)
- Add documentation for <channel> domain element (Matthew Booth)
- Separate character device doc guest and host parts (Matthew Booth)
- Add a Python example that lists active ESX domains (Matthias Bolte)
- LXC fix wrong or out-of-date function descriptions (Ryota Ozaki)
- docs: <clock> property is 'offset', not 'sync' (Cole Robinson)
- Update the documentation for virDomainMigrateToURI (Chris Lalancette)
+ Document overriding domain interface target (Cole Robinson),
+ 514532 Fix man page, most operation are synchronous (Daniel Veillard),
+ Fix typo in error message (Matthew Booth),
+ esx: Add documentation to the website (Matthias Bolte),
+ AppArmor updates of examples (Jamie Strandboge),
+ Add documentation for <channel> domain element (Matthew Booth),
+ Separate character device doc guest and host parts (Matthew Booth),
+ Add a Python example that lists active ESX domains (Matthias Bolte),
+ LXC fix wrong or out-of-date function descriptions (Ryota Ozaki),
+ docs: <clock> property is 'offset', not 'sync' (Cole Robinson),
+ Update the documentation for virDomainMigrateToURI (Chris Lalancette),
fix virDomainMigrateToURI doc (Dan Kenigsberg)
</li>
<li>Bug fixes:
- 504262 Check for duplicated UUID in XM Xen defines (Daniel Veillard)
- 512069 fix domain XML schemas for backward compatibility (Daniel Veillard)
- qemu-kvm needs -enable-kvm flag for VT optimization (Steve Yarmie)
- fix deprecated iptables command syntax (Steve Yarmie)
- Ensure driver lock is released when entering QEMU monitor (Daniel P. Berrange)
- only remove masquerade roles for VIR_NETWORK_FORWARD_NAT (Guido Günther)
- esx: Fix CPU clock Hz to MHz conversion (Matthias Bolte)
- esx: Fix memory leak in esxVI_HostCpuIdInfo_Free() (Matthias Bolte)
- esx: Fix MAC address formatting (Matthias Bolte)
- Fix compilation of libvirt against xen-unstable (Jim Fehlig)
- Fix probing for libpciaccess (Daniel P. Berrange)
- Fix incorrect reference counting logic in qemu monitor open (Daniel P. Berrange)
- Don't return fatal error in HAL driver init if HAL isn't running (Daniel P. Berrange)
- Fix cleanup when state driver init fails (Daniel P. Berrange)
- AppArmor handling of accesses to readonly files (Jamie Strandboge)
- AppArmor require absolute paths (Jamie Strandboge)
- Check that domain is running when starting console (Daniel P. Berrange)
- Fix incorrect variable passed to LXC event callback (Daniel P. Berrange)
- Fix race condition in HAL driver startup (Daniel P. Berrange)
- Remove capng_lock() call when spawning LXC container init process (Daniel P. Berrange)
- Fix initscript to check daemon pidfile (Daniel P. Berrange)
- Filter out stale domains from xenstore listing (Daniel P. Berrange)
- Fix logic in xenUnifiedNumOfDomains to match xenUnifiedListDomains (Jonas Eriksson)
- Disable IPv6 socket auto-binding to IPv4 socket (Daniel P. Berrange)
- Fix save and restore with non-privileged guests and SELinux (Daniel P. Berrange)
- Prevent initializing ebtables if disabled in qemu.conf (Ryota Ozaki)
- phyp: too much timeout when polling socket (Eduardo Otubo)
- phyp: ssh authentication with public key fixed (Eduardo Otubo)
- opennebula: Fix potential memory/mutex leak in state driver startup (Matthias Bolte)
- phyp: Break potential infinite loops (Matthias Bolte)
- phyp: Fix memory/session leaks and potential invalid frees (Matthias Bolte)
- storage: conf: Fix memory leak in encryption parsing (Cole Robinson)
- Fix improper error return in virInterfaceDefParseProtoIPvX (Laine Stump)
- Fix virInterfaceIpDefPtr leak during virInterfaceIpDefFree (Laine Stump)
- give up python interpreter lock before calling cb (Dan Kenigsberg)
- ESX: Fix memory leak in list handling functions. (Matthias Bolte)
- Fix --with-init-script configure option (Matthew Booth)
- Don't let parent of daemon exit until basic initialization is done (Daniel P. Berrange)
- Fix configure detection of device mapper (Pritesh Kothari)
- Remote code caught EINTR making it ininterruptable (Daniel Veillard)
- virterror: Add a missing 'break' for VIR_ERR_INVALID_SECRET (Cole Robinson)
- Fix p2p migration without a passed uri. (Cole Robinson)
- Fix problems in the Xen inotify driver. (Matthias Bolte)
- Remove a completely bogus reference increment in the Xen driver. (Chris Lalancette)
- 528575 avoid libvirtd crash on LCX domain autostart (Daniel Veillard)
- Fix SELinux linking issues (Jim Fehlig)
- node device: Fix locking issue in virNodeDeviceDestroy (Cole Robinson)
- LXC fix virCgroupGetValueStr problem with \n (Ryota Ozaki)
- Avoid crash in virBufferEscapeString (Laine Stump)
+ 504262 Check for duplicated UUID in XM Xen defines (Daniel Veillard),
+ 512069 fix domain XML schemas for backward compatibility (Daniel Veillard),
+ qemu-kvm needs -enable-kvm flag for VT optimization (Steve Yarmie),
+ fix deprecated iptables command syntax (Steve Yarmie),
+ Ensure driver lock is released when entering QEMU monitor (Daniel P. Berrange),
+ only remove masquerade roles for VIR_NETWORK_FORWARD_NAT (Guido Günther),
+ esx: Fix CPU clock Hz to MHz conversion (Matthias Bolte),
+ esx: Fix memory leak in esxVI_HostCpuIdInfo_Free() (Matthias Bolte),
+ esx: Fix MAC address formatting (Matthias Bolte),
+ Fix compilation of libvirt against xen-unstable (Jim Fehlig),
+ Fix probing for libpciaccess (Daniel P. Berrange),
+ Fix incorrect reference counting logic in qemu monitor open (Daniel P. Berrange),
+ Don't return fatal error in HAL driver init if HAL isn't running (Daniel P. Berrange),
+ Fix cleanup when state driver init fails (Daniel P. Berrange),
+ AppArmor handling of accesses to readonly files (Jamie Strandboge),
+ AppArmor require absolute paths (Jamie Strandboge),
+ Check that domain is running when starting console (Daniel P. Berrange),
+ Fix incorrect variable passed to LXC event callback (Daniel P. Berrange),
+ Fix race condition in HAL driver startup (Daniel P. Berrange),
+ Remove capng_lock() call when spawning LXC container init process (Daniel P. Berrange),
+ Fix initscript to check daemon pidfile (Daniel P. Berrange),
+ Filter out stale domains from xenstore listing (Daniel P. Berrange),
+ Fix logic in xenUnifiedNumOfDomains to match xenUnifiedListDomains (Jonas Eriksson),
+ Disable IPv6 socket auto-binding to IPv4 socket (Daniel P. Berrange),
+ Fix save and restore with non-privileged guests and SELinux (Daniel P. Berrange),
+ Prevent initializing ebtables if disabled in qemu.conf (Ryota Ozaki),
+ phyp: too much timeout when polling socket (Eduardo Otubo),
+ phyp: ssh authentication with public key fixed (Eduardo Otubo),
+ opennebula: Fix potential memory/mutex leak in state driver startup (Matthias Bolte),
+ phyp: Break potential infinite loops (Matthias Bolte),
+ phyp: Fix memory/session leaks and potential invalid frees (Matthias Bolte),
+ storage: conf: Fix memory leak in encryption parsing (Cole Robinson),
+ Fix improper error return in virInterfaceDefParseProtoIPvX (Laine Stump),
+ Fix virInterfaceIpDefPtr leak during virInterfaceIpDefFree (Laine Stump),
+ give up python interpreter lock before calling cb (Dan Kenigsberg),
+ ESX: Fix memory leak in list handling functions. (Matthias Bolte),
+ Fix --with-init-script configure option (Matthew Booth),
+ Don't let parent of daemon exit until basic initialization is done (Daniel P. Berrange),
+ Fix configure detection of device mapper (Pritesh Kothari),
+ Remote code caught EINTR making it ininterruptable (Daniel Veillard),
+ virterror: Add a missing 'break' for VIR_ERR_INVALID_SECRET (Cole Robinson),
+ Fix p2p migration without a passed uri. (Cole Robinson),
+ Fix problems in the Xen inotify driver. (Matthias Bolte),
+ Remove a completely bogus reference increment in the Xen driver. (Chris Lalancette),
+ 528575 avoid libvirtd crash on LCX domain autostart (Daniel Veillard),
+ Fix SELinux linking issues (Jim Fehlig),
+ node device: Fix locking issue in virNodeDeviceDestroy (Cole Robinson),
+ LXC fix virCgroupGetValueStr problem with \n (Ryota Ozaki),
+ Avoid crash in virBufferEscapeString (Laine Stump),
LXC complement PATH environment variable (Ryota Ozaki)
</li>
<li>Improvements:
- Enable udev instead of hal on F12 / RHEL-6 or later (Daniel P. Berrange)
- python: Actually implement list*Interfaces bindings (Cole Robinson)
- esx: Handle 'vmxnet3' in esxVMX_FormatEthernet() (Matthias Bolte)
- Fix check for existance of cgroups at creation (Daniel P. Berrange)
- Fix virt-aa-helper when host and os.type arch differ (Jamie Strandboge)
- Add translation of PCI vendor and product IDs (David Allan)
- Add scsi_target device type (David Allan)
- Add several fields to node device capabilities (David Allan)
- Add virConnectGetLibvirtVersion API (Cole Robinson)
- Implement finer grained migration control for Xen (Maximilian Wilhelm)
- Support for SATA Disks in virDomainDiskBus (pritesh)
- LXC implement missing DomainInterfaceStats API (Ryota Ozaki)
- disable mac_filter config switch by default (Gerhard Stenzel)
- phyp: Reorder keyboard_interactive label in openSSHSession() (Eduardo Otubo)
- Implmentation of new APIs to checking state/persistence of objects (Daniel P. Berrange)
- Allow timeouts waiting for QEMU job lock (Daniel P. Berrange)
- Release driver and domain lock when running monitor commands (Daniel P. Berrange)
- Add reference counting on virDomainObjPtr objects (Daniel P. Berrange)
- Locking of the qemuMonitorPtr object (Daniel P. Berrange)
- Wrap text mode monitor APIs, pass qemuMonitorPtr directly to APIs (Daniel P. Berrange)
- Move encryption lookup back into qemu driver file (Daniel P. Berrange)
- Make use of private data structure for monitor state (Daniel P. Berrange)
- Add a new timed condition variable wait API (Daniel P. Berrange)
- Fix errno handling for pthreads wrappers (Daniel P. Berrange)
- 524280 pass max lease option to dnsmasq (Daniel Veillard)
- Store the range size when adding a DHCP range (Daniel Veillard)
- qemu: Allow cpu pinning for all logical CPUs, not just physical (Cole Robinson)
- qemu: Use same create/define overwrite logic for migration prepare. (Cole Robinson)
- qemu: Break out function to check if we can create/define/restore (Cole Robinson)
- Add sentinel attribute for NULL terminated arg lists (Paolo Bonzini)
- test: Update inactive guest config on shutdown (Cole Robinson)
- test: Add testDomainShutdownState helper (Cole Robinson)
- Properly convert port numbers to/from network byte order (Matthew Booth)
- phyp add create() and destroy() support (Eduardo Otubo)
- Support for <channel> in domain and QEmu backend (Matthew Booth)
- Detect availability of QEMU -chardev CLI option (Matthew Booth)
- Allow character devices to have different target types (Matthew Booth)
- LXC allow container to have ethN interfaces (Ryota Ozaki)
- New ebtables module wrapper (Gerhard Stenzel)
- test: Implement virDomainPinVcpu (Cole Robinson)
- test: Implement virDomainGetVcpus (Cole Robinson)
- test: Update vcpu runtime info in SetVcpus (Cole Robinson)
- test: Use privateData to track running VM vcpu state (Cole Robinson)
- test: Break out wrapper for setting up started domain state. (Cole Robinson)
- test: Fixes for SetVcpus (Cole Robinson)
- Make monitor type (miimon/arpmon) optional in bond xml (Laine Stump)
- Support reporting live interface IP/netmask (Laine Stump)
- Make startmode optional in toplevel interface definition (Laine Stump)
- Move libvirtd event loop into background thread (Daniel P. Berrange)
- Allow NULL mac address in virGetInterface (Laine Stump)
- ESX: Don't automatically follow redirects. (Matthias Bolte)
- ESX: Change disk selection for datastore detection. (Matthias Bolte)
- ESX: Fallback to the preliminary name if the datastore cannot be found. (Matthias Bolte)
- Set KMEMSIZE for OpenVZ domains being defined (Yuji NISHIDA)
- Allow for a driver specific private data blob in virDomainObjPtr (Daniel P. Berrange)
- More network utility functions (Matthew Booth)
- Add symbols from new network.h module (Daniel Veillard)
- Set of new network related utilities (Daniel Veillard)
- Convert virDomainObjListPtr to use a hash of domain objects (Daniel P. Berrange)
- qemu: migrate: Don't require manual URI to specify a port (Cole Robinson)
- test: Support virStorageFindPoolSources (Cole Robinson)
- storage: Add ParseSourceString function for use with FindPoolSources. (Cole Robinson)
- Add support for an external TFTP boot server (Paolo Bonzini)
- test: Support virNodeDeviceCreate and virNodeDeviceDestroy (Cole Robinson)
- Consolidate virXPathNodeSet() (Daniel Veillard)
- Support QEMU watchdog device. (Richard Jones)
- Do not log rotate very small logs (Dan Kenigsberg)
- LXC implement missing macaddr assignment feature (Ryota Ozaki)
- tests: Initialize virRandom in for test suite. (Cole Robinson)
- tests: Add storage volume XML 2 XML tests. (Cole Robinson)
- tests: Add network XML to XML tests. (Cole Robinson)
- schema: Update network schema. (Cole Robinson)
- tests: Add XML 2 XML tests for storage pools. (Cole Robinson)
- tests: Break out duplicate schema verification functionality. (Cole Robinson)
- tests: Fix text output for interface XML 2 XML (Cole Robinson)
- Add ocfs2 to list of fs pool types (Jim Fehlig)
+ Enable udev instead of hal on F12 / RHEL-6 or later (Daniel P. Berrange),
+ python: Actually implement list*Interfaces bindings (Cole Robinson),
+ esx: Handle 'vmxnet3' in esxVMX_FormatEthernet() (Matthias Bolte),
+ Fix check for existance of cgroups at creation (Daniel P. Berrange),
+ Fix virt-aa-helper when host and os.type arch differ (Jamie Strandboge),
+ Add translation of PCI vendor and product IDs (David Allan),
+ Add scsi_target device type (David Allan),
+ Add several fields to node device capabilities (David Allan),
+ Add virConnectGetLibvirtVersion API (Cole Robinson),
+ Implement finer grained migration control for Xen (Maximilian Wilhelm),
+ Support for SATA Disks in virDomainDiskBus (pritesh),
+ LXC implement missing DomainInterfaceStats API (Ryota Ozaki),
+ disable mac_filter config switch by default (Gerhard Stenzel),
+ phyp: Reorder keyboard_interactive label in openSSHSession() (Eduardo Otubo),
+ Implmentation of new APIs to checking state/persistence of objects (Daniel P. Berrange),
+ Allow timeouts waiting for QEMU job lock (Daniel P. Berrange),
+ Release driver and domain lock when running monitor commands (Daniel P. Berrange),
+ Add reference counting on virDomainObjPtr objects (Daniel P. Berrange),
+ Locking of the qemuMonitorPtr object (Daniel P. Berrange),
+ Wrap text mode monitor APIs, pass qemuMonitorPtr directly to APIs (Daniel P. Berrange),
+ Move encryption lookup back into qemu driver file (Daniel P. Berrange),
+ Make use of private data structure for monitor state (Daniel P. Berrange),
+ Add a new timed condition variable wait API (Daniel P. Berrange),
+ Fix errno handling for pthreads wrappers (Daniel P. Berrange),
+ 524280 pass max lease option to dnsmasq (Daniel Veillard),
+ Store the range size when adding a DHCP range (Daniel Veillard),
+ qemu: Allow cpu pinning for all logical CPUs, not just physical (Cole Robinson),
+ qemu: Use same create/define overwrite logic for migration prepare. (Cole Robinson),
+ qemu: Break out function to check if we can create/define/restore (Cole Robinson),
+ Add sentinel attribute for NULL terminated arg lists (Paolo Bonzini),
+ test: Update inactive guest config on shutdown (Cole Robinson),
+ test: Add testDomainShutdownState helper (Cole Robinson),
+ Properly convert port numbers to/from network byte order (Matthew Booth),
+ phyp add create() and destroy() support (Eduardo Otubo),
+ Support for <channel> in domain and QEmu backend (Matthew Booth),
+ Detect availability of QEMU -chardev CLI option (Matthew Booth),
+ Allow character devices to have different target types (Matthew Booth),
+ LXC allow container to have ethN interfaces (Ryota Ozaki),
+ New ebtables module wrapper (Gerhard Stenzel),
+ test: Implement virDomainPinVcpu (Cole Robinson),
+ test: Implement virDomainGetVcpus (Cole Robinson),
+ test: Update vcpu runtime info in SetVcpus (Cole Robinson),
+ test: Use privateData to track running VM vcpu state (Cole Robinson),
+ test: Break out wrapper for setting up started domain state. (Cole Robinson),
+ test: Fixes for SetVcpus (Cole Robinson),
+ Make monitor type (miimon/arpmon) optional in bond xml (Laine Stump),
+ Support reporting live interface IP/netmask (Laine Stump),
+ Make startmode optional in toplevel interface definition (Laine Stump),
+ Move libvirtd event loop into background thread (Daniel P. Berrange),
+ Allow NULL mac address in virGetInterface (Laine Stump),
+ ESX: Don't automatically follow redirects. (Matthias Bolte),
+ ESX: Change disk selection for datastore detection. (Matthias Bolte),
+ ESX: Fallback to the preliminary name if the datastore cannot be found. (Matthias Bolte),
+ Set KMEMSIZE for OpenVZ domains being defined (Yuji NISHIDA),
+ Allow for a driver specific private data blob in virDomainObjPtr (Daniel P. Berrange),
+ More network utility functions (Matthew Booth),
+ Add symbols from new network.h module (Daniel Veillard),
+ Set of new network related utilities (Daniel Veillard),
+ Convert virDomainObjListPtr to use a hash of domain objects (Daniel P. Berrange),
+ qemu: migrate: Don't require manual URI to specify a port (Cole Robinson),
+ test: Support virStorageFindPoolSources (Cole Robinson),
+ storage: Add ParseSourceString function for use with FindPoolSources. (Cole Robinson),
+ Add support for an external TFTP boot server (Paolo Bonzini),
+ test: Support virNodeDeviceCreate and virNodeDeviceDestroy (Cole Robinson),
+ Consolidate virXPathNodeSet() (Daniel Veillard),
+ Support QEMU watchdog device. (Richard Jones),
+ Do not log rotate very small logs (Dan Kenigsberg),
+ LXC implement missing macaddr assignment feature (Ryota Ozaki),
+ tests: Initialize virRandom in for test suite. (Cole Robinson),
+ tests: Add storage volume XML 2 XML tests. (Cole Robinson),
+ tests: Add network XML to XML tests. (Cole Robinson),
+ schema: Update network schema. (Cole Robinson),
+ tests: Add XML 2 XML tests for storage pools. (Cole Robinson),
+ tests: Break out duplicate schema verification functionality. (Cole Robinson),
+ tests: Fix text output for interface XML 2 XML (Cole Robinson),
+ Add ocfs2 to list of fs pool types (Jim Fehlig),
Finer grained migration control (Chris Lalancette)
</li>
<li>Cleanups:
- remove sysfs_path and parent_sysfs_path from XML (Dave Allan)
- Removing devicePath member from dev struct (Dave Allan)
- report OOM in two places in node_device_driver.c (Dave Allan)
- Whitespace cleanup for pre-tags on the website (Matthias Bolte)
- Fix type in configure output summary (Daniel P. Berrange)
- Remove a compilation warning on uninitialized var (Daniel Veillard)
- Change DTD references to use public instead of system identifier (Matthias Bolte)
- Remove obsolete devicekit checks (Daniel P. Berrange)
- Small guestfwd code cleanup (Matthew Booth)
- Small indentation cleanup of domain schema (Matthew Booth)
- AppArmor code cleanups (Jamie Strandboge)
- Fix formatting of XML for an inactive guest (Daniel P. Berrange)
- Remove DevKit node device backend (David Allan)
- Exclude numactl on s390[x] (Daniel P. Berrange)
- Fix error handling in qemuMonitorOpen (Ryota Ozaki)
- Fix warning on make due to missing cast (int) (Ryota Ozaki)
- Various fixes following a code review part 2 (Daniel Veillard)
- Various fixes following a code review (Daniel Veillard)
- Move code for low level QEMU monitor interaction into separate file (Daniel P. Berrange)
- Make pciDeviceList struct opaque (Daniel P. Berrange)
- Add missing OOM error checks, reports and cleanups (Matthias Bolte)
- Removes the ebtablesSaveRules() function (Gerhard Stenzel)
- phyp: Use actual error code instead of 0 (Matthias Bolte)
- phyp: Don't use VIR_ALLOC if a stack variable is good enough (Matthias Bolte)
- phyp: Fix several UUID table related problems (Matthias Bolte)
- phyp: Check for exit_status < 0 before parsing the result (Matthias Bolte)
- phyp: memcpy/memmove/memset can't fail, so don't check for error (Matthias Bolte)
- phyp: Make generic domain listing functions return -1 in case of error (Matthias Bolte)
- Fix configure check for libssh2 (Matthias Bolte)
- Repair getIPv4Addr after the ntohl conversion (Daniel Veillard)
- Cleanup whitespace in docs (Matthew Booth)
- Use virBuffer when building QEMU char dev command line (Matthew Booth)
- Cleanup virBuffer usage in qemdBuildCommandLine (Matthew Booth)
- Fix some cut-and-paste error in migration code (Paolo Bonzini)
- Ensure guestfwd address is IPv4 and various cleanups (Matthew Booth)
- LXC cleanup deep indentation in lxcDomainSetAutostart (Ryota Ozaki)
- LXC messages cleanup and fix lxcError (Ryota Ozaki)
- qemu: Remove compiled out localhost migration support (Cole Robinson)
- Various error reporting fixes (Cole Robinson)
- Improve error reporting for virConnectGetHostname calls (Cole Robinson)
- Fix up NLS warnings. (Chris Lalancette)
- Remove redundant virFileDeletePID() call (Chris Lalancette)
- Fix return value in virStateInitialize impl for LXC (Daniel P. Berrange)
- ESX: Unify naming of VI API utility and convenience functions. (Matthias Bolte)
- Rename internal APis (Daniel P. Berrange)
- Pull signal setup code out into separate method (Daniel P. Berrange)
- Fix duplicating logging of errors in libvirtd (Daniel P. Berrange)
- Fix initialization order bugs (Daniel P. Berrange)
- Misc cleanup to network socket init (Daniel P. Berrange)
- Annotate many methods with ATTRIBUTE_RETURN_CHECK & fix problems (Daniel P. Berrange)
- Don't use private struct member names of in6_addr (Matthias Bolte)
- Fix typo in network.c function comments (Matthew Booth)
- libvirt-devel should only require libvirt-client (Mark McLoughlin)
- qemu: Fix an error message in GetVcpus (Cole Robinson)
- storage: Break out function to add pool source to a SourceList. (Cole Robinson)
- storage: Break out pool source parsing to a separate function. (Cole Robinson)
- Fix some typos in comments (Dan Kenigsberg)
- Fix error message in qemudLoadDriverConfig() (Matthias Bolte)
- Add a new syntax-check rule for gethostname. (Chris Lalancette)
- Various syntax-check fixes. (Chris Lalancette)
- Tighten up nonreentrant syntax-check. (Chris Lalancette)
- Replace a gethostname by virGetHostname in libvirtd.c (Chris Lalancette)
- Replace two strcmp() by STREQ() in qemu_driver.c (Chris Lalancette)
- Replace gethostname by virGetHostname in xend_internal.c (Chris Lalancette)
- Add a default log_level to qemudSetLogging to remove a build warning. (Chris Lalancette)
- Better error message when libvirtd fails to start. (Chris Lalancette)
- Fix potential false-positive OOM error reporting. (Matthias Bolte)
- Fix virsh.c compilation warning (Jim Fehlig)
- Fix a make dist error due to wrong EXTRA_DIST paths (Daniel Veillard)
- node device: Break out get_wwns and get_parent_node helpers (Cole Robinson)
- tests: Centralize VIR_TEST_DEBUG lookup, and document it (Cole Robinson)
- Remove bogus const annotations to hash iterator (Daniel P. Berrange)
- Remove bashisms from schema tests. (Matthias Bolte)
+ remove sysfs_path and parent_sysfs_path from XML (Dave Allan),
+ Removing devicePath member from dev struct (Dave Allan),
+ report OOM in two places in node_device_driver.c (Dave Allan),
+ Whitespace cleanup for pre-tags on the website (Matthias Bolte),
+ Fix type in configure output summary (Daniel P. Berrange),
+ Remove a compilation warning on uninitialized var (Daniel Veillard),
+ Change DTD references to use public instead of system identifier (Matthias Bolte),
+ Remove obsolete devicekit checks (Daniel P. Berrange),
+ Small guestfwd code cleanup (Matthew Booth),
+ Small indentation cleanup of domain schema (Matthew Booth),
+ AppArmor code cleanups (Jamie Strandboge),
+ Fix formatting of XML for an inactive guest (Daniel P. Berrange),
+ Remove DevKit node device backend (David Allan),
+ Exclude numactl on s390[x] (Daniel P. Berrange),
+ Fix error handling in qemuMonitorOpen (Ryota Ozaki),
+ Fix warning on make due to missing cast (int) (Ryota Ozaki),
+ Various fixes following a code review part 2 (Daniel Veillard),
+ Various fixes following a code review (Daniel Veillard),
+ Move code for low level QEMU monitor interaction into separate file (Daniel P. Berrange),
+ Make pciDeviceList struct opaque (Daniel P. Berrange),
+ Add missing OOM error checks, reports and cleanups (Matthias Bolte),
+ Removes the ebtablesSaveRules() function (Gerhard Stenzel),
+ phyp: Use actual error code instead of 0 (Matthias Bolte),
+ phyp: Don't use VIR_ALLOC if a stack variable is good enough (Matthias Bolte),
+ phyp: Fix several UUID table related problems (Matthias Bolte),
+ phyp: Check for exit_status < 0 before parsing the result (Matthias Bolte),
+ phyp: memcpy/memmove/memset can't fail, so don't check for error (Matthias Bolte),
+ phyp: Make generic domain listing functions return -1 in case of error (Matthias Bolte),
+ Fix configure check for libssh2 (Matthias Bolte),
+ Repair getIPv4Addr after the ntohl conversion (Daniel Veillard),
+ Cleanup whitespace in docs (Matthew Booth),
+ Use virBuffer when building QEMU char dev command line (Matthew Booth),
+ Cleanup virBuffer usage in qemdBuildCommandLine (Matthew Booth),
+ Fix some cut-and-paste error in migration code (Paolo Bonzini),
+ Ensure guestfwd address is IPv4 and various cleanups (Matthew Booth),
+ LXC cleanup deep indentation in lxcDomainSetAutostart (Ryota Ozaki),
+ LXC messages cleanup and fix lxcError (Ryota Ozaki),
+ qemu: Remove compiled out localhost migration support (Cole Robinson),
+ Various error reporting fixes (Cole Robinson),
+ Improve error reporting for virConnectGetHostname calls (Cole Robinson),
+ Fix up NLS warnings. (Chris Lalancette),
+ Remove redundant virFileDeletePID() call (Chris Lalancette),
+ Fix return value in virStateInitialize impl for LXC (Daniel P. Berrange),
+ ESX: Unify naming of VI API utility and convenience functions. (Matthias Bolte),
+ Rename internal APis (Daniel P. Berrange),
+ Pull signal setup code out into separate method (Daniel P. Berrange),
+ Fix duplicating logging of errors in libvirtd (Daniel P. Berrange),
+ Fix initialization order bugs (Daniel P. Berrange),
+ Misc cleanup to network socket init (Daniel P. Berrange),
+ Annotate many methods with ATTRIBUTE_RETURN_CHECK & fix problems (Daniel P. Berrange),
+ Don't use private struct member names of in6_addr (Matthias Bolte),
+ Fix typo in network.c function comments (Matthew Booth),
+ libvirt-devel should only require libvirt-client (Mark McLoughlin),
+ qemu: Fix an error message in GetVcpus (Cole Robinson),
+ storage: Break out function to add pool source to a SourceList. (Cole Robinson),
+ storage: Break out pool source parsing to a separate function. (Cole Robinson),
+ Fix some typos in comments (Dan Kenigsberg),
+ Fix error message in qemudLoadDriverConfig() (Matthias Bolte),
+ Add a new syntax-check rule for gethostname. (Chris Lalancette),
+ Various syntax-check fixes. (Chris Lalancette),
+ Tighten up nonreentrant syntax-check. (Chris Lalancette),
+ Replace a gethostname by virGetHostname in libvirtd.c (Chris Lalancette),
+ Replace two strcmp() by STREQ() in qemu_driver.c (Chris Lalancette),
+ Replace gethostname by virGetHostname in xend_internal.c (Chris Lalancette),
+ Add a default log_level to qemudSetLogging to remove a build warning. (Chris Lalancette),
+ Better error message when libvirtd fails to start. (Chris Lalancette),
+ Fix potential false-positive OOM error reporting. (Matthias Bolte),
+ Fix virsh.c compilation warning (Jim Fehlig),
+ Fix a make dist error due to wrong EXTRA_DIST paths (Daniel Veillard),
+ node device: Break out get_wwns and get_parent_node helpers (Cole Robinson),
+ tests: Centralize VIR_TEST_DEBUG lookup, and document it (Cole Robinson),
+ Remove bogus const annotations to hash iterator (Daniel P. Berrange),
+ Remove bashisms from schema tests. (Matthias Bolte),
Don't copy old machines from a domain which has none (Mark McLoughlin)
</li>
</ul>
--
1.6.0.4
14 years, 11 months
[libvirt] [PATCH] Fix potential double free in virDomainObjParseXML()
by Matthias Bolte
---
src/conf/domain_conf.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6a8fd5d..8730f37 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3493,6 +3493,7 @@ static virDomainObjPtr virDomainObjParseXML(virConnectPtr conn,
error:
VIR_FREE(nodes);
virDomainChrDefFree(obj->monitor_chr);
+ obj->monitor_chr = NULL;
virDomainObjUnref(obj);
return NULL;
}
--
1.6.0.4
14 years, 11 months
[libvirt] C# (Mono) bindings for libvirt - SharpLibVirt
by Jaromír Červenka
Hello,
following the example of email Richard W.M. Jones
(https://www.redhat.com/archives/libvir-list/2008-September/msg00283.html),
I decided to write libvirt interface for Mono. Everything is
implemented in one C# file, including in-line help (see
http://download.cervajz.com/sharplibvirt.png) which is taken from API
documentation. All functions wich are implemented were tested on KVM
hypervisor.
Everything revolves around a few objects. It is possible call libvirt
functions directly thru static class SharpLibVirt.libvirt
(SharpLibVirt. virterror) or use my "helpers objects" -
SharpLibVirt.slvConnection, SharpLibVirt.slvDomain,
SharpLibVirt.slvStoragePool, SharpLibVirt.slvStorageVol, etc...
Current status of binding is:
Version: 0.7.4
virConnect: 95%
virDommain: 95%
virEvent: 0%
virInterface: 0%
virNetwork: 0% (I am currently working on it)
virNodeDevice: 0%
virNode: 98%
virSecret: 0%
virStoragePool: 100%
virStorageVol: 100%
virStream: 0%
Others: 100%
-----
virterror: 100%
In the future I will keep SharpLibVirt up to date by C headers.
Greetings,
Jaromír "Cervajz" Červenka
Official openSUSE community member
Web: http://www.cervajz.com/
Jabber: cervajz(a)cervajz.com
MSN: jara.cervenka(a)seznam.cz
Tel.: +420 607 592 687
Alt. e-mails:
jaromir.cervenka(a)opensuse.org,
jaromir.cervenka(a)speel.cz
14 years, 11 months
[libvirt] [PATCH] Fix virDomainObj ref handling in QEMU driver
by Daniel P. Berrange
Since the monitor I/O is processed out of band from the main
thread(s) invoking monitor commands, the virDomainObj may be
deleted by the I/O thread. The qemuDomainObjBeginJob takes an
extra reference to protect against final deletion, but this
reference is released by the corresponding EndJob call. THus
after the EndJob call it may not be valid to reference the
virDomainObj any more. To allow callers to detect this, the
EndJob call is changed to return the remaining reference count.
* src/conf/domain_conf.c: Make virDomainObjUnref return the
remaining reference count
* src/qemu/qemu_driver.c: Avoid referencing virDomainObjPtr
after qemuDomainObjEndJob if it has been deleted.
---
src/conf/domain_conf.c | 6 +-
src/qemu/qemu_driver.c | 133 +++++++++++++++++++++++++++++-------------------
2 files changed, 84 insertions(+), 55 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 21d509d..dca2e49 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -231,7 +231,7 @@ static void virDomainObjListDeallocator(void *payload, const char *name ATTRIBUT
{
virDomainObjPtr obj = payload;
virDomainObjLock(obj);
- if (!virDomainObjUnref(obj))
+ if (virDomainObjUnref(obj) > 0)
virDomainObjUnlock(obj);
}
@@ -637,9 +637,9 @@ int virDomainObjUnref(virDomainObjPtr dom)
if (dom->refs == 0) {
virDomainObjUnlock(dom);
virDomainObjFree(dom);
- return 1;
+ return 0;
}
- return 0;
+ return dom->refs;
}
static virDomainObjPtr virDomainObjNew(virConnectPtr conn,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7dfd1e6..7e60d0e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -371,15 +371,18 @@ static int qemuDomainObjBeginJobWithDriver(struct qemud_driver *driver,
*
* To be called after completing the work associated with the
* earlier qemuDomainBeginJob() call
+ *
+ * Returns remaining refcount on 'obj', maybe 0 to indicated it
+ * was deleted
*/
-static void qemuDomainObjEndJob(virDomainObjPtr obj)
+static int ATTRIBUTE_RETURN_CHECK qemuDomainObjEndJob(virDomainObjPtr obj)
{
qemuDomainObjPrivatePtr priv = obj->privateData;
priv->jobActive = 0;
virCondSignal(&priv->jobCond);
- virDomainObjUnref(obj);
+ return virDomainObjUnref(obj);
}
@@ -3039,9 +3042,9 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
goto cleanup; /* XXXX free the 'vm' we created ? */
if (qemudStartVMDaemon(conn, driver, vm, NULL, -1) < 0) {
- qemuDomainObjEndJob(vm);
- virDomainRemoveInactive(&driver->domains,
- vm);
+ if (qemuDomainObjEndJob(vm) > 0)
+ virDomainRemoveInactive(&driver->domains,
+ vm);
vm = NULL;
goto endjob;
}
@@ -3054,8 +3057,9 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
if (dom) dom->id = vm->def->id;
endjob:
- if (vm)
- qemuDomainObjEndJob(vm);
+ if (vm &&
+ qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
virDomainDefFree(def);
@@ -3110,7 +3114,8 @@ static int qemudDomainSuspend(virDomainPtr dom) {
ret = 0;
endjob:
- qemuDomainObjEndJob(vm);
+ if (qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
if (vm)
@@ -3169,7 +3174,8 @@ static int qemudDomainResume(virDomainPtr dom) {
ret = 0;
endjob:
- qemuDomainObjEndJob(vm);
+ if (qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
if (vm)
@@ -3213,7 +3219,8 @@ static int qemudDomainShutdown(virDomainPtr dom) {
qemuDomainObjExitMonitor(vm);
endjob:
- qemuDomainObjEndJob(vm);
+ if (qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
if (vm)
@@ -3252,16 +3259,17 @@ static int qemudDomainDestroy(virDomainPtr dom) {
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
if (!vm->persistent) {
- qemuDomainObjEndJob(vm);
- virDomainRemoveInactive(&driver->domains,
- vm);
+ if (qemuDomainObjEndJob(vm) > 0)
+ virDomainRemoveInactive(&driver->domains,
+ vm);
vm = NULL;
}
ret = 0;
endjob:
- if (vm)
- qemuDomainObjEndJob(vm);
+ if (vm &&
+ qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
if (vm)
@@ -3402,7 +3410,8 @@ static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
ret = 0;
endjob:
- qemuDomainObjEndJob(vm);
+ if (qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
if (vm)
@@ -3452,7 +3461,8 @@ static int qemudDomainGetInfo(virDomainPtr dom,
err = qemuMonitorGetBalloonInfo(priv->mon, &balloon);
qemuDomainObjExitMonitor(vm);
if (err < 0) {
- qemuDomainObjEndJob(vm);
+ if (qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
goto cleanup;
}
@@ -3462,7 +3472,10 @@ static int qemudDomainGetInfo(virDomainPtr dom,
else
info->memory = balloon;
- qemuDomainObjEndJob(vm);
+ if (qemuDomainObjEndJob(vm) == 0) {
+ vm = NULL;
+ goto cleanup;
+ }
} else {
info->memory = vm->def->memory;
}
@@ -3671,15 +3684,16 @@ static int qemudDomainSave(virDomainPtr dom,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_SAVED);
if (!vm->persistent) {
- qemuDomainObjEndJob(vm);
- virDomainRemoveInactive(&driver->domains,
- vm);
+ if (qemuDomainObjEndJob(vm) > 0)
+ virDomainRemoveInactive(&driver->domains,
+ vm);
vm = NULL;
}
endjob:
- if (vm)
- qemuDomainObjEndJob(vm);
+ if (vm &&
+ qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
if (fd != -1)
@@ -3766,7 +3780,8 @@ static int qemudDomainCoreDump(virDomainPtr dom,
}
endjob:
- qemuDomainObjEndJob(vm);
+ if (qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
if (vm)
@@ -3827,7 +3842,8 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
ret = 0;
endjob:
- qemuDomainObjEndJob(vm);
+ if (qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
if (vm)
@@ -4235,9 +4251,9 @@ static int qemudDomainRestore(virConnectPtr conn,
fd = -1;
if (ret < 0) {
if (!vm->persistent) {
- qemuDomainObjEndJob(vm);
- virDomainRemoveInactive(&driver->domains,
- vm);
+ if (qemuDomainObjEndJob(vm) > 0)
+ virDomainRemoveInactive(&driver->domains,
+ vm);
vm = NULL;
}
goto endjob;
@@ -4265,8 +4281,9 @@ static int qemudDomainRestore(virConnectPtr conn,
ret = 0;
endjob:
- if (vm)
- qemuDomainObjEndJob(vm);
+ if (vm &&
+ qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
virDomainDefFree(def);
@@ -4314,7 +4331,10 @@ static char *qemudDomainDumpXML(virDomainPtr dom,
qemuDomainObjEnterMonitor(vm);
err = qemuMonitorGetBalloonInfo(priv->mon, &balloon);
qemuDomainObjExitMonitor(vm);
- qemuDomainObjEndJob(vm);
+ if (qemuDomainObjEndJob(vm) == 0) {
+ vm = NULL;
+ goto cleanup;
+ }
if (err < 0)
goto cleanup;
if (err > 0)
@@ -4547,7 +4567,8 @@ static int qemudDomainStart(virDomainPtr dom) {
VIR_DOMAIN_EVENT_STARTED_BOOTED);
endjob:
- qemuDomainObjEndJob(vm);
+ if (qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
if (vm)
@@ -5338,7 +5359,8 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
ret = -1;
endjob:
- qemuDomainObjEndJob(vm);
+ if (qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
if (cgroup)
@@ -5672,7 +5694,8 @@ static int qemudDomainDetachDevice(virDomainPtr dom,
ret = -1;
endjob:
- qemuDomainObjEndJob(vm);
+ if (qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
virDomainDeviceDefFree(dev);
@@ -5996,7 +6019,8 @@ qemudDomainBlockStats (virDomainPtr dom,
qemuDomainObjExitMonitor(vm);
endjob:
- qemuDomainObjEndJob(vm);
+ if (qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
VIR_FREE(qemu_dev_name);
@@ -6214,7 +6238,8 @@ qemudDomainMemoryPeek (virDomainPtr dom,
ret = 0;
endjob:
- qemuDomainObjEndJob(vm);
+ if (qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
VIR_FREE(tmp);
@@ -6708,8 +6733,8 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn,
if (qemust == NULL) {
qemudShutdownVMDaemon(NULL, driver, vm);
if (!vm->persistent) {
- qemuDomainObjEndJob(vm);
- virDomainRemoveInactive(&driver->domains, vm);
+ if (qemuDomainObjEndJob(vm) > 0)
+ virDomainRemoveInactive(&driver->domains, vm);
vm = NULL;
}
virReportSystemError(dconn, errno,
@@ -6727,8 +6752,9 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn,
ret = 0;
endjob:
- if (vm)
- qemuDomainObjEndJob(vm);
+ if (vm &&
+ qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
virDomainDefFree(def);
@@ -6895,8 +6921,8 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
* should have already done that.
*/
if (!vm->persistent) {
- qemuDomainObjEndJob(vm);
- virDomainRemoveInactive(&driver->domains, vm);
+ if (qemuDomainObjEndJob(vm) > 0)
+ virDomainRemoveInactive(&driver->domains, vm);
vm = NULL;
}
goto endjob;
@@ -6908,8 +6934,9 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
ret = 0;
endjob:
- if (vm)
- qemuDomainObjEndJob(vm);
+ if (vm &&
+ qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
virDomainDefFree(def);
@@ -7399,8 +7426,8 @@ qemudDomainMigratePerform (virDomainPtr dom,
VIR_DOMAIN_EVENT_STOPPED_MIGRATED);
if (!vm->persistent || (flags & VIR_MIGRATE_UNDEFINE_SOURCE)) {
virDomainDeleteConfig(dom->conn, driver->configDir, driver->autostartDir, vm);
- qemuDomainObjEndJob(vm);
- virDomainRemoveInactive(&driver->domains, vm);
+ if (qemuDomainObjEndJob(vm) > 0)
+ virDomainRemoveInactive(&driver->domains, vm);
vm = NULL;
}
ret = 0;
@@ -7424,8 +7451,9 @@ endjob:
VIR_DOMAIN_EVENT_RESUMED,
VIR_DOMAIN_EVENT_RESUMED_MIGRATED);
}
- if (vm)
- qemuDomainObjEndJob(vm);
+ if (vm &&
+ qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
if (vm)
@@ -7523,15 +7551,16 @@ qemudDomainMigrateFinish2 (virConnectPtr dconn,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_FAILED);
if (!vm->persistent) {
- qemuDomainObjEndJob(vm);
- virDomainRemoveInactive(&driver->domains, vm);
+ if (qemuDomainObjEndJob(vm) > 0)
+ virDomainRemoveInactive(&driver->domains, vm);
vm = NULL;
}
}
endjob:
- if (vm)
- qemuDomainObjEndJob(vm);
+ if (vm &&
+ qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
cleanup:
if (vm)
--
1.6.5.2
14 years, 11 months
[libvirt] Add vncdisplay to virsh list
by Дмитрий Ильин
I think adding vncdisplay to virsh list output will be very usefull.
For example output could be like this:
Id Name State Display
----------------------------------------------------
1 test1 running :2
2 test2 running :5
3 test3 running :13
4 server1 running n/g
5 sdltest running sdl
- test4 shut off off
- test5 shut off off
:n - vnc display number
n/g - no graphics
sdl - sdl output
You can use "--display" to enable it
command:
virsh list --all --display
Also I would like to see "--pretend" option in virt-install.
Just generate xml and dump it to stdout without doing anything else.
14 years, 11 months
[libvirt] [PATCH 0/3] fix migration of paused vms
by Paolo Bonzini
From: Paolo Bonzini <pbonzini(a)gnu.org>
This is yet another try on fixing migration of paused vms. Since the
driver-only solution didn't work out, I'm now fixing it directly in
libvirt.c.
The first two patches are the same as for the previous series. The
first is a bugfix for failed migration for the QEMU driver; the second
adds a "virsh migrate --suspend" option to leave the VM not running
on the destination machine.
As in the previous version of the patch, --suspend/VIR_MIGRATE_PAUSED
is the bulk of implementing the new feature. I just query the domain
state and, if it is paused, I implicitly add the VIR_MIGRATE_PAUSED
flag to the migration. This is the third patch.
I thought about transmitting the state in the end (since it works well
if VIR_MIGRATE_PAUSED is passed only to MigrateFinish and not to
MigratePerform), but I don't think it's a good idea to commit it
now as it's basically untestable. It's in the fourth patch, but if
you want it now and think the approach is sound, tell me and I'll
test it more heavily.
14 years, 11 months