[libvirt] [PATCH] autobuild.sh: provide default prefix
by Eric Blake
Without this patch and with a clean environment, ./autobuild.sh
tried to use ./configure --prefix=/, and fails.
* autobuild.sh (AUTOBUILD_INSTALL_ROOT): Provide sensible
default. Suggested by Daniel P. Berrange.
---
autobuild.sh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/autobuild.sh b/autobuild.sh
index d3934ea..3379be4 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -6,6 +6,7 @@ set -v
# Make things clean.
test -n "$1" && RESULTS=$1 || RESULTS=results.log
+: ${AUTOBUILD_INSTALL_ROOT=$HOME/builder}
test -f Makefile && make -k distclean || :
rm -rf coverage
--
1.6.6.1
14 years, 6 months
[libvirt] Release of libvirt-0.8.1
by Daniel Veillard
As planned, here is the 0.8.1 bug fix release, available from
libvirt.org FTP:
ftp://libvirt.org/libvirt/
As planned it's rather light on features but includes a very large set
of bug fixes, cleanups and portability enhancements,
Features:
- Add virDomainGetBlockInfo API to query disk sizing (Daniel P. Berrange)
- Starts dnsmasq from libvirtd with --dhcp-hostsfile option (Satoru SATOH)
Documentation:
- cleanup the download section of the documentation (Daniel Veillard)
- Fix messsage -> message. (Chris Lalancette)
- Fix up a debug typo. (Chris Lalancette)
- add nwfilter functions to virsh man page (Stefan Berger)
Portability:
- Fix build on Ubuntu. (Chris Lalancette)
- cygwin/mingw: Fix version script handling (Matthias Bolte)
- build: fix autogen rule for VPATH build (Eric Blake)
- Fix build with DEBUG_RAW_IO=1 (Jiri Denemark)
- Don't try to build qemu and lxc on non-Linux platforms (Daniel Veillard)
- cygwin: Handle differences in the XDR implementation (Matthias Bolte)
- Cygwin's GCC doesn't like this .sa_handler initialization for some reason (Matthias Bolte)
- linux/if.h header is not available on non-Linux platforms (Matthias Bolte)
- cygwin: Check explicitly for getmntent_r (Matthias Bolte)
- Disable stateful OpenNebula driver if libvirtd is disabled (Matthias Bolte)
- build: don't include winsock2.h on cygwin (Eric Blake)
- portability fixes to tools/virt-pki-validate.in (Dustin Kirkland)
- virt-aa-helper-test: avoid non-portable echo -n (Eric Blake)
- schematestutils.sh: improve shell portability: avoid "echo -e" (Jim Meyering)
- Fix build of openvz on RHEL-5. (Chris Lalancette)
- Fix spec file for builds without lxc (Daniel Berteaud)
Bug Fixes:
- domain: Fix PCI address decimal parsing regression (Cole Robinson)
- Fix virt-pki-validate's determination of CN (Dustin Kirkland)
- Fix detection of disk in IO events (Daniel P. Berrange)
- Fix a virsh edit memory leak (Chris Lalancette)
- Fix a qemuDomainPCIAddressSetFree memory leak (Chris Lalancette)
- Fix a memory leak in the node_device_udev code (Chris Lalancette)
- qemuDomainSnapshotCreateXML: avoid NULL dereferences (Jim Meyering)
- qemudDomainCreate: correct a slightly misdirected goto (Jim Meyering)
- Fix handling of security driver restore failures in QEMU domain save (Daniel P. Berrange)
- Fix QEMU domain save to block devices with cgroups enabled (Daniel P. Berrange)
- Fix QEMU save/restore with block devices (Daniel P. Berrange)
- Fix crash when cleaning up from failed save attempt (Daniel P. Berrange)
- The base used for conversion of USB values should be 16 not 10. (Klaus Ethgen)
- Fix up the locking in the snapshot code. (Chris Lalancette)
- Ignore qemu STOP event when stopping CPUs (Jiri Denemark)
- Fix memory leak in virsh snapshot-list. (Chris Lalancette)
- Fix virDomainSnapshotObjFree memory leak. (Chris Lalancette)
- Fix a memory leak in the snapshot code in libvirtd. (Chris Lalancette)
- QEmu JSON drop timestamp from command object (Luiz Capitulino)
- Fix crash in nwfilter driver check (Daniel P. Berrange)
- qemu: fix security context references in DAC code (Spencer Shimko)
- Properly indent encryption tags (David Allan)
- Fix locking in qemudDomainCoreDump (Jiri Denemark)
- Poll for migration end every 50ms instead of 50us (Jiri Denemark)
- configure.ac SELinux fixes (Spencer Shimko)
- Fix QEMU text monitor command error checking (Daniel P. Berrange)
- Fix CPU hotplug command names (Daniel P. Berrange)
- Fix printing of event detail in python events demo program (Daniel P. Berrange)
- Fix initial VCPU pinning in qemu driver (Jiri Denemark)
- Make avahi startup more robust. (Chris Lalancette)
- esx: Don't treat an empty root snapshot list as error (Chris Wong)
- esx: Fix FindByIp response handling (Matthias Bolte)
- esx: Fix virtualHW.version generation (Matthias Bolte)
- Fix device_del in JSON mode for QEMU (Daniel P. Berrange)
- nwfilter: Free nwfilter hash of virConnectPtr (Matthias Bolte)
- remote: react to failures on wakeupFD (Eric Blake)
- Fix CDROM media change for QEMU when using -device syntax (Daniel P. Berrange)
- Fix QEMU memory stats JSON mode (Daniel P. Berrange)
- Trivial fix: Add braces to for statement to avoid crashes (Stefan Berger)
- qemudDomainAttachSCSIDisk: avoid FP NULL-ptr-deref from clang (Jim Meyering)
- qemudDomainAttachSCSIDisk: avoid FP NULL-ptr-deref from clang (Jim Meyering)
- virGetHostnameLocalhost: avoid FP NULL-ptr-deref from clang (Jim Meyering)
- nwfilter_ebiptables_driver.c: avoid NULL dereference (Jim Meyering)
- esxVMX_GatherSCSIControllers: avoid NULL dereference (Jim Meyering)
- Fix nodeinfotest on NUMA machines (Daniel P. Berrange)
Improvements:
- Add support for another explicit IO error event (Daniel P. Berrange)
- Report all errors in SELinuxRestoreSecurityFileLabel (Jiri Denemark)
- Prevent updates while IP address learn thread is running (Stefan Berger)
- Syncronize the teardown of rules with the thread (Stefan Berger)
- Clean all tables before applying 'basic' rules (Stefan Berger)
- MAke virFileHasSuffix case insensitive (Paul Dorman)
- nwfilter: Also pick IP address from a DHCP ACK message (Stefan Berger)
- Implement python binding for virDomainGetBlockInfo (Daniel P. Berrange)
- Add new domblkinfo command to virsh (Daniel P. Berrange)
- Implement virDomainGetBlockInfo in QEMU driver (Daniel P. Berrange)
- Remote protocol impl for virDomainGetBlockInfo (Daniel P. Berrange)
- Internal driver API infrastructure for virDomainGetBlockInfo (Daniel P. Berrange)
- Report better error if qemuSnapshotIsAllowed failed. (Chris Lalancette)
- nwfilter: python bindings for nwfilter (Stefan Berger)
- Move dnsmasq host file to a separate directory (Daniel Veillard)
- nwfilter: allow to mix filterrefs and rules in the schema (Stefan Berger)
- Avoid create/unlink with block devs used for QEMU save (Daniel P. Berrange)
- nwfilter: let qemu's after-migration packet pass (Stefan Berger)
- Fix up the error message if we can't parse the snapshot XML. (Chris Lalancette)
- nwfilter: add support for RAPR protocol (Stefan Berger)
- nwfilter: enable hex number inputs in filter XML (Stefan Berger)
- Add build support for dnsmasq module (Satoru SATOH)
- Add dnsmasq module files (Satoru SATOH)
- Fix make dist missing ESX generated files (Daniel Veillard)
- Fix printing of pathnames on error in qemuDomainSnapshotLoad. (Chris Lalancette)
- Improve configure error message about missing Linux headers (Matthias Bolte)
- nwfilter: extend schema + add testcase w/ connlimit-above (Stefan Berger)
- addrToString: give better error message (Eric Blake)
- Fake host CPU for qemu tests (Jiri Denemark)
- Use configured CPU model if possible (Jiri Denemark)
- Support removing features when converting data to CPU (Jiri Denemark)
- Move MIN macro to util.h so that others can use it (Jiri Denemark)
- Deal with CPU models in [] (Jiri Denemark)
- Ignore empty type attribute in driver element of virtual disks (Guido Günther)
- esx: Gather some XML generation macros in esx_vi.h (Matthias Bolte)
- nwfilter: add support for connlimit match (Stefan Berger)
- Extend fwall-drv interface and call functions via interface (Stefan Berger)
- esx: Add support for the VMXNET 2 (Enhanced) NIC model (Matthias Bolte)
- Install nwfilter xml files from source directory. (Philipp Hahn)
- Fixup python binding for virDomainSnapshot APIs (Daniel P. Berrange)
- Fix network hotplug to use device_add in QEMU (Daniel P. Berrange)
- Fix error reporting for getfd + host_net_add in QEMU (Daniel P. Berrange)
- Replace printf with logging macros (Matthias Bolte)
- Mark internal.h for translation (Jiri Denemark)
- Use virCheckFlags for APIs added in 0.8.0 (Jiri Denemark)
- Introduce virCheckFlags for consistent flags checking (Jiri Denemark)
- nwfilter: Clear all state tracking from a drop rule (Stefan Berger)
- Update to latest gnulib to get strtok_r relaxed to LGPLv2+ (Matthias Bolte)
- esx: Add nwfilter driver stub (Matthias Bolte)
- util: ensure safe{read,write,zero} return is checked (Eric Blake)
- Update QEMU device_add command in JSON mode (Daniel P. Berrange)
- Rename parameter in qemuMonitorDeviceDel (Daniel P. Berrange)
- Run test suite as part of RPM build process (Daniel P. Berrange)
- Fix QEMU command building errors to reflect unsupported configuration (Daniel P. Berrange)
- nwfilter: fix tear down order and consolidate functions (Stefan Berger)
- Fix close_used_without_including_unistd_h error (Matthias Bolte)
- Implement variable length structure allocator (David Allan)
- build: set STATIC_ANALYSIS when running via clang or coverity (Jim Meyering)
- sa_assert: assert-like macro, enabled only for use with static analyzers (Jim Meyering)
- Implement forgotten backend of virInterfaceIsActive() (Laine Stump)
- nwfilter: use virFindFileInPath for needed CLI tools (Stefan Berger)
- esx: Extend esx_vi_generator.py to cover methods too (Matthias Bolte)
- Consolidate interface related functions in interface.c (Stefan Berger)
- build: include usleep gnulib module (Eric Blake)
Cleanups:
- qemudDomainSaveFlag: remove dead store (Jim Meyering)
- Remove unused goto label from qemudDomainCreate (Daniel P. Berrange)
- Fix indentation for storage conf XML (David Allan)
- Make virDomainSnapshotObjListDeinit static. (Chris Lalancette)
- Some NWFilter symbols are conditional and have to be exported conditional (Matthias Bolte)
- xen: Fix inside_daemon beeing unused when libvirtd is disabled (Matthias Bolte)
- maint: update AUTHORS (Marco Bozzolan)
- maint: update AUTHORS with recent contributors (Eric Blake)
- maint: enforce whitespace on shell scripts (Eric Blake)
- testutilsqemu: avoid uninitialized variable (Eric Blake)
- maint: ignore 'make syntax-check' failure files (Eric Blake)
- build: fix preprocessor indentation (Eric Blake)
- build: avoid compiler warning (Eric Blake)
- Explicitly set virStoragePoolTypeInfo FS and NETFS defaults (Matthias Bolte)
- Mark in_open parameter of remoteAuthenticate as unused when it's unused (Matthias Bolte)
- Don't ship generated python/libvirt.? files. (Philipp Hahn)
- esx: Replace scanf with STRSKIP and strtok_r (Matthias Bolte)
- maint: another preprocessor fix (Eric Blake)
- Remove code from JSON monitor for commands that won't be ported (Daniel P. Berrange)
- Fix apibuild.py warnings about missing ':' (Matthias Bolte)
- xend_internal.c: assure clang that we do not dereference NULL (Jim Meyering)
- build: fix recent 'make syntax-check' failure (Eric Blake)
- virStorageBackendFileSystemMount: prefer strdup over virAsprintf (Jim Meyering)
- virStorageBackendFileSystemMount: placate clang (Jim Meyering)
- openvzGetProcessInfo: address clang-detected low-probability flaw (Jim Meyering)
- vshCommandRun: avoid used-uninitialized timing-related report from clang (Jim Meyering)
- Fix up formatting of remote protocol stuff. (Chris Lalancette)
- Remove some debugging leftovers. (Chris Lalancette)
- build: fix syntax-check problems (Eric Blake)
Thanks to everybody who helped for the release !
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/
14 years, 6 months
[libvirt] [PATCH] domain: Fix PCI address decimal parsing regression
by Cole Robinson
<hostdev> address parsing previously attempted to detect the number
base: currently it is hardcoded to base 16, which can break PCI assignment
via virt-manager. Revert to the previous behavior.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/conf/domain_conf.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1607e8b..546ddf2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1079,28 +1079,28 @@ virDomainDevicePCIAddressParseXML(xmlNodePtr node,
function = virXMLPropString(node, "function");
if (domain &&
- virStrToLong_ui(domain, NULL, 16, &addr->domain) < 0) {
+ virStrToLong_ui(domain, NULL, 0, &addr->domain) < 0) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot parse <address> 'domain' attribute"));
goto cleanup;
}
if (bus &&
- virStrToLong_ui(bus, NULL, 16, &addr->bus) < 0) {
+ virStrToLong_ui(bus, NULL, 0, &addr->bus) < 0) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot parse <address> 'bus' attribute"));
goto cleanup;
}
if (slot &&
- virStrToLong_ui(slot, NULL, 16, &addr->slot) < 0) {
+ virStrToLong_ui(slot, NULL, 0, &addr->slot) < 0) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot parse <address> 'slot' attribute"));
goto cleanup;
}
if (function &&
- virStrToLong_ui(function, NULL, 16, &addr->function) < 0) {
+ virStrToLong_ui(function, NULL, 0, &addr->function) < 0) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot parse <address> 'function' attribute"));
goto cleanup;
--
1.7.0.1
14 years, 6 months
[libvirt] [patch 0/3] Fixes related to the IP address learning thread
by Stefan Berger
Proper resubmission -- sorry for the noise.
The following set of patches are primarily related to the
thread learning the IP address of a VM and deal with:
- ebtables cleanup before applying basic filtering rules while
the IP address is detected
- shutting down all traffic in case the filtering rules could
not be applied by the thread
- serialization of the teardown of eb/ip/ip6tables rules to
occurr after the IP address learning thread has terminated
- no to apply or tear any eb/ip/ip6tables rules while the
IP address learning thread is active
Regards,
Stefan
14 years, 6 months
[libvirt] [PATCH] Report all errors in SELinuxRestoreSecurityFileLabel
by jdenemar@redhat.com
From: Jiri Denemark <jdenemar(a)redhat.com>
---
src/security/security_selinux.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 3e20475..1aabb20 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -364,12 +364,20 @@ SELinuxRestoreSecurityFileLabel(const char *path)
goto err;
}
- if (stat(newpath, &buf) != 0)
+ if (stat(newpath, &buf) != 0) {
+ virReportSystemError(errno,
+ _("cannot stat %s"), newpath);
goto err;
+ }
if (matchpathcon(newpath, buf.st_mode, &fcon) == 0) {
rc = SELinuxSetFilecon(newpath, fcon);
+ } else {
+ virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot restore selinux file label for %s"),
+ newpath);
}
+
err:
VIR_FREE(fcon);
VIR_FREE(newpath);
--
1.7.0.4
14 years, 6 months
[libvirt] virFileHasSuffix case sensitivity
by Paul Dorman
Hi all,
virFileHasSuffix fails on esx IDE fileName VMX entries that aren't lower
case, e.g. '.ISO'. Unless there's a good reason, can the comparison be done
with STRCASEEQ instead of STREQ?
Kind regards,
Paul
14 years, 6 months
[libvirt] [PATCH] Add support for another explicit IO error event
by Daniel P. Berrange
This introduces a new event type
VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
This event is the same as the previous VIR_DOMAIN_ID_IO_ERROR
event, but also includes a string describing the cause of
the event.
Thus there is a new callback definition for this event type
typedef void (*virConnectDomainEventIOErrorReasonCallback)(virConnectPtr conn,
virDomainPtr dom,
const char *srcPath,
const char *devAlias,
int action,
const char *reason,
void *opaque);
This is currently wired up to the QEMU block IO error events
* daemon/remote.c: Dispatch IO error events to client
* examples/domain-events/events-c/event-test.c: Watch for
IO error events
* include/libvirt/libvirt.h.in: Define new IO error event ID
and callback signature
* src/conf/domain_event.c, src/conf/domain_event.h,
src/libvirt_private.syms: Extend API to handle IO error events
* src/qemu/qemu_driver.c: Connect to the QEMU monitor event
for block IO errors and emit a libvirt IO error event
* src/remote/remote_driver.c: Receive and dispatch IO error
events to application
* src/remote/remote_protocol.x: Wire protocol definition for
IO error events
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
src/qemu/qemu_monitor_json.c: Watch for BLOCK_IO_ERROR event
from QEMU monitor
---
daemon/remote.c | 38 +++++++++++++++
daemon/remote_dispatch_table.h | 5 ++
include/libvirt/libvirt.h.in | 23 +++++++++
python/libvirt-override-virConnect.py | 14 +++++-
python/libvirt-override.c | 55 +++++++++++++++++++++
src/conf/domain_event.c | 84 ++++++++++++++++++++++++++++-----
src/conf/domain_event.h | 10 ++++
src/libvirt_private.syms | 2 +
src/qemu/qemu_driver.c | 9 +++-
src/qemu/qemu_monitor.c | 5 +-
src/qemu/qemu_monitor.h | 6 ++-
src/qemu/qemu_monitor_json.c | 2 +-
src/remote/remote_driver.c | 35 ++++++++++++++
src/remote/remote_protocol.c | 17 +++++++
src/remote/remote_protocol.h | 12 +++++
src/remote/remote_protocol.x | 11 ++++-
16 files changed, 307 insertions(+), 21 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 6dbe7ee..c54565c 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -256,6 +256,43 @@ static int remoteRelayDomainEventIOError(virConnectPtr conn ATTRIBUTE_UNUSED,
}
+static int remoteRelayDomainEventIOErrorReason(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virDomainPtr dom,
+ const char *srcPath,
+ const char *devAlias,
+ int action,
+ const char *reason,
+ void *opaque)
+{
+ struct qemud_client *client = opaque;
+ remote_domain_event_io_error_reason_msg data;
+
+ if (!client)
+ return -1;
+
+ REMOTE_DEBUG("Relaying domain io error %s %d %s %s %d %s",
+ dom->name, dom->id, srcPath, devAlias, action, reason);
+
+ virMutexLock(&client->lock);
+
+ /* build return data */
+ memset(&data, 0, sizeof data);
+ make_nonnull_domain (&data.dom, dom);
+ data.srcPath = (char*)srcPath;
+ data.devAlias = (char*)devAlias;
+ data.action = action;
+ data.reason = (char*)reason;
+
+ remoteDispatchDomainEventSend (client,
+ REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON,
+ (xdrproc_t)xdr_remote_domain_event_io_error_reason_msg, &data);
+
+ virMutexUnlock(&client->lock);
+
+ return 0;
+}
+
+
static int remoteRelayDomainEventGraphics(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainPtr dom,
int phase,
@@ -327,6 +364,7 @@ static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventWatchdog),
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventIOError),
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventGraphics),
+ VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventIOErrorReason),
};
verify(ARRAY_CARDINALITY(domainEventCallbacks) == VIR_DOMAIN_EVENT_ID_LAST);
diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h
index 984634f..86bd3b0 100644
--- a/daemon/remote_dispatch_table.h
+++ b/daemon/remote_dispatch_table.h
@@ -977,3 +977,8 @@
.args_filter = (xdrproc_t) xdr_remote_domain_get_block_info_args,
.ret_filter = (xdrproc_t) xdr_remote_domain_get_block_info_ret,
},
+{ /* Async event DomainEventIoErrorReason => 195 */
+ .fn = NULL,
+ .args_filter = (xdrproc_t) xdr_void,
+ .ret_filter = (xdrproc_t) xdr_void,
+},
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 4237b7b..f296d16 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -2054,6 +2054,28 @@ typedef void (*virConnectDomainEventIOErrorCallback)(virConnectPtr conn,
void *opaque);
/**
+ * virConnectDomainEventWatchdogCallback:
+ * @conn: connection object
+ * @dom: domain on which the event occurred
+ * @srcPath: The host file on which the IO error occurred
+ * @devAlias: The guest device alias associated with the path
+ * @action: action that is to be taken due to the IO error
+ * @reason: the cause of the IO error
+ * @opaque: application specified data
+ *
+ * The callback signature to use when registering for an event of type
+ * VIR_DOMAIN_EVENT_ID_IO_ERROR with virConnectDomainEventRegisterAny()
+ *
+ */
+typedef void (*virConnectDomainEventIOErrorReasonCallback)(virConnectPtr conn,
+ virDomainPtr dom,
+ const char *srcPath,
+ const char *devAlias,
+ int action,
+ const char *reason,
+ void *opaque);
+
+/**
* virDomainEventGraphicsPhase:
*
* The phase of the graphics client connection
@@ -2161,6 +2183,7 @@ typedef enum {
VIR_DOMAIN_EVENT_ID_WATCHDOG = 3, /* virConnectDomainEventWatchdogCallback */
VIR_DOMAIN_EVENT_ID_IO_ERROR = 4, /* virConnectDomainEventIOErrorCallback */
VIR_DOMAIN_EVENT_ID_GRAPHICS = 5, /* virConnectDomainEventGraphicsCallback */
+ VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON = 6, /* virConnectDomainEventIOErrorReasonCallback */
/*
* NB: this enum value will increase over time as new events are
diff --git a/python/libvirt-override-virConnect.py b/python/libvirt-override-virConnect.py
index cb38e3f..df39b79 100644
--- a/python/libvirt-override-virConnect.py
+++ b/python/libvirt-override-virConnect.py
@@ -94,7 +94,19 @@
cb = cbData["cb"]
opaque = cbData["opaque"]
- cb(self, virDomain(self, _obj=dom), opaque)
+ cb(self, virDomain(self, _obj=dom), srcPath, devAlias, opaque)
+ return 0
+ except AttributeError:
+ pass
+
+ def dispatchDomainEventIOErrorReasonCallback(self, dom, srcPath, devAlias, action, reason, cbData):
+ """Dispatches events to python user domain IO error event callbacks
+ """
+ try:
+ cb = cbData["cb"]
+ opaque = cbData["opaque"]
+
+ cb(self, virDomain(self, _obj=dom), srcPath, devAlias, action, reason, opaque)
return 0
except AttributeError:
pass
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 7c7682c..b97445b 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -3208,6 +3208,58 @@ libvirt_virConnectDomainEventIOErrorCallback(virConnectPtr conn ATTRIBUTE_UNUSED
}
static int
+libvirt_virConnectDomainEventIOErrorReasonCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virDomainPtr dom,
+ const char *srcPath,
+ const char *devAlias,
+ int action,
+ const char *reason,
+ void *opaque)
+{
+ PyObject *pyobj_cbData = (PyObject*)opaque;
+ PyObject *pyobj_dom;
+ PyObject *pyobj_ret;
+ PyObject *pyobj_conn;
+ PyObject *dictKey;
+ int ret = -1;
+
+ LIBVIRT_ENSURE_THREAD_STATE;
+
+ /* Create a python instance of this virDomainPtr */
+ virDomainRef(dom);
+ pyobj_dom = libvirt_virDomainPtrWrap(dom);
+ Py_INCREF(pyobj_cbData);
+
+ dictKey = libvirt_constcharPtrWrap("conn");
+ pyobj_conn = PyDict_GetItem(pyobj_cbData, dictKey);
+ Py_DECREF(dictKey);
+
+ /* Call the Callback Dispatcher */
+ pyobj_ret = PyObject_CallMethod(pyobj_conn,
+ (char*)"dispatchDomainEventIOErrorCallback",
+ (char*)"OssisO",
+ pyobj_dom,
+ srcPath, devAlias, action, reason,
+ pyobj_cbData);
+
+ Py_DECREF(pyobj_cbData);
+ Py_DECREF(pyobj_dom);
+
+ if(!pyobj_ret) {
+#if DEBUG_ERROR
+ printf("%s - ret:%p\n", __FUNCTION__, pyobj_ret);
+#endif
+ PyErr_Print();
+ } else {
+ Py_DECREF(pyobj_ret);
+ ret = 0;
+ }
+
+ LIBVIRT_RELEASE_THREAD_STATE;
+ return ret;
+}
+
+static int
libvirt_virConnectDomainEventGraphicsCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainPtr dom,
int phase,
@@ -3345,6 +3397,9 @@ libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject * self,
case VIR_DOMAIN_EVENT_ID_IO_ERROR:
cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventIOErrorCallback);
break;
+ case VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON:
+ cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventIOErrorReasonCallback);
+ break;
case VIR_DOMAIN_EVENT_ID_GRAPHICS:
cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventGraphicsCallback);
break;
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index e3ce5ba..e5bd458 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -74,6 +74,7 @@ struct _virDomainEvent {
char *srcPath;
char *devAlias;
int action;
+ char *reason;
} ioError;
struct {
int phase;
@@ -474,6 +475,7 @@ void virDomainEventFree(virDomainEventPtr event)
case VIR_DOMAIN_EVENT_ID_IO_ERROR:
VIR_FREE(event->data.ioError.srcPath);
VIR_FREE(event->data.ioError.devAlias);
+ VIR_FREE(event->data.ioError.reason);
break;
case VIR_DOMAIN_EVENT_ID_GRAPHICS:
@@ -630,19 +632,22 @@ virDomainEventPtr virDomainEventWatchdogNewFromObj(virDomainObjPtr obj,
return ev;
}
-virDomainEventPtr virDomainEventIOErrorNewFromDom(virDomainPtr dom,
- const char *srcPath,
- const char *devAlias,
- int action)
+static virDomainEventPtr virDomainEventIOErrorNewFromDomImpl(int event,
+ virDomainPtr dom,
+ const char *srcPath,
+ const char *devAlias,
+ int action,
+ const char *reason)
{
virDomainEventPtr ev =
- virDomainEventNewInternal(VIR_DOMAIN_EVENT_ID_IO_ERROR,
+ virDomainEventNewInternal(event,
dom->id, dom->name, dom->uuid);
if (ev) {
ev->data.ioError.action = action;
if (!(ev->data.ioError.srcPath = strdup(srcPath)) ||
- !(ev->data.ioError.devAlias = strdup(devAlias))) {
+ !(ev->data.ioError.devAlias = strdup(devAlias)) ||
+ (reason && !(ev->data.ioError.reason = strdup(reason)))) {
virDomainEventFree(ev);
ev = NULL;
}
@@ -650,19 +655,23 @@ virDomainEventPtr virDomainEventIOErrorNewFromDom(virDomainPtr dom,
return ev;
}
-virDomainEventPtr virDomainEventIOErrorNewFromObj(virDomainObjPtr obj,
- const char *srcPath,
- const char *devAlias,
- int action)
+
+static virDomainEventPtr virDomainEventIOErrorNewFromObjImpl(int event,
+ virDomainObjPtr obj,
+ const char *srcPath,
+ const char *devAlias,
+ int action,
+ const char *reason)
{
virDomainEventPtr ev =
- virDomainEventNewInternal(VIR_DOMAIN_EVENT_ID_IO_ERROR,
+ virDomainEventNewInternal(event,
obj->def->id, obj->def->name, obj->def->uuid);
if (ev) {
ev->data.ioError.action = action;
if (!(ev->data.ioError.srcPath = strdup(srcPath)) ||
- !(ev->data.ioError.devAlias = strdup(devAlias))) {
+ !(ev->data.ioError.devAlias = strdup(devAlias)) ||
+ !(ev->data.ioError.reason = strdup(reason))) {
virDomainEventFree(ev);
ev = NULL;
}
@@ -671,6 +680,48 @@ virDomainEventPtr virDomainEventIOErrorNewFromObj(virDomainObjPtr obj,
return ev;
}
+virDomainEventPtr virDomainEventIOErrorNewFromDom(virDomainPtr dom,
+ const char *srcPath,
+ const char *devAlias,
+ int action)
+{
+ return virDomainEventIOErrorNewFromDomImpl(VIR_DOMAIN_EVENT_ID_IO_ERROR,
+ dom, srcPath, devAlias,
+ action, NULL);
+}
+
+virDomainEventPtr virDomainEventIOErrorNewFromObj(virDomainObjPtr obj,
+ const char *srcPath,
+ const char *devAlias,
+ int action)
+{
+ return virDomainEventIOErrorNewFromObjImpl(VIR_DOMAIN_EVENT_ID_IO_ERROR,
+ obj, srcPath, devAlias,
+ action, NULL);
+}
+
+virDomainEventPtr virDomainEventIOErrorReasonNewFromDom(virDomainPtr dom,
+ const char *srcPath,
+ const char *devAlias,
+ int action,
+ const char *reason)
+{
+ return virDomainEventIOErrorNewFromDomImpl(VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON,
+ dom, srcPath, devAlias,
+ action, reason);
+}
+
+virDomainEventPtr virDomainEventIOErrorReasonNewFromObj(virDomainObjPtr obj,
+ const char *srcPath,
+ const char *devAlias,
+ int action,
+ const char *reason)
+{
+ return virDomainEventIOErrorNewFromObjImpl(VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON,
+ obj, srcPath, devAlias,
+ action, reason);
+}
+
virDomainEventPtr virDomainEventGraphicsNewFromDom(virDomainPtr dom,
int phase,
@@ -853,6 +904,15 @@ void virDomainEventDispatchDefaultFunc(virConnectPtr conn,
cbopaque);
break;
+ case VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON:
+ ((virConnectDomainEventIOErrorReasonCallback)cb)(conn, dom,
+ event->data.ioError.srcPath,
+ event->data.ioError.devAlias,
+ event->data.ioError.action,
+ event->data.ioError.reason,
+ cbopaque);
+ break;
+
case VIR_DOMAIN_EVENT_ID_GRAPHICS:
((virConnectDomainEventGraphicsCallback)cb)(conn, dom,
event->data.graphics.phase,
diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h
index f72ac58..e28293d 100644
--- a/src/conf/domain_event.h
+++ b/src/conf/domain_event.h
@@ -129,6 +129,16 @@ virDomainEventPtr virDomainEventIOErrorNewFromObj(virDomainObjPtr obj,
const char *srcPath,
const char *devAlias,
int action);
+virDomainEventPtr virDomainEventIOErrorReasonNewFromDom(virDomainPtr dom,
+ const char *srcPath,
+ const char *devAlias,
+ int action,
+ const char *reason);
+virDomainEventPtr virDomainEventIOErrorReasonNewFromObj(virDomainObjPtr obj,
+ const char *srcPath,
+ const char *devAlias,
+ int action,
+ const char *reason);
virDomainEventPtr virDomainEventGraphicsNewFromDom(virDomainPtr dom,
int phase,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 746327d..09f3da1 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -246,6 +246,8 @@ virDomainEventWatchdogNewFromDom;
virDomainEventWatchdogNewFromObj;
virDomainEventIOErrorNewFromDom;
virDomainEventIOErrorNewFromObj;
+virDomainEventIOErrorReasonNewFromDom;
+virDomainEventIOErrorReasonNewFromObj;
virDomainEventGraphicsNewFromDom;
virDomainEventGraphicsNewFromObj;
virDomainEventFree;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c2902ac..52f2df8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1015,10 +1015,12 @@ static int
qemuHandleDomainIOError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virDomainObjPtr vm,
const char *diskAlias,
- int action)
+ int action,
+ const char *reason)
{
struct qemud_driver *driver = qemu_driver;
virDomainEventPtr ioErrorEvent = NULL;
+ virDomainEventPtr ioErrorEvent2 = NULL;
virDomainEventPtr lifecycleEvent = NULL;
const char *srcPath;
const char *devAlias;
@@ -1036,6 +1038,7 @@ qemuHandleDomainIOError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
ioErrorEvent = virDomainEventIOErrorNewFromObj(vm, srcPath, devAlias, action);
+ ioErrorEvent2 = virDomainEventIOErrorReasonNewFromObj(vm, srcPath, devAlias, action, reason);
if (action == VIR_DOMAIN_EVENT_IO_ERROR_PAUSE &&
vm->state == VIR_DOMAIN_RUNNING) {
@@ -1051,10 +1054,12 @@ qemuHandleDomainIOError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
virDomainObjUnlock(vm);
- if (ioErrorEvent || lifecycleEvent) {
+ if (ioErrorEvent || ioErrorEvent2 || lifecycleEvent) {
qemuDriverLock(driver);
if (ioErrorEvent)
qemuDomainEventQueue(driver, ioErrorEvent);
+ if (ioErrorEvent2)
+ qemuDomainEventQueue(driver, ioErrorEvent2);
if (lifecycleEvent)
qemuDomainEventQueue(driver, lifecycleEvent);
qemuDriverUnlock(driver);
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 5e83afc..fca8590 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -833,7 +833,8 @@ int qemuMonitorEmitWatchdog(qemuMonitorPtr mon, int action)
int qemuMonitorEmitIOError(qemuMonitorPtr mon,
const char *diskAlias,
- int action)
+ int action,
+ const char *reason)
{
int ret = -1;
VIR_DEBUG("mon=%p", mon);
@@ -841,7 +842,7 @@ int qemuMonitorEmitIOError(qemuMonitorPtr mon,
qemuMonitorRef(mon);
qemuMonitorUnlock(mon);
if (mon->cb && mon->cb->domainIOError)
- ret = mon->cb->domainIOError(mon, mon->vm, diskAlias, action);
+ ret = mon->cb->domainIOError(mon, mon->vm, diskAlias, action, reason);
qemuMonitorLock(mon);
qemuMonitorUnref(mon);
return ret;
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index ec848a8..3fa83b7 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -95,7 +95,8 @@ struct _qemuMonitorCallbacks {
int (*domainIOError)(qemuMonitorPtr mon,
virDomainObjPtr vm,
const char *diskAlias,
- int action);
+ int action,
+ const char *reason);
int (*domainGraphics)(qemuMonitorPtr mon,
virDomainObjPtr vm,
int phase,
@@ -148,7 +149,8 @@ int qemuMonitorEmitRTCChange(qemuMonitorPtr mon, long long offset);
int qemuMonitorEmitWatchdog(qemuMonitorPtr mon, int action);
int qemuMonitorEmitIOError(qemuMonitorPtr mon,
const char *diskAlias,
- int action);
+ int action,
+ const char *reason);
int qemuMonitorEmitGraphics(qemuMonitorPtr mon,
int phase,
int localFamily,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 09a3562..8c77ab1 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -534,7 +534,7 @@ static void qemuMonitorJSONHandleIOError(qemuMonitorPtr mon, virJSONValuePtr dat
actionID = VIR_DOMAIN_EVENT_IO_ERROR_NONE;
}
- qemuMonitorEmitIOError(mon, device, actionID);
+ qemuMonitorEmitIOError(mon, device, actionID, "");
}
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index e589f8e..317125f 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -7430,6 +7430,37 @@ remoteDomainReadEventIOError(virConnectPtr conn, XDR *xdr)
static virDomainEventPtr
+remoteDomainReadEventIOErrorReason(virConnectPtr conn, XDR *xdr)
+{
+ remote_domain_event_io_error_reason_msg msg;
+ virDomainPtr dom;
+ virDomainEventPtr event = NULL;
+ memset (&msg, 0, sizeof msg);
+
+ /* unmarshall parameters, and process it*/
+ if (! xdr_remote_domain_event_io_error_reason_msg(xdr, &msg) ) {
+ remoteError(VIR_ERR_RPC, "%s",
+ _("unable to demarshall reboot event"));
+ return NULL;
+ }
+
+ dom = get_nonnull_domain(conn,msg.dom);
+ if (!dom)
+ return NULL;
+
+ event = virDomainEventIOErrorReasonNewFromDom(dom,
+ msg.srcPath,
+ msg.devAlias,
+ msg.action,
+ msg.reason);
+ xdr_free ((xdrproc_t) &xdr_remote_domain_event_io_error_reason_msg, (char *) &msg);
+
+ virDomainFree(dom);
+ return event;
+}
+
+
+static virDomainEventPtr
remoteDomainReadEventGraphics(virConnectPtr conn, XDR *xdr)
{
remote_domain_event_graphics_msg msg;
@@ -9327,6 +9358,10 @@ processCallDispatchMessage(virConnectPtr conn, struct private_data *priv,
event = remoteDomainReadEventIOError(conn, xdr);
break;
+ case REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON:
+ event = remoteDomainReadEventIOErrorReason(conn, xdr);
+ break;
+
case REMOTE_PROC_DOMAIN_EVENT_GRAPHICS:
event = remoteDomainReadEventGraphics(conn, xdr);
break;
diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c
index 71eed42..187281d 100644
--- a/src/remote/remote_protocol.c
+++ b/src/remote/remote_protocol.c
@@ -3290,6 +3290,23 @@ xdr_remote_domain_event_io_error_msg (XDR *xdrs, remote_domain_event_io_error_ms
}
bool_t
+xdr_remote_domain_event_io_error_reason_msg (XDR *xdrs, remote_domain_event_io_error_reason_msg *objp)
+{
+
+ if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
+ return FALSE;
+ if (!xdr_remote_nonnull_string (xdrs, &objp->srcPath))
+ return FALSE;
+ if (!xdr_remote_nonnull_string (xdrs, &objp->devAlias))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->action))
+ return FALSE;
+ if (!xdr_remote_nonnull_string (xdrs, &objp->reason))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
xdr_remote_domain_event_graphics_address (XDR *xdrs, remote_domain_event_graphics_address *objp)
{
diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h
index 8c4291f..6f01da7 100644
--- a/src/remote/remote_protocol.h
+++ b/src/remote/remote_protocol.h
@@ -1864,6 +1864,15 @@ struct remote_domain_event_io_error_msg {
};
typedef struct remote_domain_event_io_error_msg remote_domain_event_io_error_msg;
+struct remote_domain_event_io_error_reason_msg {
+ remote_nonnull_domain dom;
+ remote_nonnull_string srcPath;
+ remote_nonnull_string devAlias;
+ int action;
+ remote_nonnull_string reason;
+};
+typedef struct remote_domain_event_io_error_reason_msg remote_domain_event_io_error_reason_msg;
+
struct remote_domain_event_graphics_address {
int family;
remote_nonnull_string node;
@@ -2206,6 +2215,7 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_REVERT_TO_SNAPSHOT = 192,
REMOTE_PROC_DOMAIN_SNAPSHOT_DELETE = 193,
REMOTE_PROC_DOMAIN_GET_BLOCK_INFO = 194,
+ REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON = 195,
};
typedef enum remote_procedure remote_procedure;
@@ -2541,6 +2551,7 @@ extern bool_t xdr_remote_domain_event_reboot_msg (XDR *, remote_domain_event_re
extern bool_t xdr_remote_domain_event_rtc_change_msg (XDR *, remote_domain_event_rtc_change_msg*);
extern bool_t xdr_remote_domain_event_watchdog_msg (XDR *, remote_domain_event_watchdog_msg*);
extern bool_t xdr_remote_domain_event_io_error_msg (XDR *, remote_domain_event_io_error_msg*);
+extern bool_t xdr_remote_domain_event_io_error_reason_msg (XDR *, remote_domain_event_io_error_reason_msg*);
extern bool_t xdr_remote_domain_event_graphics_address (XDR *, remote_domain_event_graphics_address*);
extern bool_t xdr_remote_domain_event_graphics_identity (XDR *, remote_domain_event_graphics_identity*);
extern bool_t xdr_remote_domain_event_graphics_msg (XDR *, remote_domain_event_graphics_msg*);
@@ -2873,6 +2884,7 @@ extern bool_t xdr_remote_domain_event_reboot_msg ();
extern bool_t xdr_remote_domain_event_rtc_change_msg ();
extern bool_t xdr_remote_domain_event_watchdog_msg ();
extern bool_t xdr_remote_domain_event_io_error_msg ();
+extern bool_t xdr_remote_domain_event_io_error_reason_msg ();
extern bool_t xdr_remote_domain_event_graphics_address ();
extern bool_t xdr_remote_domain_event_graphics_identity ();
extern bool_t xdr_remote_domain_event_graphics_msg ();
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index ae306d2..8000ee0 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -1659,6 +1659,14 @@ struct remote_domain_event_io_error_msg {
int action;
};
+struct remote_domain_event_io_error_reason_msg {
+ remote_nonnull_domain dom;
+ remote_nonnull_string srcPath;
+ remote_nonnull_string devAlias;
+ int action;
+ remote_nonnull_string reason;
+};
+
struct remote_domain_event_graphics_address {
int family;
remote_nonnull_string node;
@@ -1996,7 +2004,8 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_SNAPSHOT_CURRENT = 191,
REMOTE_PROC_DOMAIN_REVERT_TO_SNAPSHOT = 192,
REMOTE_PROC_DOMAIN_SNAPSHOT_DELETE = 193,
- REMOTE_PROC_DOMAIN_GET_BLOCK_INFO = 194
+ REMOTE_PROC_DOMAIN_GET_BLOCK_INFO = 194,
+ REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON = 195
/*
* Notice how the entries are grouped in sets of 10 ?
--
1.6.6.1
14 years, 6 months
[libvirt] [PATCH v2] nwfilter: Also pick IP address from a DHCP ACK message
by Stefan Berger
The local DHCP server on virtbr0 sends DHCP ACK messages when a VM is
started and requests an IP address while the initial DHCP lease on the
VM's MAC address hasn't expired. So, also pick the IP address of the VM
if that type of message is seen.
Thanks to Gerhard Stenzel for providing a test case for this.
Changes from V1 to V2:
- cleanup: replacing DHCP option numbers through constants
Signed-off-by: Stefan Berger <stefanb(a)us.ibm.com>
---
src/nwfilter/nwfilter_learnipaddr.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
Index: libvirt-acl/src/nwfilter/nwfilter_learnipaddr.c
===================================================================
--- libvirt-acl.orig/src/nwfilter/nwfilter_learnipaddr.c
+++ libvirt-acl/src/nwfilter/nwfilter_learnipaddr.c
@@ -98,6 +98,11 @@ struct dhcp {
} ATTRIBUTE_PACKED;
#define DHCP_MSGT_DHCPOFFER 2
+#define DHCP_MSGT_DHCPACK 5
+
+
+#define DHCP_OPT_BCASTADDRESS 28
+#define DHCP_OPT_MESSAGETYPE 53
struct ether_vlan_header
{
@@ -336,17 +341,18 @@ procDHCPOpts(struct dhcp *dhcp, int dhcp
switch (dhcpopt->code) {
- case 28: /* Broadcast address */
+ case DHCP_OPT_BCASTADDRESS: /* Broadcast address */
if (dhcp_opts_len >= 6) {
uint32_t *tmp = (uint32_t *)&dhcpopt->value;
(*bcastaddr) = ntohl(*tmp);
}
break;
- case 53: /* Message type */
+ case DHCP_OPT_MESSAGETYPE: /* Message type */
if (dhcp_opts_len >= 3) {
uint8_t *val = (uint8_t *)&dhcpopt->value;
switch (*val) {
+ case DHCP_MSGT_DHCPACK:
case DHCP_MSGT_DHCPOFFER:
*vmaddr = dhcp->yiaddr;
*howDetected = DETECT_DHCP;
14 years, 6 months
[libvirt] [PATCH] Ignore qemu STOP event when stopping CPUs
by jdenemar@redhat.com
From: Jiri Denemark <jdenemar(a)redhat.com>
With JSON qemu monitor, we get a STOP event from qemu whenever qemu
stops guests CPUs. The downside of it is that vm->state is changed to
PAUSED and a new generic paused event is send to applications. However,
when we ask qemu to stop the CPUs we are not really interested in qemu
event and we usually want to issue a more specific event.
By setting vm->status to PAUSED before actually sending the request to
qemu (and resetting it back if the request fails) we can ignore the
event since the event handler does nothing when the guest is already
paused. This solution is quite hacky but unfortunately it's the best
solution which I was able to come up with and it doesn't introduce a
race condition.
---
src/qemu/qemu_driver.c | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3c4876e..8ccf0b7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4117,13 +4117,16 @@ static int qemudDomainSuspend(virDomainPtr dom) {
}
if (vm->state != VIR_DOMAIN_PAUSED) {
int rc;
+ int state = vm->state;
+ vm->state = VIR_DOMAIN_PAUSED;
qemuDomainObjEnterMonitorWithDriver(driver, vm);
rc = qemuMonitorStopCPUs(priv->mon);
qemuDomainObjExitMonitorWithDriver(driver, vm);
- if (rc < 0)
+ if (rc < 0) {
+ vm->state = state;
goto endjob;
- vm->state = VIR_DOMAIN_PAUSED;
+ }
event = virDomainEventNewFromObj(vm,
VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
@@ -4491,8 +4494,10 @@ qemuDomainMigrateOffline(struct qemud_driver *driver,
virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
+ int state = vm->state;
int ret;
+ vm->state = VIR_DOMAIN_PAUSED;
qemuDomainObjEnterMonitorWithDriver(driver, vm);
ret = qemuMonitorStopCPUs(priv->mon);
qemuDomainObjExitMonitorWithDriver(driver, vm);
@@ -4500,13 +4505,13 @@ qemuDomainMigrateOffline(struct qemud_driver *driver,
if (ret == 0) {
virDomainEventPtr event;
- vm->state = VIR_DOMAIN_PAUSED;
event = virDomainEventNewFromObj(vm,
VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED);
if (event)
qemuDomainEventQueue(driver, event);
- }
+ } else
+ vm->state = state;
return ret;
}
@@ -4743,13 +4748,14 @@ static int qemudDomainSaveFlag(virDomainPtr dom, const char *path,
/* Pause */
if (vm->state == VIR_DOMAIN_RUNNING) {
header.was_running = 1;
+ vm->state = VIR_DOMAIN_PAUSED;
qemuDomainObjEnterMonitorWithDriver(driver, vm);
if (qemuMonitorStopCPUs(priv->mon) < 0) {
qemuDomainObjExitMonitorWithDriver(driver, vm);
+ vm->state = VIR_DOMAIN_RUNNING;
goto endjob;
}
qemuDomainObjExitMonitorWithDriver(driver, vm);
- vm->state = VIR_DOMAIN_PAUSED;
}
/* Get XML for the domain */
@@ -5167,9 +5173,11 @@ static int qemudDomainCoreDump(virDomainPtr dom,
/* Pause domain for non-live dump */
if (!(flags & VIR_DUMP_LIVE) && vm->state == VIR_DOMAIN_RUNNING) {
+ vm->state = VIR_DOMAIN_PAUSED;
qemuDomainObjEnterMonitorWithDriver(driver, vm);
if (qemuMonitorStopCPUs(priv->mon) < 0) {
qemuDomainObjExitMonitorWithDriver(driver, vm);
+ vm->state = VIR_DOMAIN_RUNNING;
goto endjob;
}
qemuDomainObjExitMonitorWithDriver(driver, vm);
@@ -5214,6 +5222,7 @@ endjob:
"%s", _("resuming after dump failed"));
}
qemuDomainObjExitMonitorWithDriver(driver, vm);
+ vm->state = VIR_DOMAIN_RUNNING;
}
if (qemuDomainObjEndJob(vm) == 0)
@@ -11056,12 +11065,16 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
/* qemu unconditionally starts the domain running again after
* loadvm, so let's pause it to keep consistency
*/
+ int state = vm->state;
priv = vm->privateData;
+ vm->state = VIR_DOMAIN_PAUSED;
qemuDomainObjEnterMonitorWithDriver(driver, vm);
rc = qemuMonitorStopCPUs(priv->mon);
qemuDomainObjExitMonitorWithDriver(driver, vm);
- if (rc < 0)
+ if (rc < 0) {
+ vm->state = state;
goto cleanup;
+ }
}
event = virDomainEventNewFromObj(vm,
--
1.7.0.4
14 years, 6 months
[libvirt] 'dommemstat' is not working for LXC hypervisor.
by Kumar L Srikanth-B22348
Hi Daniel,
I am using libvirt version 0.8.0. I created a domain 'srikanth_vm' using
'lxc' hypervisor. I am able to start the Domain. But, I am not able to
get the memory stats for that Domain.
If I issue 'dommemstat Srikanth_vm' in the virsh console, the following
error is throwing:
error: Failed to get memory statistics for domain srikanth_vm
error: this function is not supported by the hypervisor:
virDomainMemoryStats
Can you please let me know, how can I get memory stats for a particular
domain in libvirt?
Regards,
Srikanth.
14 years, 6 months