[libvirt] [PATCHv3 0/7] Block job fixes and refactors
by Peter Krempa
Peter Krempa (7):
qemu: monitor: json: Refactor error code class checker
qemu: monitor: Extract handling of JSON block job error codes
qemu: blockjob: Split qemuDomainBlockJobSetSpeed from
qemuDomainBlockJobImpl
qemu: blockjob: Separate qemuDomainBlockJobAbort from
qemuDomainBlockJobImpl
qemu: blockPull: Refactor the rest of qemuDomainBlockJobImpl
qemu: drivePivot: Fix assumption when 'block-job-complete' fails
qemu: Refactor qemuDomainBlockJobAbort()
src/qemu/qemu_driver.c | 367 ++++++++++++++++++++++++-------------------
src/qemu/qemu_migration.c | 8 +-
src/qemu/qemu_monitor.c | 67 ++++++--
src/qemu/qemu_monitor.h | 29 ++--
src/qemu/qemu_monitor_json.c | 213 ++++++++++++++-----------
src/qemu/qemu_monitor_json.h | 24 ++-
6 files changed, 414 insertions(+), 294 deletions(-)
--
2.2.2
9 years, 7 months
[libvirt] [PATCH 0/5] Refactor vcpupin parser and fix error checking
by Peter Krempa
Peter Krempa (5):
conf: Split out parsing of emulatorpin
conf: Split up virDomainVcpuPinDefParseXML
conf: Error out if iothread id is missing in iothreadpin
conf: Refactor virDomainVcpuPinDefParseXML
qemu: Fix condition for checking vcpu when pinning vcpus
src/conf/domain_conf.c | 197 +++++++++++++++++++++++++++++--------------------
src/qemu/qemu_driver.c | 13 +++-
2 files changed, 128 insertions(+), 82 deletions(-)
--
2.2.2
9 years, 7 months
[libvirt] [PATCH] lib: snapshot: Explain that only one layer of images is inserted
by Peter Krempa
When creating a snapshot with _REUSE_EXTERNAL when the pre-created image
does not directly link to the current active layer libvirt would
re-detect the backing chain incorrectly and it would not match with
qemu's view. Since the configuration is an operator mistake, document
that only the top layer image gets inserted.
---
src/libvirt-domain-snapshot.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/libvirt-domain-snapshot.c b/src/libvirt-domain-snapshot.c
index ac858ba..55826fd 100644
--- a/src/libvirt-domain-snapshot.c
+++ b/src/libvirt-domain-snapshot.c
@@ -177,8 +177,9 @@ virDomainSnapshotGetConnect(virDomainSnapshotPtr snapshot)
* the correct image format and metadata including backing store path
* (this allows a management app to pre-create files with relative backing
* file names, rather than the default of creating with absolute backing
- * file names). Note that setting incorrect metadata in the pre-created
- * image may lead to the VM being unable to start.
+ * file names). Note that only the file specified in the snapshot XML is
+ * inserted as a snapshot thus setting incorrect metadata in the pre-created
+ * image may lead to the VM being unable to start or other block jobs may fail.
*
* Be aware that although libvirt prefers to report errors up front with
* no other effect, some hypervisors have certain types of failures where
--
2.3.5
9 years, 7 months
[libvirt] [PATCH 0/2] Fix handling of disk's WWN (world wide name)
by Peter Krempa
Peter Krempa (2):
conf: ABI: Check WWN in disk abi stability check
qemu: Enforce WWN to be unique among VM's disks
docs/formatdomain.html.in | 3 ++-
src/conf/domain_conf.c | 33 +++++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 3 +++
src/libvirt_private.syms | 1 +
src/qemu/qemu_process.c | 3 +++
5 files changed, 42 insertions(+), 1 deletion(-)
--
2.2.2
9 years, 7 months
[libvirt] [PATCH v2 0/9] Implement Add/Del IOThreads
by John Ferlan
v1:
http://www.redhat.com/archives/libvir-list/2015-March/msg01014.html
v2 is mostly a completely rewrite of v1 - only smart parts were kept,
mostly the "concepts" behind adding/removing a thread
Patches 1&2:
Couple of simple mods - mostly innocuous
Patches 3-5
Since it was determined that just setting the IOThread count and
keeping sequential IOThread ID's may not be a desired means to
add/remove threads, I decided upon a mechanism which to a degree
follows the tune/pin mechanism.
Rework the existing IOThread logic to make use of a new domain
XML element <iothreadids> which will list each of the <iothread>'s
with attributes "id" (required) and "name" (optional). The "id"
allows one to generate their own ID number/naming mechanism. If
<iothreadids> is not found in the XML, then internally will generate
the data structures that support it - IOThreadID's.
Work the IOThreadID logic into the "live" iothreadpid lists (or now
arrays) to manage the live IOThread data
Patches 6-7
Add the API/plumbing for two new API's - virDomainAddIOThread and
virDomainDelIOThread to complement the existing virDomainPinIOThread.
The "Add" API will take two parameters - an iothread_id and an optional
"name". The "Del" API will take just one parameter - the iothread_id
Patch 8-9
Implement the qemu backend and virsh front end to manage IOThreads
either live or just the config file. I did leave some // comments in
Patch 8 as a way to ask a reviewer their thoughts in the add live
error path whether 'extra' cleanup should be done or just ignored.
Those would be cleaned up and removed for the final version.
John Ferlan (9):
Rename qemuCheckIothreads to qemuCheckIOThreads
Convert virDomainPinIsDuplicate into bool return
conf: Add new domain XML element 'iothreadids'
qemu: Convert iothreadpids into an array of structures
qemu: Use domain iothreadids to populate iothreadpids
Implement virDomainAddIOThread and virDomainDelIOThread
remote: Add support for AddIOThread and DelIOThread
qemu: Add support to Add/Delete IOThreads
virsh: Add iothreadadd and iothreaddel commands
docs/formatdomain.html.in | 28 ++
docs/schemas/domaincommon.rng | 17 +
include/libvirt/libvirt-domain.h | 7 +
src/conf/domain_audit.c | 9 +
src/conf/domain_audit.h | 6 +
src/conf/domain_conf.c | 253 ++++++++++-
src/conf/domain_conf.h | 29 +-
src/driver-hypervisor.h | 13 +
src/libvirt-domain.c | 132 ++++++
src/libvirt_private.syms | 7 +
src/libvirt_public.syms | 6 +
src/qemu/qemu_cgroup.c | 16 +-
src/qemu/qemu_command.c | 108 ++++-
src/qemu/qemu_command.h | 4 +
src/qemu/qemu_domain.c | 55 ++-
src/qemu/qemu_domain.h | 12 +-
src/qemu/qemu_driver.c | 467 ++++++++++++++++++++-
src/qemu/qemu_process.c | 32 +-
src/remote/remote_driver.c | 2 +
src/remote/remote_protocol.x | 31 +-
src/remote_protocol-structs | 13 +
.../qemuxml2argv-iothreads-ids-partial.args | 10 +
.../qemuxml2argv-iothreads-ids-partial.xml | 33 ++
.../qemuxml2argv-iothreads-ids.args | 8 +
.../qemuxml2argv-iothreads-ids.xml | 33 ++
.../qemuxml2argv-iothreads-name.args | 17 +
.../qemuxml2argv-iothreads-name.xml | 44 ++
tests/qemuxml2argvtest.c | 4 +
tests/qemuxml2xmltest.c | 3 +
tools/virsh-domain.c | 174 ++++++++
tools/virsh.pod | 32 ++
31 files changed, 1546 insertions(+), 59 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-iothreads-ids-partial.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-iothreads-ids-partial.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-iothreads-ids.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-iothreads-ids.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-iothreads-name.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-iothreads-name.xml
--
2.1.0
9 years, 7 months
[libvirt] [python PATCH] Implement the DEVICE_ADDED event
by Ján Tomko
---
examples/event-test.py | 4 +++
libvirt-override-virConnect.py | 9 +++++++
libvirt-override.c | 57 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 70 insertions(+)
diff --git a/examples/event-test.py b/examples/event-test.py
index 452f659..2c6ce7b 100755
--- a/examples/event-test.py
+++ b/examples/event-test.py
@@ -527,6 +527,9 @@ def myDomainEventTunableCallback(conn, dom, params, opaque):
print("myDomainEventTunableCallback: Domain %s(%s) %s" % (dom.name(), dom.ID(), params))
def myDomainEventAgentLifecycleCallback(conn, dom, state, reason, opaque):
print("myDomainEventAgentLifecycleCallback: Domain %s(%s) %s %s" % (dom.name(), dom.ID(), agentLifecycleStateToString(state), agentLifecycleReasonToString(reason)))
+def myDomainEventDeviceAddedCallback(conn, dom, dev, opaque):
+ print("myDomainEventDeviceAddedCallback: Domain %s(%s) device added: %s" % (
+ dom.name(), dom.ID(), dev))
##########################################################################
# Network events
@@ -638,6 +641,7 @@ def main():
vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2, myDomainEventBlockJob2Callback, None)
vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_TUNABLE, myDomainEventTunableCallback, None)
vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE, myDomainEventAgentLifecycleCallback, None)
+ vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_DEVICE_ADDED, myDomainEventDeviceAddedCallback, None)
vc.networkEventRegisterAny(None, libvirt.VIR_NETWORK_EVENT_ID_LIFECYCLE, myNetworkEventLifecycleCallback, None)
diff --git a/libvirt-override-virConnect.py b/libvirt-override-virConnect.py
index 88c864c..821be87 100644
--- a/libvirt-override-virConnect.py
+++ b/libvirt-override-virConnect.py
@@ -207,6 +207,15 @@
cb(self, virDomain(self, _obj=dom), state, reason, opaque)
return 0
+ def _dispatchDomainEventDeviceAddedCallback(self, dom, devAlias, cbData):
+ """Dispatches event to python user domain device added event callbacks
+ """
+ cb = cbData["cb"]
+ opaque = cbData["opaque"]
+
+ cb(self, virDomain(self, _obj=dom), devAlias, opaque)
+ return 0
+
def domainEventDeregisterAny(self, callbackID):
"""Removes a Domain Event Callback. De-registering for a
domain callback will disable delivery of this event type """
diff --git a/libvirt-override.c b/libvirt-override.c
index f770ffe..588dac1 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -6901,6 +6901,58 @@ libvirt_virConnectDomainEventAgentLifecycleCallback(virConnectPtr conn ATTRIBUTE
}
#endif /* VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE */
+#ifdef VIR_DOMAIN_EVENT_ID_DEVICE_ADDED
+static int
+libvirt_virConnectDomainEventDeviceAddedCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virDomainPtr dom,
+ const char *devAlias,
+ void *opaque)
+{
+ PyObject *pyobj_cbData = (PyObject*)opaque;
+ PyObject *pyobj_dom;
+ PyObject *pyobj_ret = NULL;
+ PyObject *pyobj_conn;
+ PyObject *dictKey;
+ int ret = -1;
+
+ LIBVIRT_ENSURE_THREAD_STATE;
+
+ if (!(dictKey = libvirt_constcharPtrWrap("conn")))
+ goto cleanup;
+ pyobj_conn = PyDict_GetItem(pyobj_cbData, dictKey);
+ Py_DECREF(dictKey);
+
+ /* Create a python instance of this virDomainPtr */
+ virDomainRef(dom);
+ if (!(pyobj_dom = libvirt_virDomainPtrWrap(dom))) {
+ virDomainFree(dom);
+ goto cleanup;
+ }
+ Py_INCREF(pyobj_cbData);
+
+ /* Call the Callback Dispatcher */
+ pyobj_ret = PyObject_CallMethod(pyobj_conn,
+ (char*)"_dispatchDomainEventDeviceAddedCallback",
+ (char*)"OsO",
+ pyobj_dom, devAlias, pyobj_cbData);
+
+ Py_DECREF(pyobj_cbData);
+ Py_DECREF(pyobj_dom);
+
+ cleanup:
+ if (!pyobj_ret) {
+ DEBUG("%s - ret:%p\n", __FUNCTION__, pyobj_ret);
+ PyErr_Print();
+ } else {
+ Py_DECREF(pyobj_ret);
+ ret = 0;
+ }
+
+ LIBVIRT_RELEASE_THREAD_STATE;
+ return ret;
+
+}
+#endif /* VIR_DOMAIN_EVENT_ID_DEVICE_ADDED */
static PyObject *
libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject *self,
@@ -6999,6 +7051,11 @@ libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject *self,
cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventAgentLifecycleCallback);
break;
#endif /* VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE */
+#ifdef VIR_DOMAIN_EVENT_ID_DEVICE_ADDED
+ case VIR_DOMAIN_EVENT_ID_DEVICE_ADDED:
+ cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventDeviceAddedCallback);
+ break;
+#endif /* VIR_DOMAIN_EVENT_ID_DEVICE_ADDED */
case VIR_DOMAIN_EVENT_ID_LAST:
break;
}
--
2.0.5
9 years, 7 months
[libvirt] [PATCH] configure: Check for libxl_utils.h instead of libxlutil.h
by Michal Privoznik
The file provided by xen-devel package (or xen-tools in Gentoo)
does not provide libxlutil.h. In fact the package provides
libxl_utils.h instead which is the one we are looking for anyway.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 38fbbad..0626492 100644
--- a/configure.ac
+++ b/configure.ac
@@ -915,7 +915,7 @@ fi
if test "$with_libxl" = "yes"; then
dnl If building with libxl, use the libxl utility header and lib too
- AC_CHECK_HEADERS([libxlutil.h])
+ AC_CHECK_HEADERS([libxl_utils.h])
LIBXL_LIBS="$LIBXL_LIBS -lxlutil"
AC_DEFINE_UNQUOTED([WITH_LIBXL], 1, [whether libxenlight driver is enabled])
if test "x$LIBXL_FIRMWARE_DIR" != "x"; then
--
2.0.5
9 years, 7 months
[libvirt] [PATCH] Introduce virnetdevtest
by Michal Privoznik
This is yet another test for check of basic functionality of our
NIC state handling code.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/libvirt_private.syms | 1 +
src/util/virnetdev.c | 4 +-
src/util/virnetdev.h | 4 ++
tests/Makefile.am | 15 +++++
tests/virnetdevmock.c | 48 ++++++++++++++
tests/virnetdevtest.c | 94 +++++++++++++++++++++++++++
tests/virnetdevtestdata/eth0-broken/operstate | 1 +
tests/virnetdevtestdata/eth0-broken/speed | 1 +
tests/virnetdevtestdata/eth0/operstate | 1 +
tests/virnetdevtestdata/eth0/speed | 1 +
tests/virnetdevtestdata/lo/operstate | 1 +
tests/virnetdevtestdata/lo/speed | 1 +
12 files changed, 170 insertions(+), 2 deletions(-)
create mode 100644 tests/virnetdevmock.c
create mode 100644 tests/virnetdevtest.c
create mode 100644 tests/virnetdevtestdata/eth0-broken/operstate
create mode 100644 tests/virnetdevtestdata/eth0-broken/speed
create mode 100644 tests/virnetdevtestdata/eth0/operstate
create mode 100644 tests/virnetdevtestdata/eth0/speed
create mode 100644 tests/virnetdevtestdata/lo/operstate
create mode 100644 tests/virnetdevtestdata/lo/speed
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 9f82926..0b42238 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1741,6 +1741,7 @@ virNetDevSetPromiscuous;
virNetDevSetRcvAllMulti;
virNetDevSetRcvMulti;
virNetDevSetupControl;
+virNetDevSysfsFile;
virNetDevValidateConfig;
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 54d866e..a2d55a8 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -1519,9 +1519,9 @@ int virNetDevValidateConfig(const char *ifname ATTRIBUTE_UNUSED,
#ifdef __linux__
# define NET_SYSFS "/sys/class/net/"
-static int
+int
virNetDevSysfsFile(char **pf_sysfs_device_link, const char *ifname,
- const char *file)
+ const char *file)
{
if (virAsprintf(pf_sysfs_device_link, NET_SYSFS "%s/%s", ifname, file) < 0)
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
index 856127b..999a89a 100644
--- a/src/util/virnetdev.h
+++ b/src/util/virnetdev.h
@@ -219,4 +219,8 @@ int virNetDevSetRcvAllMulti(const char *ifname, bool receive)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
int virNetDevGetRcvAllMulti(const char *ifname, bool *receive)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+int virNetDevSysfsFile(char **pf_sysfs_device_link,
+ const char *ifname,
+ const char *file)
+ ATTRIBUTE_NONNULL(1);
#endif /* __VIR_NETDEV_H__ */
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 046cd08..9ebedc3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -176,6 +176,7 @@ test_programs = virshtest sockettest \
domainconftest \
virhostdevtest \
vircaps2xmltest \
+ virnetdevtest \
$(NULL)
if WITH_REMOTE
@@ -402,6 +403,7 @@ test_libraries = libshunload.la \
virnetserverclientmock.la \
vircgroupmock.la \
virpcimock.la \
+ virnetdevmock.la \
$(NULL)
if WITH_QEMU
test_libraries += libqemumonitortestutils.la \
@@ -1029,6 +1031,19 @@ virpcimock_la_LIBADD = $(GNULIB_LIBS) \
virpcimock_la_LDFLAGS = -module -avoid-version \
-rpath /evil/libtool/hack/to/force/shared/lib/creation
+virnetdevtest_SOURCES = \
+ virnetdevtest.c testutils.h testutils.c
+virnetdevtest_CFLAGS = $(AM_CFLAGS) $(LIBNL_CFLAGS)
+virnetdevtest_LDADD = $(LDADDS)
+
+virnetdevmock_la_SOURCES = \
+ virnetdevmock.c
+virnetdevmock_la_CFLAGS = $(AM_CFLAGS) $(LIBNL_CFLAGS)
+virnetdevmock_la_LIBADD = $(GNULIB_LIBS) \
+ ../src/libvirt.la
+virnetdevmock_la_LDFLAGS = -module -avoid-version \
+ -rpath /evil/libtool/hack/to/force/shared/lib/creation
+
if WITH_LINUX
virusbtest_SOURCES = \
virusbtest.c testutils.h testutils.c
diff --git a/tests/virnetdevmock.c b/tests/virnetdevmock.c
new file mode 100644
index 0000000..681e5fe
--- /dev/null
+++ b/tests/virnetdevmock.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Michal Privoznik <mprivozn(a)redhat.com>
+ */
+
+#include <config.h>
+
+#ifdef __linux__
+# include "internal.h"
+# include <stdlib.h>
+# include <stdio.h>
+# include "virstring.h"
+# include "virnetdev.h"
+
+# define NET_DEV_TEST_DATA_PREFIX abs_srcdir "/virnetdevtestdata"
+
+int
+virNetDevSysfsFile(char **pf_sysfs_device_link,
+ const char *ifname,
+ const char *file)
+{
+
+ if (virAsprintfQuiet(pf_sysfs_device_link, "%s/%s/%s",
+ NET_DEV_TEST_DATA_PREFIX, ifname, file) < 0) {
+ fprintf(stderr, "Out of memory\n");
+ abort();
+ }
+
+ return 0;
+}
+#else
+/* Nothing to override on non-__linux__ platforms */
+#endif
diff --git a/tests/virnetdevtest.c b/tests/virnetdevtest.c
new file mode 100644
index 0000000..8795bf1
--- /dev/null
+++ b/tests/virnetdevtest.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Michal Privoznik <mprivozn(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include "testutils.h"
+
+#ifdef __linux__
+
+# include "virnetdev.h"
+
+# define VIR_FROM_THIS VIR_FROM_NONE
+
+struct testVirNetDevGetLinkInfoData {
+ const char *ifname; /* ifname to get info on */
+ virInterfaceState state; /* expected state */
+ unsigned int speed; /* expected speed */
+};
+
+static int
+testVirNetDevGetLinkInfo(const void *opaque)
+{
+ int ret = -1;
+ const struct testVirNetDevGetLinkInfoData *data = opaque;
+ virInterfaceLink lnk;
+
+ if (virNetDevGetLinkInfo(data->ifname, &lnk) < 0)
+ goto cleanup;
+
+ if (lnk.state != data->state) {
+ fprintf(stderr,
+ "Fetched link state (%s) doesn't match the expected one (%s)",
+ virInterfaceStateTypeToString(lnk.state),
+ virInterfaceStateTypeToString(data->state));
+ goto cleanup;
+ }
+
+ if (lnk.speed != data->speed) {
+ fprintf(stderr,
+ "Fetched link speed (%u) doesn't match the expected one (%u)",
+ lnk.speed, data->speed);
+ goto cleanup;
+ }
+
+ ret = 0;
+ cleanup:
+ return ret;
+}
+
+static int
+mymain(void)
+{
+ int ret = 0;
+
+# define DO_TEST_LINK(ifname, state, speed) \
+ do { \
+ struct testVirNetDevGetLinkInfoData data = {ifname, state, speed}; \
+ if (virtTestRun("Link info: " # ifname, \
+ testVirNetDevGetLinkInfo, &data) < 0) \
+ ret = -1; \
+ } while (0)
+
+ DO_TEST_LINK("eth0", VIR_INTERFACE_STATE_UP, 1000);
+ DO_TEST_LINK("lo", VIR_INTERFACE_STATE_UNKNOWN, 0);
+ DO_TEST_LINK("eth0-broken", VIR_INTERFACE_STATE_DOWN, 0);
+
+ return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+
+VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virnetdevmock.so")
+#else
+int
+main(void)
+{
+ return EXIT_AM_SKIP;
+}
+#endif
diff --git a/tests/virnetdevtestdata/eth0-broken/operstate b/tests/virnetdevtestdata/eth0-broken/operstate
new file mode 100644
index 0000000..eb0e904
--- /dev/null
+++ b/tests/virnetdevtestdata/eth0-broken/operstate
@@ -0,0 +1 @@
+down
diff --git a/tests/virnetdevtestdata/eth0-broken/speed b/tests/virnetdevtestdata/eth0-broken/speed
new file mode 100644
index 0000000..4f6ff86
--- /dev/null
+++ b/tests/virnetdevtestdata/eth0-broken/speed
@@ -0,0 +1 @@
+4294967295
diff --git a/tests/virnetdevtestdata/eth0/operstate b/tests/virnetdevtestdata/eth0/operstate
new file mode 100644
index 0000000..e31ee94
--- /dev/null
+++ b/tests/virnetdevtestdata/eth0/operstate
@@ -0,0 +1 @@
+up
diff --git a/tests/virnetdevtestdata/eth0/speed b/tests/virnetdevtestdata/eth0/speed
new file mode 100644
index 0000000..83b33d2
--- /dev/null
+++ b/tests/virnetdevtestdata/eth0/speed
@@ -0,0 +1 @@
+1000
diff --git a/tests/virnetdevtestdata/lo/operstate b/tests/virnetdevtestdata/lo/operstate
new file mode 100644
index 0000000..3546645
--- /dev/null
+++ b/tests/virnetdevtestdata/lo/operstate
@@ -0,0 +1 @@
+unknown
diff --git a/tests/virnetdevtestdata/lo/speed b/tests/virnetdevtestdata/lo/speed
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/tests/virnetdevtestdata/lo/speed
@@ -0,0 +1 @@
+0
--
2.0.5
9 years, 7 months
[libvirt] [PATCH v5 0/3] Parallels disk device attach
by Alexander Burluka
This patchset implements disk device attachment and allows
OpenStack to attach volumes to Parallels-driven instances.
Parallels Cloud Server SDK supports live attachment of disk devices
and virtual interfaces cards.
Alexander Burluka (3):
Parallels: remove disk serial number check
Parallels: implement domainAttachDeviceFlags
Parallels: implemented domainAttachDevice
9 years, 7 months
[libvirt] [PATCHv1 00/13] Support qcow2 features in external snapshots
by Ján Tomko
https://bugzilla.redhat.com/show_bug.cgi?id=980327
First ten patches contain no functional change.
Patches 11 and 12 potentially change the default qcow2 compatibility
level.
The last patch contains the proposed XML.
Ján Tomko (13):
Visually separate snapshot disk subelements
Remove feature formating funcs from pool-specific options
Separate out virStorageFeatureParse
Separate virStorageFeatureFormat
Split out storage format 'compat' attribute sanity check
Use XPath when parsing snapshot disk definition
Rename virStorageBackendCreateQemuImgCmd
Introduce struct _virStorageBackendQemuImgInfo
Split out qemu-img command generation
Remove overengineered loop
Use qemu-img to precreate the qcow2 disks
Rework qemu-img command generation for inactive external snapshots
Add qcow2 features to snapshot XML
docs/formatsnapshot.html.in | 50 ++-
docs/schemas/domainsnapshot.rng | 10 +-
po/POTFILES.in | 1 +
src/Makefile.am | 5 +
src/conf/snapshot_conf.c | 58 ++--
src/conf/storage_conf.c | 83 +----
src/conf/storage_feature_conf.c | 87 +++++
src/conf/storage_feature_conf.h | 25 ++
src/qemu/qemu_driver.c | 57 ++--
src/storage/storage_backend.c | 376 +++++++++++++--------
src/storage/storage_backend.h | 19 +-
src/storage/storage_driver.c | 27 ++
src/storage/storage_driver.h | 4 +
src/util/virstoragefile.c | 29 ++
src/util/virstoragefile.h | 1 +
.../disk_snapshot_features.xml | 30 ++
.../disk_snapshot_features.xml | 30 ++
tests/domainsnapshotxml2xmltest.c | 2 +
tests/storagevolxml2argvtest.c | 5 +-
19 files changed, 589 insertions(+), 310 deletions(-)
create mode 100644 src/conf/storage_feature_conf.c
create mode 100644 src/conf/storage_feature_conf.h
create mode 100644 tests/domainsnapshotxml2xmlin/disk_snapshot_features.xml
create mode 100644 tests/domainsnapshotxml2xmlout/disk_snapshot_features.xml
--
2.0.5
9 years, 7 months