[libvirt] [PATCH] spec: Enable RBD storage driver in RHEL-7
by Peter Krempa
Use correct package names too as they differ.
---
libvirt.spec.in | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 12bd17c..d85bd4e 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -108,7 +108,7 @@
%define with_storage_iscsi 0%{!?_without_storage_iscsi:%{server_drivers}}
%define with_storage_disk 0%{!?_without_storage_disk:%{server_drivers}}
%define with_storage_mpath 0%{!?_without_storage_mpath:%{server_drivers}}
-%if 0%{?fedora} >= 16
+%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
%define with_storage_rbd 0%{!?_without_storage_rbd:%{server_drivers}}
%else
%define with_storage_rbd 0
@@ -566,7 +566,12 @@ BuildRequires: device-mapper-devel
%endif
%endif
%if %{with_storage_rbd}
+ %if %if 0%{?rhel} >= 7
+BuildRequires: librados2-devel
+BuildRequires: librbd1-devel
+ %else
BuildRequires: ceph-devel
+ %endif
%endif
%if %{with_storage_gluster}
%if 0%{?rhel} >= 6
--
2.2.2
9 years, 8 months
[libvirt] [PATCH] Fix build on mingw
by Ján Tomko
Last commit unconditionally included a linux-specific header.
Do not do that.
---
Pushed as trivial. Forgot to send the mail.
src/util/virnetdev.c | 4 ++++
src/util/virnetdev.h | 1 -
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 36e69a3..971db43 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -47,6 +47,10 @@
# undef HAVE_STRUCT_IFREQ
#endif
+#if defined(SIOCETHTOOL) && defined(HAVE_STRUCT_IFREQ)
+# include <linux/ethtool.h>
+#endif
+
#if HAVE_DECL_LINK_ADDR
# include <sys/sockio.h>
# include <net/if_dl.h>
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
index 643479d..856127b 100644
--- a/src/util/virnetdev.h
+++ b/src/util/virnetdev.h
@@ -32,7 +32,6 @@
# include "virpci.h"
# include "device_conf.h"
-# include <linux/ethtool.h>
# ifdef HAVE_STRUCT_IFREQ
typedef struct ifreq virIfreq;
# else
--
2.0.5
9 years, 8 months
[libvirt] [PATCH v2] qemu: Allow spaces in disk serial
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1195660
There's been a bug report appearing on the qemu-devel list, that
libvirt is unable to pass spaces in disk serial number [1]. Not only
our RNG schema forbids that, the code is not prepared either. However,
with a bit of escaping (if needed) we can allow spaces there.
1: https://lists.gnu.org/archive/html/qemu-devel/2015-02/msg04041.html
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
diff to v1:
- Switch from virBufferEscapeShell to virBufferEscape
docs/schemas/domaincommon.rng | 2 +-
src/qemu/qemu_command.c | 5 ++--
.../qemuxml2argvdata/qemuxml2argv-disk-serial.args | 7 ++++++
.../qemuxml2argvdata/qemuxml2argv-disk-serial.xml | 27 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 5 ++++
5 files changed, 43 insertions(+), 3 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index f41ca43..09bd921 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5067,7 +5067,7 @@
</define>
<define name="diskSerial">
<data type="string">
- <param name="pattern">[A-Za-z0-9_\.\+\-]+</param>
+ <param name="pattern">[A-Za-z0-9_\.\+\- ]+</param>
</data>
</define>
<define name="bridgeMode">
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index fb3d5ab..25b6499 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2633,7 +2633,7 @@ qemuBuildIoEventFdStr(virBufferPtr buf,
}
#define QEMU_SERIAL_PARAM_ACCEPTED_CHARS \
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ "
static int
qemuSafeSerialParamValue(const char *value)
@@ -3616,7 +3616,8 @@ qemuBuildDriveStr(virConnectPtr conn,
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL)) {
if (qemuSafeSerialParamValue(disk->serial) < 0)
goto error;
- virBufferAsprintf(&opt, ",serial=%s", disk->serial);
+ virBufferAddLit(&opt, ",serial=");
+ virBufferEscape(&opt, '\\', " ", "%s", disk->serial);
}
if (disk->cachemode) {
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args
new file mode 100644
index 0000000..794b94b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/libexec/qemu-kvm -S -M pc -cpu qemu32 -m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
+-drive 'file=/dev/HostVG/QEMUGuest1,if=none,\
+id=drive-ide0-0-1,serial=\ \ WD-WMAP9A966149' \
+-device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml
new file mode 100644
index 0000000..0fe75f3
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml
@@ -0,0 +1,27 @@
+<domain type='kvm'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/libexec/qemu-kvm</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <serial> WD-WMAP9A966149</serial>
+ <address type='drive' controller='0' bus='0' target='0' unit='1'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 16f325e..3032d1b 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -904,6 +904,11 @@ mymain(void)
QEMU_CAPS_DEVICE,
QEMU_CAPS_SCSI_BLOCK, QEMU_CAPS_VIRTIO_BLK_SG_IO,
QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI);
+ DO_TEST("disk-serial",
+ QEMU_CAPS_KVM,
+ QEMU_CAPS_DEVICE,
+ QEMU_CAPS_DRIVE,
+ QEMU_CAPS_DRIVE_SERIAL);
DO_TEST("graphics-vnc", QEMU_CAPS_VNC);
DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC);
--
2.0.5
9 years, 8 months
[libvirt] [PATCHv2] SRIOV NIC offload feature discovery
by James Chapman
Adding functionality to libvirt that will allow it
query the ethtool interface for the availability
of certain NIC HW offload features
Here is an example of the feature XML definition:
<device>
<name>net_eth4_90_e2_ba_5e_a5_45</name>
<path>/sys/devices/pci0000:00/0000:00:03.0/0000:08:00.1/net/eth4</path>
<parent>pci_0000_08_00_1</parent>
<capability type='net'>
<interface>eth4</interface>
<address>90:e2:ba:5e:a5:45</address>
<link speed='10000' state='up'/>
<feature name='rx'/>
<feature name='tx'/>
<feature name='sg'/>
<feature name='tso'/>
<feature name='gso'/>
<feature name='gro'/>
<feature name='rxvlan'/>
<feature name='txvlan'/>
<feature name='rxhash'/>
<capability type='80203'/>
</capability>
</device>
---
docs/formatnode.html.in | 18 +++
docs/schemas/nodedev.rng | 14 +++
src/conf/device_conf.h | 6 +
src/conf/node_device_conf.c | 45 ++++++-
src/conf/node_device_conf.h | 2 +
src/libvirt_private.syms | 1 +
src/node_device/node_device_udev.c | 4 +
src/util/virnetdev.c | 143 ++++++++++++++++++++++
src/util/virnetdev.h | 7 ++
tests/nodedevschemadata/net_00_13_02_b9_f9_d3.xml | 9 ++
tests/nodedevschemadata/net_00_15_58_2f_e9_55.xml | 9 ++
11 files changed, 257 insertions(+), 1 deletion(-)
diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in
index b820a34..ba9a0f8 100644
--- a/docs/formatnode.html.in
+++ b/docs/formatnode.html.in
@@ -183,6 +183,24 @@
link. So far, the whole element is just for output,
not setting.
</dd>
+ <dt><code>feature</code></dt>
+ <dd>If present, the hw offloads supported by this network
+ interface. Possible features are:
+ <dl>
+ <dt><code>rx</code></dt><dd>rx-checksumming</dd>
+ <dt><code>tx</code></dt><dd>tx-checksumming</dd>
+ <dt><code>sg</code></dt><dd>scatter-gather</dd>
+ <dt><code>tso</code></dt><dd>tcp-segmentation-offload</dd>
+ <dt><code>ufo</code></dt><dd>udp-fragmentation-offload</dd>
+ <dt><code>gso</code></dt><dd>generic-segmentation-offload</dd>
+ <dt><code>gro</code></dt><dd>generic-receive-offload</dd>
+ <dt><code>lro</code></dt><dd>large-receive-offload</dd>
+ <dt><code>rxvlan</code></dt><dd>rx-vlan-offload</dd>
+ <dt><code>txvlan</code></dt><dd>tx-vlan-offload</dd>
+ <dt><code>ntuple</code></dt><dd>ntuple-filters</dd>
+ <dt><code>rxhash</code></dt><dd>receive-hashing</dd>
+ </dl>
+ </dd>
<dt><code>capability</code></dt>
<dd>A network protocol exposed by the device, where the
attribute <code>type</code> can be "80203" for IEEE
diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng
index 13c5402..744dccd 100644
--- a/docs/schemas/nodedev.rng
+++ b/docs/schemas/nodedev.rng
@@ -275,10 +275,24 @@
<ref name="link-speed-state"/>
<zeroOrMore>
+ <element name='feature'>
+ <attribute name='name'>
+ <ref name='netfeaturename'/>
+ </attribute>
+ </element>
+ </zeroOrMore>
+
+ <zeroOrMore>
<ref name='subcapnet'/>
</zeroOrMore>
</define>
+ <define name='netfeaturename'>
+ <data type='string'>
+ <param name='pattern'>[a-zA-Z\-_]+</param>
+ </data>
+ </define>
+
<define name='subcapnet'>
<element name='capability'>
<choice>
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index 7256cdc..091f2f0 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -62,6 +62,12 @@ struct _virInterfaceLink {
unsigned int speed; /* link speed in Mbits per second */
};
+typedef struct _virDevFeature virDevFeature;
+typedef virDevFeature *virDevFeaturePtr;
+struct _virDevFeature {
+ char *name; /* device feature */
+};
+
int virDevicePCIAddressIsValid(virDevicePCIAddressPtr addr);
int virDevicePCIAddressParseXML(xmlNodePtr node,
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index a728a00..76b53f0 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -437,6 +437,12 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDef *def)
virBufferEscapeString(&buf, "<address>%s</address>\n",
data->net.address);
virInterfaceLinkFormat(&buf, &data->net.lnk);
+ if (data->net.features) {
+ for (i = 0; i < data->net.nfeatures; i++) {
+ virBufferAsprintf(&buf, "<feature name='%s'/>\n",
+ data->net.features[i].name);
+ }
+ }
if (data->net.subtype != VIR_NODE_DEV_CAP_NET_LAST) {
const char *subtyp =
virNodeDevNetCapTypeToString(data->net.subtype);
@@ -927,8 +933,10 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt,
union _virNodeDevCapData *data)
{
xmlNodePtr orignode, lnk;
- int ret = -1;
+ size_t i = -1;
+ int ret = -1, n = -1;
char *tmp;
+ xmlNodePtr *nodes = NULL;
orignode = ctxt->node;
ctxt->node = node;
@@ -943,6 +951,38 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt,
data->net.address = virXPathString("string(./address[1])", ctxt);
+ if ((n = virXPathNodeSet("./feature", ctxt, &nodes)) < 0)
+ goto out;
+
+ if (n > 0) {
+ if (VIR_RESIZE_N(data->net.features, data->net.nfeatures, data->net.nfeatures, n) < 0)
+ goto out;
+ data->net.nfeatures = n;
+ }
+
+ for (i = 0; i < n; i++) {
+ char *name;
+ size_t j;
+
+ if (!(name = virXMLPropString(nodes[i], "name")) || *name == 0) {
+ VIR_FREE(name);
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Invalid NIC offload feature name"));
+ goto out;
+ }
+ data->net.features[i].name = name;
+
+ for (j = 0; j < i; j++) {
+ if (STREQ(name, data->net.features[j].name)) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("NIC offload feature '%s' specified more than once"),
+ name);
+ VIR_FREE(name);
+ goto out;
+ }
+ }
+ }
+
data->net.subtype = VIR_NODE_DEV_CAP_NET_LAST;
tmp = virXPathString("string(./capability/@type)", ctxt);
@@ -1679,6 +1719,9 @@ void virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
case VIR_NODE_DEV_CAP_NET:
VIR_FREE(data->net.ifname);
VIR_FREE(data->net.address);
+ for (i = 0; i < data->net.nfeatures; i++)
+ VIR_FREE(data->net.features[i].name);
+ VIR_FREE(data->net.features);
break;
case VIR_NODE_DEV_CAP_SCSI_HOST:
VIR_FREE(data->scsi_host.wwnn);
diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index fd5d179..918523a 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -141,6 +141,8 @@ struct _virNodeDevCapsDef {
char *ifname;
virInterfaceLink lnk;
virNodeDevNetCapType subtype; /* LAST -> no subtype */
+ size_t nfeatures;
+ virDevFeaturePtr features;
} net;
struct {
unsigned int host;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index c156b40..aa86560 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1668,6 +1668,7 @@ virNetDevAddRoute;
virNetDevClearIPAddress;
virNetDevDelMulti;
virNetDevExists;
+virNetDevGetFeatures;
virNetDevGetIndex;
virNetDevGetIPv4Address;
virNetDevGetLinkInfo;
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 03c7a0b..349733f 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -719,6 +719,10 @@ static int udevProcessNetworkInterface(struct udev_device *device,
if (virNetDevGetLinkInfo(data->net.ifname, &data->net.lnk) < 0)
goto out;
+ if (virNetDevGetFeatures(data->net.ifname, &data->net.features,
+ &data->net.nfeatures) < 0)
+ goto out;
+
ret = 0;
out:
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 2a0eb43..ab347c5 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -2728,3 +2728,146 @@ int virNetDevGetRxFilter(const char *ifname,
*filter = fil;
return ret;
}
+
+#if defined(SIOCETHTOOL) && defined(HAVE_STRUCT_IFREQ)
+
+/**
+ * virNetDevFeatureAvailable
+ * This function checks for the availability of a network device feature
+ *
+ * @ifname: name of the interface
+ * @cmd: reference to an ethtool command structure
+ *
+ * Returns 0 on success, -1 on failure.
+ */
+static int
+virNetDevFeatureAvailable(const char *ifname, struct ethtool_value *cmd)
+{
+ int ret = -1;
+ int sock = -1;
+ virIfreq ifr;
+
+ sock = socket(AF_LOCAL, SOCK_DGRAM, 0);
+ if (sock < 0) {
+ virReportSystemError(errno, "%s", _("Cannot open control socket"));
+ goto cleanup;
+ }
+
+ strcpy(ifr.ifr_name, ifname);
+ ifr.ifr_data = (void*) cmd;
+
+ if (ioctl(sock, SIOCETHTOOL, &ifr) != 0) {
+ switch (errno) {
+ case EPERM:
+ VIR_DEBUG(("virNetDevFeatureAvailable ioctl: permission denied"));
+ break;
+ case EINVAL:
+ VIR_DEBUG(("virNetDevFeatureAvailable ioctl: invalid request"));
+ break;
+ case EOPNOTSUPP:
+ VIR_DEBUG(("virNetDevFeatureAvailable ioctl: request not supported"));
+ break;
+ default:
+ virReportSystemError(errno, "%s", _("virNetDevFeatureAvailable ioctl error"));
+ goto cleanup;
+ }
+ }
+
+ ret = cmd->data > 0 ? 1: 0;
+ cleanup:
+ if (sock)
+ VIR_FORCE_CLOSE(sock);
+
+ return ret;
+}
+
+
+/**
+ * virNetDevGetFeatures:
+ * This function gets the nic offloads features available for ifname
+ *
+ * @ifname: name of the interface
+ * @features: network device feature structures
+ * @nfeatures: number of features available
+ *
+ * Returns 0 on success, -1 on failure.
+ */
+int
+virNetDevGetFeatures(const char *ifname,
+ virDevFeaturePtr *features,
+ size_t *nfeatures)
+{
+ int ret = -1;
+ size_t i = -1;
+ size_t j = -1;
+ struct ethtool_value cmd;
+ virDevFeaturePtr tmpfeature = NULL;
+
+ struct elem{
+ const char *name;
+ const int cmd;
+ };
+ /* legacy ethtool getters */
+ struct elem cmds[] = {
+ {"rx", ETHTOOL_GRXCSUM},
+ {"tx", ETHTOOL_GTXCSUM },
+ {"sg", ETHTOOL_GSG},
+ {"tso", ETHTOOL_GTSO},
+ {"gso", ETHTOOL_GGSO},
+ {"gro", ETHTOOL_GGRO},
+ };
+ /* ethtool masks */
+ struct elem flags[] = {
+ {"lro", ETH_FLAG_LRO},
+ {"rxvlan", ETH_FLAG_RXVLAN},
+ {"txvlan", ETH_FLAG_TXVLAN},
+ {"ntuple", ETH_FLAG_NTUPLE},
+ {"rxhash", ETH_FLAG_RXHASH},
+ };
+
+ for (i = 0; i < ARRAY_CARDINALITY(cmds); i++) {
+ cmd.cmd = cmds[i].cmd;
+ if (virNetDevFeatureAvailable(ifname, &cmd)) {
+ if (VIR_ALLOC(tmpfeature) < 0)
+ goto cleanup;
+ if ((ret = VIR_STRDUP(tmpfeature->name, cmds[i].name)) != 1)
+ goto cleanup;
+ if (VIR_APPEND_ELEMENT(*features, *nfeatures, *tmpfeature) < 0)
+ goto cleanup;
+ }
+ }
+
+ cmd.cmd = ETHTOOL_GFLAGS;
+ for (j = 0; j < ARRAY_CARDINALITY(flags); j++) {
+ if (virNetDevFeatureAvailable(ifname, &cmd)) {
+ if (cmd.data & (flags[j].cmd)) {
+ if (VIR_ALLOC(tmpfeature) < 0)
+ goto cleanup;
+ if ((ret = VIR_STRDUP(tmpfeature->name, flags[j].name)) != 1)
+ goto cleanup;
+ if (VIR_APPEND_ELEMENT(*features, *nfeatures, *tmpfeature) < 0)
+ goto cleanup;
+ }
+ }
+ }
+
+ ret = 0;
+ cleanup:
+
+ return ret;
+
+}
+#else
+int
+virNetDevGetFeatures(const char *ifname,
+ virDevFeaturePtr *features,
+ size_t *nfeatures)
+{
+ VIR_DEBUG("Getting network device features on %s is not implemented on this platform",
+ ifname);
+ *features = NULL;
+ *nfeatures = 0;
+
+ return 0;
+}
+#endif
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
index de8b480..22ef1a2 100644
--- a/src/util/virnetdev.h
+++ b/src/util/virnetdev.h
@@ -31,6 +31,8 @@
# include "virpci.h"
# include "device_conf.h"
+# include <linux/ethtool.h>
+typedef struct ethtool_cmd virEthCmd;
# ifdef HAVE_STRUCT_IFREQ
typedef struct ifreq virIfreq;
# else
@@ -182,6 +184,11 @@ int virNetDevGetVirtualFunctionInfo(const char *vfname, char **pfname,
int *vf)
ATTRIBUTE_NONNULL(1);
+int virNetDevGetFeatures(const char *ifname,
+ virDevFeaturePtr *features,
+ size_t *nfeatures)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+
int virNetDevGetLinkInfo(const char *ifname,
virInterfaceLinkPtr lnk)
ATTRIBUTE_NONNULL(1);
diff --git a/tests/nodedevschemadata/net_00_13_02_b9_f9_d3.xml b/tests/nodedevschemadata/net_00_13_02_b9_f9_d3.xml
index 970ccca..2a34fed 100644
--- a/tests/nodedevschemadata/net_00_13_02_b9_f9_d3.xml
+++ b/tests/nodedevschemadata/net_00_13_02_b9_f9_d3.xml
@@ -4,6 +4,15 @@
<capability type='net'>
<interface>eth0</interface>
<address>00:13:02:b9:f9:d3</address>
+ <feature name='rx'/>
+ <feature name='tx'/>
+ <feature name='sg'/>
+ <feature name='tso'/>
+ <feature name='gso'/>
+ <feature name='gro'/>
+ <feature name='rxvlan'/>
+ <feature name='txvlan'/>
+ <feature name='rxhash'/>
<capability type='80211'/>
</capability>
</device>
diff --git a/tests/nodedevschemadata/net_00_15_58_2f_e9_55.xml b/tests/nodedevschemadata/net_00_15_58_2f_e9_55.xml
index 741c959..81d398c 100644
--- a/tests/nodedevschemadata/net_00_15_58_2f_e9_55.xml
+++ b/tests/nodedevschemadata/net_00_15_58_2f_e9_55.xml
@@ -4,6 +4,15 @@
<capability type='net'>
<interface>eth1</interface>
<address>00:15:58:2f:e9:55</address>
+ <feature name='rx'/>
+ <feature name='tx'/>
+ <feature name='sg'/>
+ <feature name='tso'/>
+ <feature name='gso'/>
+ <feature name='gro'/>
+ <feature name='rxvlan'/>
+ <feature name='txvlan'/>
+ <feature name='rxhash'/>
<capability type='80203'/>
</capability>
</device>
--
1.9.1
9 years, 8 months
[libvirt] [libvirt-tck][PATCH] Fix disk interface hot plug unplug test scripts
by Zhe Peng
This patch fixed following issues:
1) Hot unplug won't work for a VM without OS. Create a working VM
instead.
2) Avoid using multicast MAC address.
Signed-off-by: Zhe Peng <zpeng(a)redhat.com>
---
scripts/domain/200-disk-hotplug.t | 5 +++--
scripts/domain/205-disk-hotplug-ordering.t | 3 ++-
scripts/domain/210-nic-hotplug.t | 5 +++--
scripts/domain/215-nic-hotplug-many.t | 9 +++++----
4 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/scripts/domain/200-disk-hotplug.t b/scripts/domain/200-disk-hotplug.t
index 4c54b6b..7ed5b27 100644
--- a/scripts/domain/200-disk-hotplug.t
+++ b/scripts/domain/200-disk-hotplug.t
@@ -41,13 +41,14 @@ END {
}
-my $xml = $tck->generic_domain(name => "tck")->as_xml;
+my $xml = $tck->generic_domain(name => "tck", fullos => 1)->as_xml;
diag "Creating a new transient domain";
my $dom;
ok_domain(sub { $dom = $conn->create_domain($xml) }, "created transient domain object");
+sleep(30);
my $path = $tck->create_sparse_disk("200-disk-hotplug", "extra.img", 100);
my $dev = "vdb";
@@ -76,4 +77,4 @@ lives_ok(sub { $dom->detach_device($diskxml); }, "disk has been detached");
my $finalxml = $dom->get_xml_description;
-is($initialxml, $finalxml, "final XML has removed the disk")
+is($finalxml, $initialxml, "final XML has removed the disk")
diff --git a/scripts/domain/205-disk-hotplug-ordering.t b/scripts/domain/205-disk-hotplug-ordering.t
index bc4990f..c9a300c 100644
--- a/scripts/domain/205-disk-hotplug-ordering.t
+++ b/scripts/domain/205-disk-hotplug-ordering.t
@@ -41,12 +41,13 @@ END {
}
-my $xml = $tck->generic_domain(name => "tck")->as_xml;
+my $xml = $tck->generic_domain(name => "tck", fullos => 1)->as_xml;
diag "Creating a new transient domain";
my $dom;
ok_domain(sub { $dom = $conn->create_domain($xml) }, "created transient domain object");
+sleep(30);
my $supported = 1;
foreach my $dev (qw/vdb sdb/) {
my $path = $tck->create_sparse_disk("200-disk-hotplug", "extra-$dev.img", 100);
diff --git a/scripts/domain/210-nic-hotplug.t b/scripts/domain/210-nic-hotplug.t
index ac9048e..4a2763f 100644
--- a/scripts/domain/210-nic-hotplug.t
+++ b/scripts/domain/210-nic-hotplug.t
@@ -41,11 +41,12 @@ END {
}
-my $xml = $tck->generic_domain(name => "tck")->as_xml;
+my $xml = $tck->generic_domain(name => "tck", fullos => 1)->as_xml;
diag "Creating a new transient domain";
my $dom;
ok_domain(sub { $dom = $conn->create_domain($xml) }, "created transient domain object");
+sleep(30);
my $mac = "00:11:22:33:44:55";
my $model = "virtio";
@@ -72,4 +73,4 @@ lives_ok(sub { $dom->detach_device($netxml); }, "interface has been detached");
my $finalxml = $dom->get_xml_description;
-is($initialxml, $finalxml, "final XML has removed the disk")
+is($finalxml, $initialxml, "final XML has removed the interface")
diff --git a/scripts/domain/215-nic-hotplug-many.t b/scripts/domain/215-nic-hotplug-many.t
index 0270054..d4fa23e 100644
--- a/scripts/domain/215-nic-hotplug-many.t
+++ b/scripts/domain/215-nic-hotplug-many.t
@@ -41,15 +41,16 @@ END {
}
-my $xml = $tck->generic_domain(name => "tck")->as_xml;
+my $xml = $tck->generic_domain(name => "tck", fullos => 1)->as_xml;
diag "Creating a new transient domain";
my $dom;
ok_domain(sub { $dom = $conn->create_domain($xml) }, "created transient domain object");
+sleep(30);
-my $mac1 = "01:11:22:33:44:55";
-my $mac2 = "02:11:22:33:44:55";
-my $mac3 = "03:11:22:33:44:55";
+my $mac1 = "02:11:22:33:44:55";
+my $mac2 = "04:11:22:33:44:55";
+my $mac3 = "06:11:22:33:44:55";
my $model = "virtio";
my $netxml1 = <<EOF;
--
1.9.0
9 years, 8 months
[libvirt] [libvirt-tck][PATCH] Add two APIs testing for metadata
by Zhe Peng
$dom->set_metadata
$dom->get_metadata
only have title and destription
element not support in libvirt now
Signed-off-by: Zhe Peng <zpeng(a)redhat.com>
---
scripts/domain/500-metadata.t | 72 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
create mode 100644 scripts/domain/500-metadata.t
diff --git a/scripts/domain/500-metadata.t b/scripts/domain/500-metadata.t
new file mode 100644
index 0000000..11f2f6d
--- /dev/null
+++ b/scripts/domain/500-metadata.t
@@ -0,0 +1,72 @@
+# -*- perl -*-
+#
+# Copyright (C) 2014 Red Hat, Inc.
+# Copyright (C) 2014 Zhe Peng
+#
+# This program is free software; You can redistribute it and/or modify
+# it under the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any
+# later version
+#
+# The file "LICENSE" distributed along with this file provides full
+# details of the terms and conditions
+#
+
+=pod
+
+=head1 NAME
+
+domain/500-metadata.t -- set/get metadata from guest.
+
+=head1 DESCRIPTION
+
+The test case validates that libvirt can set/get guest metadata
+Sys::Virt::Domain::METADATA_TITLE
+Sys::Virt::Domain::METADATA_DESCRIPTION
+not support Sys::Virt::Domain::METADATA_ELEMENT
+
+=cut
+
+use strict;
+use warnings;
+
+use Test::More tests => 8;
+
+use Sys::Virt::TCK;
+use Test::Exception;
+
+my $tck = Sys::Virt::TCK->new();
+my $conn = eval { $tck->setup(); };
+BAIL_OUT "failed to setup test harness: $@" if $@;
+END {
+ $tck->cleanup if $tck;
+}
+
+my $xml = $tck->generic_domain(name => "tck")->as_xml;
+
+diag "Creating a new transient domain";
+my $dom;
+ok_domain(sub { $dom = $conn->create_domain($xml) }, "created transient domain object");
+
+my $title = "libvirt tck testing title";
+my $des = "perl-Sys-Virt description";
+
+lives_ok(sub {$dom->set_metadata(Sys::Virt::Domain::METADATA_TITLE, $title, undef, undef, 0)}, "Set title to $title" );
+lives_ok(sub {$dom->set_metadata(Sys::Virt::Domain::METADATA_DESCRIPTION, $des, undef, undef, 0)}, "Set description to $des" );
+
+my $hasMetadata = $dom->get_xml_description;
+
+ok($hasMetadata =~ m|$title|, "title has added in guest");
+ok($hasMetadata =~ m|$des|, "description has added in guest");
+
+my $mTitle = $dom->get_metadata(Sys::Virt::Domain::METADATA_TITLE,undef,0);
+my $mDes = $dom->get_metadata(Sys::Virt::Domain::METADATA_DESCRIPTION,undef,0);
+
+is($mTitle, $title, "Get title from guest");
+is($mDes, $des, "Get description from guest");
+
+diag "Destroy domain";
+$dom->destroy;
+
+ok_error(sub { $conn->get_domain_by_name("tck") }, "NO_DOMAIN error raised from missing domain", 42);
+
--
1.9.0
9 years, 8 months
[libvirt] [PATCH v1 00/31] Drop network driver lock
by Michal Privoznik
The patchset starts slowly, with small patches, and small
changes, accelerating towards the end, with big changes.
I know that network driver is not used as intensely as domain
drivers, but hey, if we remove 100 lines (and substitute some
others) we get fine grained locking! And cleaner code, of course.
Oh, and this is meant for next release, obviously :)
Michal Privoznik (31):
networkLookupByUUID: Improve error message
bridge_driver: Don't check network active unlocked
testNetworkUpdate: Unlock network at the end
networkGetNetworkAddress: Drop empty 'error' label
virNetworkObjIsDuplicate: s/@doms/@nets/
virNetworkObjListFree: Accept NULL
virNetworkObjListExport: Pass virNetworkObjListPtr
test_driver: s/virNetworkObjList/virNetworkObjListPtr/
parallels: s/virNetworkObjList/virNetworkObjListPtr/
bridge_driver: s/virNetworkObjList/virNetworkObjListPtr/
conf: s/virNetworkFindByUUID/virNetworkObjFindByUUID/
conf: s/virNetworkFindByUUID/virNetworkObjFindByUUID/
network_conf: Introduce virNetworkObjListForEach
network_conf: Introduce virNetworkObjListGetNames
network_conf: Introduce virNetworkObjListNumOfNetworks
bridge_driver: Adapt to new virNetworkObjList accessors
test_driver: Adapt to new virNetworkObjList accessors
parallels_network: Adapt to new virNetworkObjList accessors
network_conf: Turn virNetworkObjList into virObject
network_conf: Turn struct _virNetworkObjList private
network_conf: Make virNetworkObj actually virObject
virNetworkObjList: Derive from virObjectLockableClass
network_conf: Introduce virNetworkObjEndAPI
bridge_driver: Use virNetworkObjEndAPI
test_driver: Use virNetworkObjEndAPI
parallels_network: Use virNetworkObjEndAPI
virNetworkObjListPtr: Make APIs self-locking
virNetworkObjFindBy*: Return an reference to found object
bridge_driver: Drop networkDriverLock() from almost everywhere
test_driver: Drop testDriverLock() from almost everywhere
parallels_network: Drop parallelsDriverLock() from everywhere.
cfg.mk | 3 -
src/conf/network_conf.c | 372 +++++++++++++++++++-------
src/conf/network_conf.h | 51 ++--
src/libvirt_private.syms | 14 +-
src/network/bridge_driver.c | 502 ++++++++++++++---------------------
src/network/bridge_driver_platform.h | 2 +-
src/parallels/parallels_driver.c | 5 +-
src/parallels/parallels_network.c | 144 +++-------
src/parallels/parallels_utils.h | 2 +-
src/test/test_driver.c | 223 ++++------------
tests/networkxml2conftest.c | 4 +-
tests/objectlocking.ml | 2 -
12 files changed, 612 insertions(+), 712 deletions(-)
--
2.0.5
9 years, 8 months
[libvirt] [PATCH v2] qemu: snapshot: remove the redundant 'if' check
by Shanzhi Yu
When the domain's source disk type is network, if source protocol
is rbd or sheepdog, the 'if().. break' will end the current case,
which lead to miss check the driver type is raw or qcow2. Libvirt
will allow to create internal snapshot for a running domain with
raw format disk which based on rbd storage.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1179533
Signed-off-by: Shanzhi Yu <shyu(a)redhat.com>
---
src/qemu/qemu_driver.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e282464..544ed82 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13422,11 +13422,6 @@ qemuDomainSnapshotPrepare(virConnectPtr conn,
active) < 0)
goto cleanup;
- if (dom_disk->src->type == VIR_STORAGE_TYPE_NETWORK &&
- (dom_disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_SHEEPDOG ||
- dom_disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_RBD)) {
- break;
- }
if (vm->def->disks[i]->src->format > 0 &&
vm->def->disks[i]->src->format != VIR_STORAGE_FILE_QCOW2) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
--
2.1.0
9 years, 8 months
[libvirt] [PATCH 0/2] PowerPC : Miscellaneous fixes for 'ppc64le' architecture.
by Prerna Saxena
>From a28ef5a3e7b9cb023948cf97d9f472bb3a1e06d3 Mon Sep 17 00:00:00 2001
From: Prerna Saxena <prerna(a)linux.vnet.ibm.com>
Date: Thu, 26 Feb 2015 22:31:05 +0530
This series adds few miscellaneous fixes for PowerPC 64-bit Little
Endian Architecture.
Changelog :
==========
v1 of Patch 1/2 already posted and acked :
https://www.redhat.com/archives/libvir-list/2015-February/msg00486.html
Patch 2/2 adds a testcase to supplement patch 1.
Prerna Saxena (2):
PowerPC: Augment XML schema to include 'ppc64le' arch and newer
pseries-2.* machine types.
Tests : Add test for 'ppc64le' architecture.
docs/schemas/basictypes.rng | 1 +
docs/schemas/domaincommon.rng | 7 ++++-
.../qemuxml2argv-pseries-cpu-le.args | 7 +++++
.../qemuxml2argv-pseries-cpu-le.xml | 17 ++++++++++++
tests/qemuxml2argvtest.c | 2 ++
tests/testutilsqemu.c | 30 ++++++++++++++++++++++
6 files changed, 63 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-le.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-le.xml
--
1.9.3
--
Prerna Saxena
Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India
9 years, 8 months
[libvirt] [PATCHv3 0/4] Automaticaly fill <memory> element for NUMA enabled guests
by Peter Krempa
While there is still a discussion open upstream on a possible change of naming
here I'm posting this so that comments can be held against this version.
Peter Krempa (4):
conf: Replace access to def->mem.max_balloon with accessor functions
qemu: command: Add helper to align memory sizes
conf: Automatically use NUMA memory size in case NUMA is enabled
conf: Make specifying <memory> optional
docs/schemas/domaincommon.rng | 18 ++---
src/conf/domain_conf.c | 81 +++++++++++++++++++---
src/conf/domain_conf.h | 4 ++
src/hyperv/hyperv_driver.c | 2 +-
src/libvirt_private.syms | 3 +
src/libxl/libxl_conf.c | 2 +-
src/libxl/libxl_driver.c | 8 +--
src/lxc/lxc_cgroup.c | 2 +-
src/lxc/lxc_driver.c | 12 ++--
src/lxc/lxc_fuse.c | 4 +-
src/lxc/lxc_native.c | 4 +-
src/openvz/openvz_driver.c | 2 +-
src/parallels/parallels_driver.c | 2 +-
src/parallels/parallels_sdk.c | 12 ++--
src/phyp/phyp_driver.c | 11 +--
src/qemu/qemu_command.c | 23 +++---
src/qemu/qemu_domain.c | 21 ++++++
src/qemu/qemu_domain.h | 2 +
src/qemu/qemu_driver.c | 21 +++---
src/qemu/qemu_hotplug.c | 8 ++-
src/qemu/qemu_process.c | 2 +-
src/test/test_driver.c | 8 +--
src/uml/uml_driver.c | 8 +--
src/vbox/vbox_common.c | 4 +-
src/vmware/vmware_driver.c | 2 +-
src/vmx/vmx.c | 12 ++--
src/xen/xm_internal.c | 14 ++--
src/xenapi/xenapi_driver.c | 2 +-
src/xenapi/xenapi_utils.c | 4 +-
src/xenconfig/xen_common.c | 8 ++-
src/xenconfig/xen_sxpr.c | 9 +--
.../qemuxml2argv-cpu-numa-no-memory-element.args | 7 ++
.../qemuxml2argv-cpu-numa-no-memory-element.xml | 24 +++++++
.../qemuxml2argv-minimal-no-memory.xml | 25 +++++++
.../qemuxml2argv-numatune-memnode.args | 2 +-
tests/qemuxml2argvtest.c | 2 +
.../qemuxml2xmlout-cpu-numa-no-memory-element.xml | 28 ++++++++
tests/qemuxml2xmltest.c | 1 +
38 files changed, 299 insertions(+), 105 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-no-memory-element.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-no-memory-element.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-minimal-no-memory.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-no-memory-element.xml
--
2.2.2
9 years, 8 months