[libvirt] [PATCH v2 0/2] libxl: implement virDomainInterfaceStats
by Joao Martins
Hey,
This patch series implements virDomainInterfaceStats
but based on "ConsoleCallback" as opposed of doing it in libxlDomainStart.
The series is divided as following: Patch 1 renames console callback to
something more generic and Patch 2 implements virDomainInterfaceStats also
taking the previous review (v3 statistics) comments.
Changes since v1:
- Improve error reporting in case interface is not known
- Use libxl_device_nic_list as opposed to libxl_domain_config
Regards,
Joao
Joao Martins (2):
libxl: rename libxlConsoleCallback
libxl: implement virDomainInterfaceStats
src/libxl/libxl_domain.c | 33 ++++++++++++++++++++++++++++--
src/libxl/libxl_driver.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 83 insertions(+), 2 deletions(-)
--
2.1.4
9 years
[libvirt] [PATCH] network: selectively disable -Wcast-align in virNetDevParseDadStatus
by Ian Campbell
Commit 0f7436ca54c9 "network: wait for DAD to finish for bridge IPv6 addresses"
results in:
CC util/libvirt_util_la-virnetdevmacvlan.lo
util/virnetdev.c: In function 'virNetDevParseDadStatus':
util/virnetdev.c:1319:188: error: cast increases required alignment of target type [-Werror=cast-align]
util/virnetdev.c:1332:41: error: cast increases required alignment of target type [-Werror=cast-align]
util/virnetdev.c:1334:92: error: cast increases required alignment of target type [-Werror=cast-align]
cc1: all warnings being treated as errors
on at least ARM platforms.
The three macros involved (NLMSG_NEXT, IFA_RTA and RTA_NEXT) all appear to
correctly take care of alignment, therefore suppress Wcast-align around their
uses.
Signed-off-by: Ian Campbell <ian.campbell(a)citrix.com>
Cc: Maxim Perevedentsev <mperevedentsev(a)virtuozzo.com>
Cc: Laine Stump <laine(a)laine.org>
Cc: Dario Faggioli <dario.faggioli(a)citrix.com>
Cc: Jim Fehlig <jfehlig(a)suse.com>
---
src/util/virnetdev.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index ade9afa..0bc809e 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -1316,7 +1316,10 @@ virNetDevParseDadStatus(struct nlmsghdr *nlh, int len,
struct rtattr *rtattr_ptr;
size_t i;
struct in6_addr *addr;
+
+ VIR_WARNINGS_NO_CAST_ALIGN
for (; NLMSG_OK(nlh, len); nlh = NLMSG_NEXT(nlh, len)) {
+ VIR_WARNINGS_RESET
if (NLMSG_PAYLOAD(nlh, 0) < sizeof(struct ifaddrmsg)) {
/* Message without payload is the last one. */
break;
@@ -1329,9 +1332,11 @@ virNetDevParseDadStatus(struct nlmsghdr *nlh, int len,
}
ifaddrmsg_len = IFA_PAYLOAD(nlh);
+ VIR_WARNINGS_NO_CAST_ALIGN
rtattr_ptr = (struct rtattr *) IFA_RTA(ifaddrmsg_ptr);
for (; RTA_OK(rtattr_ptr, ifaddrmsg_len);
rtattr_ptr = RTA_NEXT(rtattr_ptr, ifaddrmsg_len)) {
+ VIR_WARNINGS_RESET
if (RTA_PAYLOAD(rtattr_ptr) != sizeof(struct in6_addr)) {
/* No address: ignore. */
continue;
--
2.1.4
9 years
[libvirt] [libvirt-perl][PATCH] Add VIR_FROM_LOGGING constant
by Michal Privoznik
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Virt.xs | 1 +
lib/Sys/Virt/Error.pm | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/Virt.xs b/Virt.xs
index c7cce27..db04fc2 100644
--- a/Virt.xs
+++ b/Virt.xs
@@ -8239,6 +8239,7 @@ BOOT:
REGISTER_CONSTANT(VIR_FROM_POLKIT, FROM_POLKIT);
REGISTER_CONSTANT(VIR_FROM_THREAD, FROM_THREAD);
REGISTER_CONSTANT(VIR_FROM_ADMIN, FROM_ADMIN);
+ REGISTER_CONSTANT(VIR_FROM_LOGGING, FROM_LOGGING);
REGISTER_CONSTANT(VIR_ERR_OK, ERR_OK);
diff --git a/lib/Sys/Virt/Error.pm b/lib/Sys/Virt/Error.pm
index d254daa..c5e1609 100644
--- a/lib/Sys/Virt/Error.pm
+++ b/lib/Sys/Virt/Error.pm
@@ -386,6 +386,10 @@ The thread helper utils
The administrative service
+=item Sys::Virt::Error::FROM_LOGGING
+
+The logging service
+
=back
=head2 ERROR CODE CONSTANTS
--
2.4.10
9 years
[libvirt] [PATCH] fix LSB part of virtlogd runlevel script
by Olaf Hering
Currently pkg build of master branch fails:
[ 300s] + /usr/lib/rpm/brp-boot-scripts
[ 300s] E: File `virtlogd' is missing `Required-Start', please add even if empty!
[ 300s] W: File `virtlogd' is missing `Required-Stop', please add even if empty!
[ 300s] E: File `virtlogd' has empty `Default-Start', please specify default runlevel(s)!
[ 300s] ERROR: found one or more broken init or boot scripts, please fix them.
[ 300s] For more information about LSB headers please read the manual
[ 300s] page of of insserv by executing the command `man 8 insserv'.
[ 300s] If you don't understand this, mailto=werner(a)suse.de
[ 300s] error: Bad exit status from /var/tmp/rpm-tmp.44965 (%install)
Add the required tags, fix the existing tags.
Use soft dependency "Should-Start" because virtlogd may work without network.
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
---
src/logging/virtlogd.init.in | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/logging/virtlogd.init.in b/src/logging/virtlogd.init.in
index 1408236..cc03615 100644
--- a/src/logging/virtlogd.init.in
+++ b/src/logging/virtlogd.init.in
@@ -5,8 +5,12 @@
#
### BEGIN INIT INFO
# Provides: virtlogd
-# Default-Start:
-# Default-Stop: 0 1 2 3 4 5 6
+# Default-Start: 3 5
+# Required-Start:
+# Required-Stop:
+# Should-Start: $network $remote_fs
+# Should-Stop $network $remote_fs:
+# Default-Stop: 0 1 2 4 6
# Short-Description: virtual machine log manager
# Description: This is a daemon for managing logs
# of virtual machine consoles
9 years
[libvirt] [PATCH] qemu: add bootindex option to hostdev network interface commandline
by Laine Stump
when appropriate, of course. If the config for a domain specifies boot
order with <boot dev='blah'/> elements, e.g.:
<os>
...
<boot dev='hd'/>
<boot dev='network'/>
</os>
Then the first disk device in the config will have ",bootindex=1"
appended to its qemu commandline -device options, and the first (and
*only* the first) network interface device will get ",bootindex=2".
However, if the first network interface device is a "hostdev" device
(an SRIOV Virtual Function (VF) being assigned to the domain with
vfio), then the bootindex option will *not* be appended. This happens
because the bootindex=n option corresponding to the order of "<boot
dev='network'/>" is added to the -device for the first network device
when network device commandline args are constructed, but if it's a
hostdev network device, its commandline arg is instead constructed in
the loop for hostdevs.
This patch fixes that omission by noticing (in bootHostdevNet) if the
first network device was a hostdev, and if so passing on the proper
bootindex to the commandline generator for hostdev devices - the
result is that ",bootindex=2" will be properly appended to the first
"network" device in the config even if it is really a hostdev
(including if it is assigned from a libvirt network pool). (note that
this is only the case if there is no <bootmenu enabled='yes'/> element
in the config ("-boot menu-on" in qemu) , since the two are mutually
exclusive - when the bootmenu is enabled, the individual per-device
bootindex options can't be used by qemu, and we revert to using "-boot
order=xyz" instead).
If a greater level of control over boot order is desired (e.g., more
than one network device should be tried, or a network device other
than the first one encountered in the config), then <boot
dev='network'/> in the <os> element should not be used; instead, the
individual device elements in the config should be given a "<boot
order='n'/>
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1278421
---
src/qemu/qemu_command.c | 31 ++++++++++++++++++++++++++++---
src/qemu/qemu_command.h | 1 +
src/qemu/qemu_hotplug.c | 4 ++--
3 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4d00fd9..183ab97 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5978,6 +5978,7 @@ qemuOpenPCIConfig(virDomainHostdevDefPtr dev)
char *
qemuBuildPCIHostdevDevStr(virDomainDefPtr def,
virDomainHostdevDefPtr dev,
+ int bootIndex, /* used iff dev->info->bootIndex == 0 */
const char *configfd,
virQEMUCapsPtr qemuCaps)
{
@@ -6020,7 +6021,9 @@ qemuBuildPCIHostdevDevStr(virDomainDefPtr def,
pcisrc->addr.function);
virBufferAsprintf(&buf, ",id=%s", dev->info->alias);
if (dev->info->bootIndex)
- virBufferAsprintf(&buf, ",bootindex=%d", dev->info->bootIndex);
+ bootIndex = dev->info->bootIndex;
+ if (bootIndex)
+ virBufferAsprintf(&buf, ",bootindex=%d", bootIndex);
if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0)
goto error;
if (qemuBuildRomStr(&buf, dev->info, qemuCaps) < 0)
@@ -9166,7 +9169,8 @@ qemuBuildCommandLine(virConnectPtr conn,
char *boot_order_str = NULL, *boot_opts_str = NULL;
virBuffer fdc_opts = VIR_BUFFER_INITIALIZER;
char *fdc_opts_str = NULL;
- int bootCD = 0, bootFloppy = 0, bootDisk = 0;
+ int bootCD = 0, bootFloppy = 0, bootDisk = 0, bootHostdevNet = 0;
+
VIR_DEBUG("conn=%p driver=%p def=%p mon=%p json=%d "
"qemuCaps=%p migrateURI=%s snapshot=%p vmop=%d",
@@ -10154,6 +10158,16 @@ qemuBuildCommandLine(virConnectPtr conn,
goto error;
last_good_net = i;
+ /* if this interface is a type='hostdev' interface and we
+ * haven't yet added a "bootindex" parameter to an
+ * emulated network device, save the bootindex - hostdev
+ * interface commandlines will be built later on when we
+ * cycle through all the hostdevs, and we'll use it then.
+ */
+ if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_HOSTDEV &&
+ bootHostdevNet == 0) {
+ bootHostdevNet = bootNet;
+ }
bootNet = 0;
}
}
@@ -10871,6 +10885,16 @@ qemuBuildCommandLine(virConnectPtr conn,
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
char *configfd_name = NULL;
+ int bootIndex = hostdev->info->bootIndex;
+
+ /* bootNet will be non-0 if boot order was set and no other
+ * net devices were encountered
+ */
+ if (hostdev->parent.type == VIR_DOMAIN_DEVICE_NET &&
+ bootIndex == 0) {
+ bootIndex = bootHostdevNet;
+ bootHostdevNet = 0;
+ }
if ((backend != VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_CONFIGFD)) {
int configfd = qemuOpenPCIConfig(hostdev);
@@ -10886,7 +10910,8 @@ qemuBuildCommandLine(virConnectPtr conn,
}
}
virCommandAddArg(cmd, "-device");
- devstr = qemuBuildPCIHostdevDevStr(def, hostdev, configfd_name, qemuCaps);
+ devstr = qemuBuildPCIHostdevDevStr(def, hostdev, bootIndex,
+ configfd_name, qemuCaps);
VIR_FREE(configfd_name);
if (!devstr)
goto error;
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index bebdd27..c773b8f 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -180,6 +180,7 @@ char *qemuBuildPCIHostdevPCIDevStr(virDomainHostdevDefPtr dev,
/* Current, best practice */
char *qemuBuildPCIHostdevDevStr(virDomainDefPtr def,
virDomainHostdevDefPtr dev,
+ int bootIndex,
const char *configfd,
virQEMUCapsPtr qemuCaps);
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 8804d3d..872ebcd 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1321,8 +1321,8 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
goto error;
}
- if (!(devstr = qemuBuildPCIHostdevDevStr(vm->def, hostdev, configfd_name,
- priv->qemuCaps)))
+ if (!(devstr = qemuBuildPCIHostdevDevStr(vm->def, hostdev, 0,
+ configfd_name, priv->qemuCaps)))
goto error;
qemuDomainObjEnterMonitor(driver, vm);
--
2.4.3
9 years
[libvirt] [PATCH] log_manager: Include configmake.h last
by Michal Privoznik
The problem is that in some mingw header DATADIR is used but
gnulib defines it too. This leads to the following compile error:
CC locking/libvirt_driver_la-lock_manager.lo
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/objbase.h:66:0,
from /usr/i686-w64-mingw32/sys-root/mingw/include/ole2.h:17,
from /usr/i686-w64-mingw32/sys-root/mingw/include/wtypes.h:12,
from /usr/i686-w64-mingw32/sys-root/mingw/include/winscard.h:10,
from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:97,
from /usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:23,
from ../gnulib/lib/unistd.h:48,
from ../../src/util/virutil.h:29,
from ../../src/logging/log_manager.c:30:
/usr/i686-w64-mingw32/sys-root/mingw/include/objidl.h:12275:2: error: expected identifier or '(' before string constant
} DATADIR;
^
Makefile:7888: recipe for target 'logging/libvirt_driver_la-log_manager.lo' failed
The fix is to include configmake.h at the end of includes.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/logging/log_manager.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/logging/log_manager.c b/src/logging/log_manager.c
index 5ff5f12..7a4c7e2 100644
--- a/src/logging/log_manager.c
+++ b/src/logging/log_manager.c
@@ -22,8 +22,6 @@
#include <config.h>
-#include "configmake.h"
-
#include "log_manager.h"
#include "log_protocol.h"
#include "viralloc.h"
@@ -33,6 +31,7 @@
#include "virfile.h"
#include "rpc/virnetclient.h"
+#include "configmake.h"
#define VIR_FROM_THIS VIR_FROM_LOGGING
--
2.4.10
9 years
[libvirt] [PATCH 0/8] Make loading domains with invalid XML possible
by Martin Kletzander
The RFC version [1] was ACKed, but I have found out that we could then
cause inconsistency by calling virDomainCreateXML() or Restore() calls
etc. This series is basically the same apart from the fact that it is
rebased on current master and then one simple diff [2] is added to
PATCH 5/8.
[1] https://www.redhat.com/archives/libvir-list/2015-September/msg00698.html
[2] diff to the previous version:
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 16f26acf4839..c8291be2b7b5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2875,6 +2875,14 @@ virDomainObjListAddLocked(virDomainObjListPtr doms,
}
}
+ if (vm->def->parseError) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("domain '%s' was not loaded due to an XML error "
+ "(%s), please redefine it"),
+ vm->def->name, vm->def->parseError);
+ virDomainObjEndAPI(&vm);
+ }
+
virDomainObjAssignDef(vm,
def,
!!(flags & VIR_DOMAIN_OBJ_LIST_ADD_LIVE),
--
Martin Kletzander (8):
conf, virsh: Add new domain shutoff reason
qemu: Few whitespace cleanups
conf: Extract name-parsing into its own function
conf: Extract UUID parsing into its own function
conf: Optionally keep domains with invalid XML, but don't allow
starting them
qemu: Don't lookup invalid domains unless specified otherwise
qemu: Prepare basic APIs to handle invalid defs
qemu: Load domains with invalid XML on start
include/libvirt/libvirt-domain.h | 2 +
src/bhyve/bhyve_driver.c | 2 +
src/conf/domain_conf.c | 191 +++++++++++++++++++++++++++++++++------
src/conf/domain_conf.h | 5 +
src/libxl/libxl_driver.c | 3 +
src/lxc/lxc_driver.c | 3 +
src/qemu/qemu_driver.c | 64 ++++++++++---
src/uml/uml_driver.c | 2 +
tools/virsh-domain-monitor.c | 3 +-
9 files changed, 234 insertions(+), 41 deletions(-)
--
2.6.3
9 years
[libvirt] [PATCH RFC] allow to delete sheepdog snapshot
by Vasiliy Tolstov
This is first try to get ability to remove snapshot from sheepdog,
I'm stuck ad the simple thing: sheepdog does not allow to remove
snapshot with objects with message:
ERROR [deletion] delete_vdi_work(1811) vid: XXXXX still has objects
I'm check dog/vdi.c code and see, that in case of deletion vdi sheepdog write
to all objects. Does i realy need to do this thing?
Can somebody helps me?
Also as i see block/sheepdog.c have delete vdi code and it very simple compared
to dog/vdi.c...
So, please help me =)
Vasiliy Tolstov (1):
allow to delete sheepdog snapshot
block/sheepdog.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 57 insertions(+), 2 deletions(-)
--
2.5.0
9 years
[libvirt] [PATCH] tests: Run virnetdaemontest iff WITH_YAJL
by Michal Privoznik
The test itself and daemon require a JSON parsing library. If not
present, skip the test.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tests/virnetdaemontest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c
index 24cbd54..e5d09a3 100644
--- a/tests/virnetdaemontest.c
+++ b/tests/virnetdaemontest.c
@@ -26,7 +26,7 @@
#define VIR_FROM_THIS VIR_FROM_RPC
-#ifdef HAVE_SOCKETPAIR
+#if defined(HAVE_SOCKETPAIR) && defined(WITH_YAJL)
static virNetServerPtr
testCreateServer(const char *host, int family)
{
--
2.4.10
9 years