[libvirt] [PATCHv2] nodedev: Fix gfeature size to be according to running kernel
by Moshe Levi
This patch add virNetDevGetGFeaturesSize to get the supported
gfeature size from the kernel
---
src/util/virnetdev.c | 79 ++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 71 insertions(+), 8 deletions(-)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 2f3690e..582efda 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -90,7 +90,8 @@ VIR_LOG_INIT("util.netdev");
#define RESOURCE_FILE_LEN 4096
#if HAVE_DECL_ETHTOOL_GFEATURES
# define TX_UDP_TNL 25
-# define GFEATURES_SIZE 2
+# define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+# define FEATURE_BITS_TO_BLOCKS(n_bits) DIV_ROUND_UP(n_bits, 32U)
# define FEATURE_WORD(blocks, index, field) ((blocks)[(index) / 32U].field)
# define FEATURE_FIELD_FLAG(index) (1U << (index) % 32U)
# define FEATURE_BIT_IS_SET(blocks, index, field) \
@@ -3110,6 +3111,59 @@ virNetDevGFeatureAvailable(const char *ifname, struct ethtool_gfeatures *cmd)
ret = FEATURE_BIT_IS_SET(cmd->features, TX_UDP_TNL, active);
return ret;
}
+
+
+/**
+ * virNetDevGetGFeaturesSize
+ * This function return the number of gfeatures supported in
+ * the kernel
+ *
+ * @ifname: name of the interface
+ *
+ * Returns gfeature size on success, 0 not supported and -1 on failure.
+ */
+static int
+ virNetDevGetGFeaturesSize(const char *ifname)
+{
+ struct {
+ struct ethtool_sset_info hdr;
+ uint32_t buf[1];
+ } sset_info;
+ struct ethtool_gstrings *strings;
+ uint32_t size = 0;
+ int ret = -1;
+
+ sset_info.hdr.cmd = ETHTOOL_GSSET_INFO;
+ sset_info.hdr.reserved = 0;
+ sset_info.hdr.sset_mask = 1ULL << ETH_SS_FEATURES;
+
+ if (virNetDevSendEthtoolIoctl(ifname, &sset_info) == -1)
+ return ret;
+ size = sset_info.hdr.sset_mask ? sset_info.hdr.data[0] : 0;
+ if (VIR_ALLOC_VAR(strings, struct ethtool_gstrings, sizeof(*strings) + size * ETH_GSTRING_LEN))
+ return ret;
+
+ strings->cmd = ETHTOOL_GSTRINGS;
+ strings->string_set = ETH_SS_FEATURES;
+ strings->len = size;
+ if (size != 0 && virNetDevSendEthtoolIoctl(ifname, strings) == -1) {
+ if (errno == EOPNOTSUPP || errno == EINVAL || errno == EPERM) {
+ ret = 0;
+ size = 0;
+ }
+ goto cleanup;
+ }
+
+ ret = 0;
+ size = FEATURE_BITS_TO_BLOCKS(size);
+
+ cleanup:
+ VIR_FREE(strings);
+ if (ret != -1)
+ ret = size;
+ return ret;
+}
+
# endif
@@ -3131,6 +3185,7 @@ virNetDevGetFeatures(const char *ifname,
struct ethtool_value cmd = { 0 };
# if HAVE_DECL_ETHTOOL_GFEATURES
struct ethtool_gfeatures *g_cmd;
+ uint32_t size = 0;
# endif
struct elem{
const int cmd;
@@ -3188,14 +3243,22 @@ virNetDevGetFeatures(const char *ifname,
# endif
# if HAVE_DECL_ETHTOOL_GFEATURES
- if (VIR_ALLOC_VAR(g_cmd,
- struct ethtool_get_features_block, GFEATURES_SIZE) < 0)
+ size = virNetDevGetGFeaturesSize(ifname);
+ if (size == -1) {
+ VIR_DEBUG("Failure to get GFeatures size on ifname %s", ifname);
return -1;
- g_cmd->cmd = ETHTOOL_GFEATURES;
- g_cmd->size = GFEATURES_SIZE;
- if (virNetDevGFeatureAvailable(ifname, g_cmd))
- ignore_value(virBitmapSetBit(*out, VIR_NET_DEV_FEAT_TXUDPTNL));
- VIR_FREE(g_cmd);
+ } else if (size == 0) {
+ VIR_DEBUG("GFeatures unsupported on ifname %s", ifname);
+ } else {
+ if (VIR_ALLOC_VAR(g_cmd,
+ struct ethtool_get_features_block, size) < 0)
+ return -1;
+ g_cmd->cmd = ETHTOOL_GFEATURES;
+ g_cmd->size = size;
+ if (virNetDevGFeatureAvailable(ifname, g_cmd))
+ ignore_value(virBitmapSetBit(*out, VIR_NET_DEV_FEAT_TXUDPTNL));
+ VIR_FREE(g_cmd);
+ }
# endif
if (virNetDevRDMAFeature(ifname, out) < 0)
--
1.7.1
9 years, 3 months
[libvirt] Entering freeze for libvirt-1.2.17
by Daniel Veillard
Following discussions on Friday, I applied the patches to deactivate
the subset of Admin APIs and revert from 1.3.0 to 1.2.17. I then tagged
in git and pushed signed tarballs and rpms to the usual place:
ftp://libvirt.org/pub/libvirt/
I didn't run my usual tests on that one, my infra is in flux,
so even more reasons for people to give it a try :-)
I'm likely to make a candidate release 2 on Tuesday and if all goes
well we can push 1.2.17 on Thursday,
thanks,
Daniel
--
Daniel Veillard | Open Source and Standards, Red Hat
veillard(a)redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
9 years, 3 months
[libvirt] [PATCH 1/2] Check if qemu-bridge-helper exists and is executable
by Guido Günther
Otherwise the error is just
error: Failed to create domain from test1.xml
error: failed to retrieve file descriptor for interface: Transport endpoint is not connected
since we don't get a sensible error after the fork.
---
src/qemu/qemu_command.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5a92ad4..bddc955 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -295,6 +295,12 @@ static int qemuCreateInBridgePortWithHelper(virQEMUDriverConfigPtr cfg,
return -1;
}
+ if (!virFileIsExecutable(cfg->bridgeHelperName)) {
+ virReportSystemError(errno, _("'%s' not a suitable bridge helper"),
+ cfg->bridgeHelperName);
+ return -1;
+ }
+
cmd = virCommandNew(cfg->bridgeHelperName);
if (flags & VIR_NETDEV_TAP_CREATE_VNET_HDR)
virCommandAddArgFormat(cmd, "--use-vnet");
--
2.1.4
9 years, 3 months
[libvirt] [PATCH v3 0/4] qemu: Return true pinning info
by Martin Kletzander
v3:
- Added test for the hint keeping patch
- Fixed pre-existing crasher found thanks to the test (PATCH 1/4)
- Fixed problem in the parsing function found by the test added:
- Use nnumaCel_max instead of nnumaCells
- Fill in nnumaCell_max in test capabilities
v2:
- Added more info to commit message of patch 2/3
- Changed the commit subject of patch 3/3
Martin Kletzander (4):
qemu: Fix segfault when parsing private domain data
conf: Pass private data to Parse function of XML options
qemu: Keep numad hint after reboot
qemu: Use numad information when getting pin information
src/conf/domain_conf.c | 2 +-
src/conf/domain_conf.h | 17 +++++++++--------
src/libxl/libxl_domain.c | 3 ++-
src/lxc/lxc_domain.c | 3 ++-
src/qemu/qemu_domain.c | 36 ++++++++++++++++++++++++++++++++++--
src/qemu/qemu_driver.c | 11 +++++++++++
tests/qemuxml2xmltest.c | 3 ++-
tests/testutilsqemu.c | 2 ++
8 files changed, 63 insertions(+), 14 deletions(-)
--
2.5.0
9 years, 3 months
[libvirt] [PATCH v2 0/3] qemu: Return true pinning info
by Martin Kletzander
First two patches just prepare the ground for the third one that
explains what needs to be fixed and ho it's done.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1162947
v2:
- Added more info to commit message of patch 2/3
- Changed the commit subject of patch 3/3
Martin Kletzander (3):
conf: Pass private data to Parse function of XML options
qemu: Keep numad hint after reboot
qemu: Use numad information when getting pin information
src/conf/domain_conf.c | 2 +-
src/conf/domain_conf.h | 17 +++++++++--------
src/libxl/libxl_domain.c | 3 ++-
src/lxc/lxc_domain.c | 3 ++-
src/qemu/qemu_domain.c | 33 ++++++++++++++++++++++++++++++++-
src/qemu/qemu_driver.c | 11 +++++++++++
6 files changed, 57 insertions(+), 12 deletions(-)
--
2.5.0
9 years, 3 months
[libvirt] [PATCH] conf: Remove 'vmdef' from virDomainHostdevDefParseXML
by John Ferlan
Since it's not used, let's remove it to avoid any future usage.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/conf/domain_conf.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b743bdd..f66fccd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12054,8 +12054,7 @@ virDomainVideoDefParseXML(xmlNodePtr node,
}
static virDomainHostdevDefPtr
-virDomainHostdevDefParseXML(const virDomainDef *vmdef ATTRIBUTE_UNUSED,
- xmlNodePtr node,
+virDomainHostdevDefParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt,
virHashTablePtr bootHash,
unsigned int flags)
@@ -12122,7 +12121,6 @@ virDomainHostdevDefParseXML(const virDomainDef *vmdef ATTRIBUTE_UNUSED,
"address type"));
goto error;
}
-
if (virXPathBoolean("boolean(./readonly)", ctxt))
def->readonly = true;
if (virXPathBoolean("boolean(./shareable)", ctxt))
@@ -12626,7 +12624,7 @@ virDomainDeviceDefParse(const char *xmlStr,
goto error;
break;
case VIR_DOMAIN_DEVICE_HOSTDEV:
- if (!(dev->data.hostdev = virDomainHostdevDefParseXML(def, node, ctxt,
+ if (!(dev->data.hostdev = virDomainHostdevDefParseXML(node, ctxt,
NULL, flags)))
goto error;
break;
@@ -16152,8 +16150,7 @@ virDomainDefParseXML(xmlDocPtr xml,
for (i = 0; i < n; i++) {
virDomainHostdevDefPtr hostdev;
- hostdev = virDomainHostdevDefParseXML(def, nodes[i], ctxt,
- bootHash, flags);
+ hostdev = virDomainHostdevDefParseXML(nodes[i], ctxt, bootHash, flags);
if (!hostdev)
goto error;
--
2.1.0
9 years, 3 months
[libvirt] [PATCH v2 00/12] Adjust SCSI generated device address checks
by John Ferlan
v1 here:
http://www.redhat.com/archives/libvir-list/2015-June/msg01104.html
Some followups into July resulted in the request to move the Hostdev
and Disk default (or _NONE) address creation/assignment into domain/
device post processing rather than during XML parsing.
Changes in v2 are numerous, quite a bit of patch and code motion in order
to accomplish the requested task in small enough and reviewable chunks
John Ferlan (12):
conf: Remove extraneous check in virDomainHostdevAssignAddress
conf: Add 'bus' and 'target' to SCSI address conflict checks
conf: Move hostdev and disk address validations
conf: Add xmlopt to virDomainDeviceDefPostParseInternal
conf: Add check for host address type while checking in use
conf: Try controller add when searching hostdev bus for unit
conf: Change when virDomainHostdevAssignAddress is called
conf: Remove unused param from virDomainHostdevDefParseXML
conf: Add SCSI hostdev check for disk drive address already in use
conf: Change when virDomainDiskDefAssignAddress is called
conf: Create locals for virDomainDiskDefAssignAddress
conf: Check for hostdev conflicts when assign default disk address
docs/formatdomain.html.in | 4 +-
src/conf/domain_conf.c | 396 +++++++++++++++++++++++++++-------------------
src/conf/domain_conf.h | 3 +-
src/qemu/qemu_command.c | 4 +-
src/vmx/vmx.c | 22 +--
src/vmx/vmx.h | 3 +-
6 files changed, 253 insertions(+), 179 deletions(-)
--
2.1.0
9 years, 3 months
[libvirt] [PATCH] Drive hot-unplug: reliable parsing of HMP results
by Frank Schreuder
Hot-unplugging a disk from a guest that supports hot-unplugging generates an error
in the libvirt log when running QEMU with the "-msg timestamp=on" flag.
2015-08-06 10:48:59.945+0000: 11662: error : qemuMonitorTextDriveDel:2594 :
operation failed: deleting drive-virtio-disk4 drive failed:
2015-08-06T10:48:59.945058Z Device 'drive-virtio-disk4' not found
This error is caused because the HMP results are getting prefixed with a timestamp.
Parsing the output is not reliable with STRPREFIX as the results can be prefixed with a timestamp.
Using strstr ensures that parsing the output works whether the results are prefixed or not.
Cc: Stefan Hajnoczi <stefanha(a)redhat.com>
Cc: Daniel P. Berrange <berrange(a)redhat.com>
Signed-off-by: Frank Schreuder <fschreuder(a)transip.nl>
---
src/qemu/qemu_monitor_text.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 2aa0460..d5ef089 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -2586,7 +2586,7 @@ int qemuMonitorTextDriveDel(qemuMonitorPtr mon,
/* (qemu) drive_del wark
* Device 'wark' not found */
- } else if (STRPREFIX(reply, "Device '") && (strstr(reply, "not found"))) {
+ } else if (strstr(reply, "Device '") && strstr(reply, "not found")) {
/* NB: device not found errors mean the drive was auto-deleted and we
* ignore the error */
} else if (STRNEQ(reply, "")) {
--
2.4.5
9 years, 3 months
[libvirt] [RFC] libvirt-admin: Mark symbols as local
by Guido Günther
Otherwise we're leaking some 30+ symbols like
virAdmConnectClass
virAdmConnectNew
virConnectClass
virConnectCloseCallbackDataClass
virDomainClass
...
I marked the one symbol needed by the deamon as
LIBVIRT_ADMIN_PRIVATE_<VERSION> for now.
---
There's likely a better solution for xdr_admin_connect_open_args.
Cheers,
-- Guido
src/libvirt_admin.syms | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/libvirt_admin.syms b/src/libvirt_admin.syms
index d9e3c0b..de4f1b8 100644
--- a/src/libvirt_admin.syms
+++ b/src/libvirt_admin.syms
@@ -16,3 +16,12 @@ LIBVIRT_ADMIN_1.3.0 {
virAdmConnectClose;
virAdmConnectRef;
};
+
+
+LIBVIRT_ADMIN_PRIVATE_1.2.19 {
+ global:
+ xdr_admin_connect_open_args;
+
+ local:
+ *;
+};
--
2.1.4
9 years, 3 months