[libvirt] [PATCH] Add utility functions for storing uninstalled location
by Nehal J Wani
When libvirtd is run from a build directory without being installed, it
should not depend on files from a libvirt package installed in the
system. Currently, APIs defined in src/ don't know whether libvirtd
is being run from the build dir or the installed dir. The following
additions provide the functionality to do so:
src/util/virutil.c
*virSetUninstalledDir
*virGetUninstalledDir
Example usage (utility = lxc|iohelper):
char *path_tmp = virGetUninstalledDir();
if (path_tmp)
/* do stuff with ("%s/../../src/libvirt_<utility>", path_tmp) */
else
/* do stuff with (LIBEXECDIR "/libvirt_<utility>") */
---
daemon/libvirtd.c | 1 +
src/libvirt_private.syms | 2 ++
src/util/virutil.c | 25 +++++++++++++++++++++++++
src/util/virutil.h | 3 +++
4 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 4179147..dc3da2a 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1165,6 +1165,7 @@ int main(int argc, char **argv) {
exit(EXIT_FAILURE);
}
*tmp = '\0';
+ virSetUninstalledDir(argv[0]);
char *driverdir;
if (virAsprintfQuiet(&driverdir, "%s/../../src/.libs", argv[0]) < 0 ||
virAsprintfQuiet(&cpumap, "%s/../../src/cpu/cpu_map.xml",
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 5904036..a112e6e 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1989,6 +1989,7 @@ virGetGroupList;
virGetGroupName;
virGetHostname;
virGetSelfLastChanged;
+virGetUninstalledDir;
virGetUnprivSGIOSysfsPath;
virGetUserCacheDirectory;
virGetUserConfigDirectory;
@@ -2017,6 +2018,7 @@ virSetInherit;
virSetNonBlock;
virSetUIDGID;
virSetUIDGIDWithCaps;
+virSetUninstalledDir;
virStrIsPrint;
virUpdateSelfLastChanged;
virValidateWWN;
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 733cdff..46f6c75 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -2204,3 +2204,28 @@ void virUpdateSelfLastChanged(const char *path)
selfLastChanged = sb.st_ctime;
}
}
+
+static char *uninstalledDir = NULL;
+/**
+ * virSetUninstalledDir:
+ * @path: location from which libvirtd is running without
+ * installation
+ *
+ * Set a pointer to the path which can be accessed by all
+ * other APIs using virGetUninstalledDir().
+ */
+void virSetUninstalledDir(char *path)
+{
+ uninstalledDir = path;
+}
+
+/**
+ * virGetUninstalledDir:
+ *
+ * If libvirtd is running without installation, return the
+ * path from which it was invoked, otherwise, return NULL
+ */
+char *virGetUninstalledDir(void)
+{
+ return uninstalledDir;
+}
diff --git a/src/util/virutil.h b/src/util/virutil.h
index 1f2efd5..3e6ba47 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -202,4 +202,7 @@ bool virIsSUID(void);
time_t virGetSelfLastChanged(void);
void virUpdateSelfLastChanged(const char *path);
+void virSetUninstalledDir(char *path);
+char *virGetUninstalledDir(void);
+
#endif /* __VIR_UTIL_H__ */
--
1.7.1
10 years, 8 months
[libvirt] [TCK][PATCH] Remove whitespace differences in network tmp files
by Mike Latimer
The network/100-apply-verify-host.t test compares the results of various
network commands (route, iptables, ebtables, etc...) against known, valid
results. Depending on the versions of these tools, minor whitespace
differences in command output can result in the failure of the test. This
patch resolves the problem by removing trailing spaces and replacing three
or more concurrent spaces with just two. These changes are only made to
the temporary files involved with the tests.
---
scripts/networks/networkApplyTest.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/scripts/networks/networkApplyTest.sh b/scripts/networks/networkApplyTest.sh
index 3e93c0a..924130f 100644
--- a/scripts/networks/networkApplyTest.sh
+++ b/scripts/networks/networkApplyTest.sh
@@ -142,6 +142,11 @@ checkExpectedOutput() {
break
fi
+ # Remove trailing whitespace, replace multiple spaces with just two
+ for file in ${tmpfile} ${tmpfile2}; do
+ sed -i -e 's/ *$//' -e 's/ */ /g' $file
+ done
+
diff "${tmpfile}" "${tmpfile2}" >/dev/null
if [ $? -ne 0 ]; then
--
1.8.4.5
10 years, 8 months
[libvirt] [PATCH] maint: update to latest gnulib
by Eric Blake
While we aren't impacted by most of upstream's changes this
month, at least the regex improvement looks useful.
* gnulib: Synchronize to upstream.
---
Pushing under trivial rule before we go into freeze.
* .gnulib 72fb907...ce457d6 (16):
> gitlog-to-changelog: include a dummy git-log-fix file
> autoupdate
> update from texinfo
> gitlog-to-changelog: also include the file, git-log-fix
> autoupdate
> regex: port to OS X 10.8.5 en_US.UTF-8 locale
> maint: fix ChangeLog to match commit record
> stdint, read-file: fix missing SIZE_MAX on Android (tiny change)
> parse-datetime: fix crash or infloop in TZ="" parsing
> * NEWS: Recent changes are not that important.
> savedir: new symbol for fast-read version
> unistd: port readlink to Mac OS X 10.3.9
> * NEWS: Document recent change to diffseq.
> diffseq: remove TOO_EXPENSIVE heuristic
> savedir: simplify by using stpcpy
> spawn: fix link error on uclibc
.gnulib | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gnulib b/.gnulib
index 72fb907..ce457d6 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 72fb9075b2812765d2ce55a1a26c3764392377cb
+Subproject commit ce457d622d947d8aa3e325d98a2818d097e7fec9
--
1.8.5.3
10 years, 8 months
[libvirt] [TCK][PATCH] Rename .pl tests to .t
by Mike Latimer
Commit 97c6a506 added several storage tests with a .pl extension. Rather than
enable .pl tests, this patch simply renames these tests to .t.
---
scripts/storage/{400-vol-download.pl => 400-vol-download.t} | 0
scripts/storage/{405-vol-download-all.pl => 405-vol-download-all.t} | 0
.../storage/{410-vol-download-nonblock.pl => 410-vol-download-nonblock.t} | 0
scripts/storage/{415-vol-upload.pl => 415-vol-upload.t} | 0
scripts/storage/{420-vol-upload-all.pl => 420-vol-upload-all.t} | 0
scripts/storage/{425-vol-upload-nonblock.pl => 425-vol-upload-nonblock.t} | 0
6 files changed, 0 insertions(+), 0 deletions(-)
rename scripts/storage/{400-vol-download.pl => 400-vol-download.t} (100%)
rename scripts/storage/{405-vol-download-all.pl => 405-vol-download-all.t} (100%)
rename scripts/storage/{410-vol-download-nonblock.pl => 410-vol-download-nonblock.t} (100%)
rename scripts/storage/{415-vol-upload.pl => 415-vol-upload.t} (100%)
rename scripts/storage/{420-vol-upload-all.pl => 420-vol-upload-all.t} (100%)
rename scripts/storage/{425-vol-upload-nonblock.pl => 425-vol-upload-nonblock.t} (100%)
diff --git a/scripts/storage/400-vol-download.pl b/scripts/storage/400-vol-download.t
similarity index 100%
rename from scripts/storage/400-vol-download.pl
rename to scripts/storage/400-vol-download.t
diff --git a/scripts/storage/405-vol-download-all.pl b/scripts/storage/405-vol-download-all.t
similarity index 100%
rename from scripts/storage/405-vol-download-all.pl
rename to scripts/storage/405-vol-download-all.t
diff --git a/scripts/storage/410-vol-download-nonblock.pl b/scripts/storage/410-vol-download-nonblock.t
similarity index 100%
rename from scripts/storage/410-vol-download-nonblock.pl
rename to scripts/storage/410-vol-download-nonblock.t
diff --git a/scripts/storage/415-vol-upload.pl b/scripts/storage/415-vol-upload.t
similarity index 100%
rename from scripts/storage/415-vol-upload.pl
rename to scripts/storage/415-vol-upload.t
diff --git a/scripts/storage/420-vol-upload-all.pl b/scripts/storage/420-vol-upload-all.t
similarity index 100%
rename from scripts/storage/420-vol-upload-all.pl
rename to scripts/storage/420-vol-upload-all.t
diff --git a/scripts/storage/425-vol-upload-nonblock.pl b/scripts/storage/425-vol-upload-nonblock.t
similarity index 100%
rename from scripts/storage/425-vol-upload-nonblock.pl
rename to scripts/storage/425-vol-upload-nonblock.t
--
1.8.4.5
10 years, 8 months
[libvirt] [python PATCH 1/2] qemu: support arbitrary monitor events
by Eric Blake
Wrap the new virConnectDomainQemuMonitorEventRegister function
being added in libvirt 1.2.2. This patch copies heavily from
network events (commit 6ea5be0) and from event loop callbacks
in libvirt-override.c, since in the libvirt_qemu module, we
must expose top-level functions rather than class members.
* generator.py (qemu_skip_function): Don't generate event code.
(qemuBuildWrappers): Delay manual portion until after imports.
* libvirt-qemu-override.py (qemuMonitorEventRegister)
(qemuMonitorEventDeregister): New file.
* libvirt-qemu-override.c
(libvirt_qemu_virConnectDomainQemuMonitorEventFreeFunc)
(libvirt_qemu_virConnectDomainQemuMonitorEventCallback)
(libvirt_qemu_virConnectDomainQemuMonitorEventRegister)
(libvirt_qemu_virConnectDomainQemuMonitorEventDeregister)
(libvirt_qemu_lookupPythonFunc, getLibvirtQemuDictObject)
(getLibvirtQemuModuleObject): New functions.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
generator.py | 20 +++--
libvirt-qemu-override.c | 221 ++++++++++++++++++++++++++++++++++++++++++++++-
libvirt-qemu-override.py | 36 ++++++++
3 files changed, 268 insertions(+), 9 deletions(-)
create mode 100644 libvirt-qemu-override.py
diff --git a/generator.py b/generator.py
index 42f3913..e2325b0 100755
--- a/generator.py
+++ b/generator.py
@@ -570,6 +570,8 @@ lxc_skip_function = (
)
qemu_skip_function = (
#"virDomainQemuAttach",
+ 'virConnectDomainQemuMonitorEventRegister', # overridden in -qemu.py
+ 'virConnectDomainQemuMonitorEventDeregister', # overridden in -qemu.py
)
# Generate C code, but skip python impl
@@ -1803,16 +1805,8 @@ def qemuBuildWrappers(module):
fd.write("#\n")
fd.write("# WARNING WARNING WARNING WARNING\n")
fd.write("#\n")
- if extra is not None:
- fd.writelines(extra.readlines())
- fd.write("#\n")
- fd.write("# WARNING WARNING WARNING WARNING\n")
- fd.write("#\n")
fd.write("# Automatically written part of python bindings for libvirt\n")
fd.write("#\n")
- fd.write("# WARNING WARNING WARNING WARNING\n")
- if extra is not None:
- extra.close()
fd.write("try:\n")
fd.write(" import libvirtmod_qemu\n")
@@ -1826,6 +1820,16 @@ def qemuBuildWrappers(module):
fd.write(" raise lib_e\n\n")
fd.write("import libvirt\n\n")
+ fd.write("# WARNING WARNING WARNING WARNING\n")
+ fd.write("#\n")
+ if extra is not None:
+ fd.writelines(extra.readlines())
+ fd.write("#\n")
+ if extra is not None:
+ extra.close()
+
+ fd.write("# WARNING WARNING WARNING WARNING\n")
+ fd.write("#\n")
fd.write("#\n# Functions from module %s\n#\n\n" % module)
#
# Generate functions directly, no classes
diff --git a/libvirt-qemu-override.c b/libvirt-qemu-override.c
index 480a7d3..0abcd3f 100644
--- a/libvirt-qemu-override.c
+++ b/libvirt-qemu-override.c
@@ -4,7 +4,7 @@
* entry points where an automatically generated stub is
* unpractical
*
- * Copyright (C) 2011-2012 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
*
* Daniel Veillard <veillard(a)redhat.com>
*/
@@ -54,6 +54,76 @@ extern void initcygvirtmod_qemu(void);
#define VIR_PY_INT_FAIL (libvirt_intWrap(-1))
#define VIR_PY_INT_SUCCESS (libvirt_intWrap(0))
+/*******************************************
+ * Helper functions to avoid importing modules
+ * for every callback
+ *******************************************/
+#if LIBVIR_CHECK_VERSION(1, 2, 2)
+static PyObject *libvirt_qemu_module;
+static PyObject *libvirt_qemu_dict;
+
+static PyObject *
+getLibvirtQemuModuleObject(void)
+{
+ if (libvirt_qemu_module)
+ return libvirt_qemu_module;
+
+ // PyImport_ImportModule returns a new reference
+ /* Bogus (char *) cast for RHEL-5 python API brokenness */
+ libvirt_qemu_module = PyImport_ImportModule((char *)"libvirt_qemu");
+ if (!libvirt_qemu_module) {
+ DEBUG("%s Error importing libvirt_qemu module\n", __FUNCTION__);
+ PyErr_Print();
+ return NULL;
+ }
+
+ return libvirt_qemu_module;
+}
+
+static PyObject *
+getLibvirtQemuDictObject(void)
+{
+ if (libvirt_qemu_dict)
+ return libvirt_qemu_dict;
+
+ // PyModule_GetDict returns a borrowed reference
+ libvirt_qemu_dict = PyModule_GetDict(getLibvirtQemuModuleObject());
+ if (!libvirt_qemu_dict) {
+ DEBUG("%s Error importing libvirt_qemu dictionary\n", __FUNCTION__);
+ PyErr_Print();
+ return NULL;
+ }
+
+ Py_INCREF(libvirt_qemu_dict);
+ return libvirt_qemu_dict;
+}
+
+
+static PyObject *
+libvirt_qemu_lookupPythonFunc(const char *funcname)
+{
+ PyObject *python_cb;
+
+ /* Lookup the python callback */
+ python_cb = PyDict_GetItemString(getLibvirtQemuDictObject(), funcname);
+
+ if (!python_cb) {
+ DEBUG("%s: Error finding %s\n", __FUNCTION__, funcname);
+ PyErr_Print();
+ PyErr_Clear();
+ return NULL;
+ }
+
+ if (!PyCallable_Check(python_cb)) {
+ DEBUG("%s: %s is not callable\n", __FUNCTION__, funcname);
+ return NULL;
+ }
+
+ return python_cb;
+}
+#endif /* LIBVIR_CHECK_VERSION(1, 2, 2) */
+
+
/************************************************************************
* *
* Statistics *
@@ -122,6 +192,151 @@ libvirt_qemu_virDomainQemuAgentCommand(PyObject *self ATTRIBUTE_UNUSED, PyObject
}
#endif /* LIBVIR_CHECK_VERSION(0, 10, 0) */
+
+#if LIBVIR_CHECK_VERSION(1, 2, 2)
+static void
+libvirt_qemu_virConnectDomainQemuMonitorEventFreeFunc(void *opaque)
+{
+ PyObject *pyobj_conn = (PyObject*)opaque;
+ LIBVIRT_ENSURE_THREAD_STATE;
+ Py_DECREF(pyobj_conn);
+ LIBVIRT_RELEASE_THREAD_STATE;
+}
+
+static void
+libvirt_qemu_virConnectDomainQemuMonitorEventCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virDomainPtr dom,
+ const char *event,
+ long long seconds,
+ unsigned int micros,
+ const char *details,
+ void *opaque)
+{
+ PyObject *pyobj_cbData = (PyObject*)opaque;
+ PyObject *pyobj_dom;
+ PyObject *pyobj_ret;
+ PyObject *pyobj_conn;
+ PyObject *dictKey;
+ PyObject *pyobj_cb;
+
+ LIBVIRT_ENSURE_THREAD_STATE;
+
+ pyobj_cb = libvirt_qemu_lookupPythonFunc("_dispatchQemuMonitorEventCallback");
+ if (!pyobj_cb) {
+ goto cleanup;
+ }
+
+ dictKey = libvirt_constcharPtrWrap("conn");
+ if (!dictKey)
+ return;
+ pyobj_conn = PyDict_GetItem(pyobj_cbData, dictKey);
+ Py_DECREF(dictKey);
+
+ /* Create a python instance of this virDomainPtr */
+ virDomainRef(dom);
+ pyobj_dom = libvirt_virDomainPtrWrap(dom);
+ Py_INCREF(pyobj_cbData);
+
+ /* Call the Callback Dispatcher */
+ pyobj_ret = PyObject_CallFunction(pyobj_cb,
+ (char *)"OOsLIsO",
+ pyobj_conn, pyobj_dom, event, seconds,
+ micros, details, pyobj_cbData);
+
+ Py_DECREF(pyobj_cbData);
+ Py_DECREF(pyobj_dom);
+
+ if (!pyobj_ret) {
+ DEBUG("%s - ret:%p\n", __FUNCTION__, pyobj_ret);
+ PyErr_Print();
+ } else {
+ Py_DECREF(pyobj_ret);
+ }
+
+cleanup:
+ LIBVIRT_RELEASE_THREAD_STATE;
+}
+
+
+static PyObject *
+libvirt_qemu_virConnectDomainQemuMonitorEventRegister(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ PyObject *py_retval;
+ PyObject *pyobj_conn;
+ PyObject *pyobj_dom;
+ PyObject *pyobj_cbData;
+ const char *event;
+ virConnectPtr conn;
+ int ret = 0;
+ virConnectDomainQemuMonitorEventCallback cb = NULL;
+ virDomainPtr dom;
+ unsigned int flags;
+
+ if (!PyArg_ParseTuple
+ (args, (char *) "OOzOI",
+ &pyobj_conn, &pyobj_dom, &event, &pyobj_cbData, &flags)) {
+ DEBUG("%s failed parsing tuple\n", __FUNCTION__);
+ return VIR_PY_INT_FAIL;
+ }
+
+ DEBUG("libvirt_qemu_virConnectDomainQemuMonitorEventRegister(%p %p %s %p %x) called\n",
+ pyobj_conn, pyobj_dom, NULLSTR(event), pyobj_cbData, flags);
+ conn = PyvirConnect_Get(pyobj_conn);
+ if (pyobj_dom == Py_None)
+ dom = NULL;
+ else
+ dom = PyvirDomain_Get(pyobj_dom);
+
+ cb = libvirt_qemu_virConnectDomainQemuMonitorEventCallback;
+
+ Py_INCREF(pyobj_cbData);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ ret = virConnectDomainQemuMonitorEventRegister(conn, dom, event,
+ cb, pyobj_cbData,
+ libvirt_qemu_virConnectDomainQemuMonitorEventFreeFunc,
+ flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (ret < 0)
+ Py_DECREF(pyobj_cbData);
+
+ py_retval = libvirt_intWrap(ret);
+ return py_retval;
+}
+
+
+static PyObject *
+libvirt_qemu_virConnectDomainQemuMonitorEventDeregister(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ PyObject *py_retval;
+ PyObject *pyobj_conn;
+ int callbackID;
+ virConnectPtr conn;
+ int ret = 0;
+
+ if (!PyArg_ParseTuple
+ (args, (char *) "Oi:virConnectDomainQemuMonitorEventDeregister",
+ &pyobj_conn, &callbackID))
+ return NULL;
+
+ DEBUG("libvirt_qemu_virConnectDomainQemuMonitorEventDeregister(%p) called\n",
+ pyobj_conn);
+
+ conn = PyvirConnect_Get(pyobj_conn);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+
+ ret = virConnectDomainQemuMonitorEventDeregister(conn, callbackID);
+
+ LIBVIRT_END_ALLOW_THREADS;
+ py_retval = libvirt_intWrap(ret);
+ return py_retval;
+}
+#endif /* LIBVIR_CHECK_VERSION(1, 2, 2) */
+
/************************************************************************
* *
* The registration stuff *
@@ -133,6 +348,10 @@ static PyMethodDef libvirtQemuMethods[] = {
#if LIBVIR_CHECK_VERSION(0, 10, 0)
{(char *) "virDomainQemuAgentCommand", libvirt_qemu_virDomainQemuAgentCommand, METH_VARARGS, NULL},
#endif /* LIBVIR_CHECK_VERSION(0, 10, 0) */
+#if LIBVIR_CHECK_VERSION(1, 2, 2)
+ {(char *) "virConnectDomainQemuMonitorEventRegister", libvirt_qemu_virConnectDomainQemuMonitorEventRegister, METH_VARARGS, NULL},
+ {(char *) "virConnectDomainQemuMonitorEventDeregister", libvirt_qemu_virConnectDomainQemuMonitorEventDeregister, METH_VARARGS, NULL},
+#endif /* LIBVIR_CHECK_VERSION(1, 2, 2) */
{NULL, NULL, 0, NULL}
};
diff --git a/libvirt-qemu-override.py b/libvirt-qemu-override.py
new file mode 100644
index 0000000..ab48bec
--- /dev/null
+++ b/libvirt-qemu-override.py
@@ -0,0 +1,36 @@
+# Manually written part of python bindings for libvirt-qemu
+
+def _dispatchQemuMonitorEventCallback(conn, dom, event, seconds, micros, details, cbData):
+ """Dispatches events to python user qemu monitor event callbacks
+ """
+ cb = cbData["cb"]
+ opaque = cbData["opaque"]
+
+ cb(conn, libvirt.virDomain(conn, _obj=dom), event, seconds, micros, details, opaque)
+ return 0
+
+def qemuMonitorEventDeregister(conn, callbackID):
+ """Removes a qemu monitor event callback. De-registering for a callback
+ will disable delivery of this event type"""
+ try:
+ ret = libvirtmod_qemu.virConnectDomainQemuMonitorEventDeregister(conn._o, callbackID)
+ if ret == -1: raise libvirt.libvirtError ('virConnectDomainQemuMonitorEventDeregister() failed')
+ del conn.qemuMonitorEventCallbackID[callbackID]
+ except AttributeError:
+ pass
+
+def qemuMonitorEventRegister(conn, dom, event, cb, opaque, flags=0):
+ """Adds a qemu monitor event callback. Registering for a monitor
+ callback will enable delivery of the events"""
+ if not hasattr(conn, 'qemuMonitorEventCallbackID'):
+ conn.qemuMonitorEventCallbackID = {}
+ cbData = { "cb": cb, "conn": conn, "opaque": opaque }
+ if dom is None:
+ ret = libvirtmod_qemu.virConnectDomainQemuMonitorEventRegister(conn._o, None, event, cbData, flags)
+ else:
+ ret = libvirtmod_qemu.virConnectDomainQemuMonitorEventRegister(conn._o, dom._o, event, cbData, flags)
+ if ret == -1:
+ raise libvirt.libvirtError ('virConnectDomainQemuMonitorEventRegister() failed')
+ conn.qemuMonitorEventCallbackID[ret] = opaque
+ return ret
+
--
1.8.5.3
10 years, 8 months
[libvirt] [PATCH v8 resend 0/4] support dumping guest memory in compressed format
by Wen Congyang
From: Qiao Nuohan <qiaonuohan(a)cn.fujitsu.com>
dumping guest's memory is introduced without compression supported, but now
qemu can dump guest's memory in kdump-compressed format. This patchset is used
to add support in libvirt side to let qemu do the dump in compressed format and
please refer the following address to see implementation of the qemu side, the
lastest version of qemu side is v9.
http://lists.nongnu.org/archive/html/qemu-devel/2014-02/msg03016.html
ChangLog:
Changes from v7 to v8:
1. add test for qemuMonitorGetDumpGuestMemoryCapability
2. fix a bug when dumping a elf core with the an older version of qemu
Changes from v6 to v7:
1. revert changing dumpformat of virDomainCoreDumpWithFormat back to an enum
Changes from v5 to v6:
1. add qemuMonitorGetDumpGuestMemoryCapability API to check the available dump
format
Changes from v4 to v5:
1. modify some restriction check
Changes from v3 to v4:
1. dropping patch "add dump_memory_format in qemu.conf"
2. fix to follow some conventions
Changes from v2 to v3:
1. address Jiri Denemark's comment about adding a new public API instead of
changing an old one.
Changes from v1 to v2:
1. address Daniel P. Berrange's comment about using a new parameter to replace
flags like VIR_DUMP_COMPRESS_ZLIB.
Qiao Nuohan (4):
add new virDomainCoreDumpWithFormat API
qemu: add qemuMonitorGetDumpGuestMemoryCapability
qemu: add support for virDomainCoreDumpWithFormat API
allow "virsh dump --memory-only" specify dump format
include/libvirt/libvirt.h.in | 31 ++++++++++++++
src/driver.h | 7 ++++
src/libvirt.c | 98 ++++++++++++++++++++++++++++++++++++++++++++
src/libvirt_public.syms | 5 +++
src/qemu/qemu_driver.c | 75 ++++++++++++++++++++++++++++-----
src/qemu/qemu_monitor.c | 27 ++++++++++--
src/qemu/qemu_monitor.h | 6 ++-
src/qemu/qemu_monitor_json.c | 85 +++++++++++++++++++++++++++++++++++---
src/qemu/qemu_monitor_json.h | 6 ++-
src/remote/remote_driver.c | 1 +
src/remote/remote_protocol.x | 15 ++++++-
src/remote_protocol-structs | 7 ++++
src/test/test_driver.c | 22 ++++++++--
tests/qemumonitorjsontest.c | 45 +++++++++++++++++++-
tools/virsh-domain.c | 47 +++++++++++++++++++--
tools/virsh.pod | 6 +++
16 files changed, 454 insertions(+), 29 deletions(-)
--
1.8.5.3
10 years, 8 months
[libvirt] [PATCHv2] maint: balance {} usage
by Eric Blake
Emacs gets lost when finding function boundaries when #ifdef
sections do not have balanced {}.
* libvirt-override.c (libvirt_PyString_Check): New define.
(virPyDictToTypedParams): Avoid unbalanced {} across ifdef.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
v2: Hoisting #ifdefs outside of function bodies makes it nicer
libvirt-override.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/libvirt-override.c b/libvirt-override.c
index 2532400..6a85d24 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -4,7 +4,7 @@
* entry points where an automatically generated stub is
* unpractical
*
- * Copyright (C) 2005, 2007-2013 Red Hat, Inc.
+ * Copyright (C) 2005, 2007-2014 Red Hat, Inc.
*
* Daniel Veillard <veillard(a)redhat.com>
*/
@@ -272,6 +272,12 @@ typedef struct {
} virPyTypedParamsHint;
typedef virPyTypedParamsHint *virPyTypedParamsHintPtr;
+# if PY_MAJOR_VERSION > 2
+# define libvirt_PyString_Check PyUnicode_Check
+# else
+# define libvirt_PyString_Check PyString_Check
+# endif
+
/* Automatically convert dict into type parameters based on types reported
* by python. All integer types are converted into LLONG (in case of a negative
* value) or ULLONG (in case of a positive value). If you need different
@@ -321,11 +327,7 @@ virPyDictToTypedParams(PyObject *dict,
}
if (type == -1) {
-#if PY_MAJOR_VERSION > 2
- if (PyUnicode_Check(value)) {
-#else
- if (PyString_Check(value)) {
-#endif
+ if (libvirt_PyString_Check(value)) {
type = VIR_TYPED_PARAM_STRING;
} else if (PyBool_Check(value)) {
type = VIR_TYPED_PARAM_BOOLEAN;
--
1.8.5.3
10 years, 8 months
[libvirt] [PATCH] apparmor: Fix build after split of disk source metadata
by Peter Krempa
Commit 4f20226664b2d4d9e9496ec1e05c9280581a1ca0 breaks build with
AppArmor enabled as it missed the refactor to the new accessors.
---
Notes:
Pushed under the build-breaker rule.
src/security/security_apparmor.c | 13 ++++++++-----
src/security/virt-aa-helper.c | 4 ++--
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index f7b67ba..6dca476 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -688,7 +688,7 @@ AppArmorRestoreSecurityImageLabel(virSecurityManagerPtr mgr,
virDomainDefPtr def,
virDomainDiskDefPtr disk)
{
- if (disk->type == VIR_DOMAIN_DISK_TYPE_NETWORK)
+ if (virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_NETWORK)
return 0;
return reload_profile(mgr, def, NULL, false);
@@ -710,14 +710,16 @@ AppArmorSetSecurityImageLabel(virSecurityManagerPtr mgr,
if (secdef->norelabel)
return 0;
- if (!disk->src || disk->type == VIR_DOMAIN_DISK_TYPE_NETWORK)
+ if (!virDomainDiskGetSource(disk) ||
+ virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_NETWORK)
return 0;
if (secdef->imagelabel) {
/* if the device doesn't exist, error out */
- if (!virFileExists(disk->src)) {
+ if (!virFileExists(virDomainDiskGetSource(disk))) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("\'%s\' does not exist"), disk->src);
+ _("\'%s\' does not exist"),
+ virDomainDiskGetSource(disk));
return rc;
}
@@ -726,7 +728,8 @@ AppArmorSetSecurityImageLabel(virSecurityManagerPtr mgr,
/* update the profile only if it is loaded */
if (profile_loaded(secdef->imagelabel) >= 0) {
- if (load_profile(mgr, secdef->imagelabel, def, disk->src,
+ if (load_profile(mgr, secdef->imagelabel, def,
+ virDomainDiskGetSource(disk),
false) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot update AppArmor profile "
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index b8b0610..ddfcb0a 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -948,8 +948,8 @@ get_files(vahControl * ctl)
*/
if (!disk->backingChain) {
bool probe = ctl->allowDiskFormatProbing;
- disk->backingChain = virStorageFileGetMetadata(disk->src,
- disk->format,
+ disk->backingChain = virStorageFileGetMetadata(virDomainDiskGetSource(disk),
+ virDomainDiskGetFormat(disk),
-1, -1, probe);
}
--
1.9.0
10 years, 8 months
[libvirt] [python PATCH] maint: Add ctags configuration file and ignore the output
by Peter Krempa
Add the config file to ease creation of tags to help navigation in
editors.
---
.ctags | 2 ++
.gitignore | 1 +
2 files changed, 3 insertions(+)
create mode 100644 .ctags
diff --git a/.ctags b/.ctags
new file mode 100644
index 0000000..21ac79a
--- /dev/null
+++ b/.ctags
@@ -0,0 +1,2 @@
+--recurse
+--exclude=*.orig
diff --git a/.gitignore b/.gitignore
index f47e786..a28e63c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ MANIFEST
*#*#
*.#*#
*.pyc
+tags
--
1.9.0
10 years, 8 months
[libvirt] [PATCH 00/18] split virDomainDiskDef
by Eric Blake
I still have quite a bit of work to consolidate util/virStorageFile,
conf/snapshot_conf.c, and the new struct in this series to all share
the same common struct (basically, moving the struct created in
this series over to util). But by refactoring the most common
accesses to go through functions instead of direct field access,
I've limited the amount of code that is actually impacted by
using the new struct. In general, this series should not be
changing any behavior.
Eric Blake (18):
conf: accessors for common source information
conf: use disk source accessors in conf/
conf: use disk source accessors in bhyve/
conf: use disk source accessors in esx/
conf: use disk source accessors in libxl/
conf: use disk source accessors in locking/
conf: use disk source accessors in lxc/
conf: use disk source accessors in parallels/
conf: use disk source accessors in phyp/
conf: use disk source accessors in qemu/
conf: use disk source accessors in security/
conf: use disk source accessors in uml/
conf: use disk source accessors in vbox/
conf: use disk source accessors in vmware/
conf: use disk source accessors in vmx/
conf: use disk source accessors in xen/
conf: use disk source accessors in xenxs/
conf: prepare to track multiple host source files per <disk>
src/bhyve/bhyve_command.c | 9 +-
src/conf/domain_audit.c | 7 +-
src/conf/domain_conf.c | 253 +++++++++++++++++++++-----------
src/conf/domain_conf.h | 47 ++++--
src/conf/snapshot_conf.c | 2 +-
src/esx/esx_driver.c | 26 ++--
src/libvirt_private.syms | 8 +
src/libxl/libxl_conf.c | 50 ++++---
src/libxl/libxl_driver.c | 26 ++--
src/locking/domain_lock.c | 19 ++-
src/lxc/lxc_cgroup.c | 6 +-
src/lxc/lxc_controller.c | 77 +++++-----
src/lxc/lxc_driver.c | 35 +++--
src/parallels/parallels_driver.c | 31 ++--
src/phyp/phyp_driver.c | 10 +-
src/qemu/qemu_command.c | 308 ++++++++++++++++++++-------------------
src/qemu/qemu_conf.c | 108 +++++++-------
src/qemu/qemu_domain.c | 60 ++++----
src/qemu/qemu_driver.c | 203 +++++++++++++-------------
src/qemu/qemu_hotplug.c | 116 ++++++++-------
src/qemu/qemu_migration.c | 21 +--
src/qemu/qemu_process.c | 19 +--
src/security/security_dac.c | 17 ++-
src/security/security_selinux.c | 20 +--
src/storage/storage_driver.c | 8 +-
src/uml/uml_conf.c | 4 +-
src/uml/uml_driver.c | 5 +-
src/vbox/vbox_tmpl.c | 137 +++++++++--------
src/vmware/vmware_conf.c | 18 ++-
src/vmware/vmware_conf.h | 6 +-
src/vmx/vmx.c | 113 ++++++++------
src/xen/xend_internal.c | 11 +-
src/xenxs/xen_sxpr.c | 111 +++++++-------
src/xenxs/xen_xm.c | 113 +++++++-------
tests/securityselinuxlabeltest.c | 8 +-
35 files changed, 1119 insertions(+), 893 deletions(-)
--
1.8.5.3
10 years, 8 months