[libvirt] [PATCH] docs: formatdomain: Specify the default value of 'check' attribute
by Kashyap Chamarthy
The 'check' attribute is referring to this:
<cpu mode='custom' match='exact' check='full'>
Upstream documentation says, it is:
used to request a specific way of checking whether the virtual CPU
matches the specification. It is usually safe to omit this attribute
when starting a domain and stick with the default value.
But doesn't tell *what* the default value is. It is check='partial'.
Mention it so.
Thanks: Jiri Denemark
---
docs/formatdomain.html.in | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index d272cc1ba..8985da836 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1287,10 +1287,11 @@
attribute can be used to request a specific way of checking whether
the virtual CPU matches the specification. It is usually safe to omit
this attribute when starting a domain and stick with the default
- value. Once the domain starts, libvirt will automatically change the
- <code>check</code> attribute to the best supported value to ensure the
- virtual CPU does not change when the domain is migrated to another
- host. The following values can be used:
+ value (<code>partial>/code>). Once the domain starts, libvirt will
+ automatically change the <code>check</code> attribute to the best
+ supported value to ensure the virtual CPU does not change when the
+ domain is migrated to another host. The following values can be
+ used:
<dl>
<dt><code>none</code></dt>
@@ -1303,7 +1304,7 @@
<dt><code>partial</code></dt>
<dd>Libvirt will check the guest CPU specification before starting
a domain, but the rest is left on the hypervisor. It can still
- provide a different virtual CPU.</dd>
+ provide a different virtual CPU. (This is the default.)</dd>
<dt><code>full</code></dt>
<dd>The virtual CPU created by the hypervisor will be checked
--
2.13.6
6 years, 8 months
[libvirt] [PATCH 0/4] Alter Disk Volume logic to use objects
by John Ferlan
This series converts the storage volume forward linked list into
an object that contains hash tables of volume objects.
The first two patches resolve issues seen during testing with
the Disk backend which had some special cased code to handle
the Create/Delete paths and interactions with the partition logic.
The first patch was much more quickly seen with object free logic
in place.
The second two patches make the conversion to objects and hash
tables in "smaller chunks", but they could easily be combined.
John Ferlan (4):
storage: When delete volume avoid disk backend removal
storage: Modify virStorageBackendDiskMakeDataVol logic
storage: Introduce _virStorageVolObj[List]
storage: Complete implementation volume by hash object
src/conf/virstorageobj.c | 540 ++++++++++++++++++++++++++++++-------
src/storage/storage_backend_disk.c | 40 +--
src/storage/storage_driver.c | 14 +-
3 files changed, 471 insertions(+), 123 deletions(-)
--
2.13.6
6 years, 8 months
[libvirt] [PATCH 0/5] Refresh QEMU caps when CPU microcode changes
by Jiri Denemark
Jiri Denemark (1):
cpu_x86: Rename virCPUx86MapInitialize
Paolo Bonzini (4):
util: add virFileReadHeaderQuiet wrapper around virFileReadHeaderFD
util: introduce virHostCPUGetMicrocodeVersion
conf: include x86 microcode version in virsh capabilities
qemu: capabilities: force update if the microcode version does not
match
src/conf/cpu_conf.c | 14 +++++++
src/conf/cpu_conf.h | 1 +
src/cpu/cpu_x86.c | 17 +++++++--
src/libvirt_private.syms | 2 +
src/qemu/qemu_capabilities.c | 40 +++++++++++++++++++-
src/qemu/qemu_capabilities.h | 6 ++-
src/qemu/qemu_capspriv.h | 5 +++
src/qemu/qemu_driver.c | 9 ++++-
src/util/virfile.c | 19 ++++++++++
src/util/virfile.h | 2 +
src/util/virhostcpu.c | 43 ++++++++++++++++++++++
src/util/virhostcpu.h | 2 +
tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml | 1 +
.../caps_2.10.0-gicv2.aarch64.xml | 1 +
.../caps_2.10.0-gicv3.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 1 +
.../caps_2.6.0-gicv2.aarch64.xml | 1 +
.../caps_2.6.0-gicv3.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 +
tests/qemucapabilitiestest.c | 14 +++++--
tests/qemucapsprobe.c | 2 +-
tests/testutilsqemu.c | 2 +-
40 files changed, 189 insertions(+), 14 deletions(-)
--
2.15.1
6 years, 8 months
[libvirt] [PATCH 0/3] cpu_x86: Few small fixes
by Jiri Denemark
I found these issues when working on patches and tests for CVE-2017-5715
part of Spectre.
Jiri Denemark (3):
cputest: Fix cpu-cpuid.py diff command
cpu_x86: Add debug messages to x86DecodeUseCandidate
cpu_x86: Copy CPU signature from ancestor
src/cpu/cpu_x86.c | 26 ++++++++---
tests/cputestdata/cpu-cpuid.py | 52 +++++++++++++++-------
.../x86_64-cpuid-A10-5800K-disabled.xml | 1 -
.../cputestdata/x86_64-cpuid-A10-5800K-enabled.xml | 2 -
.../x86_64-cpuid-Core-i5-2500-enabled.xml | 1 -
.../x86_64-cpuid-Core-i5-2540M-enabled.xml | 1 -
.../x86_64-cpuid-Core-i5-4670T-enabled.xml | 1 -
.../x86_64-cpuid-Core-i5-6600-enabled.xml | 1 -
.../x86_64-cpuid-Core-i7-2600-enabled.xml | 1 -
...x86_64-cpuid-Core-i7-2600-xsaveopt-disabled.xml | 1 -
.../x86_64-cpuid-Core-i7-2600-xsaveopt-enabled.xml | 1 -
.../x86_64-cpuid-Core-i7-3740QM-enabled.xml | 1 -
.../x86_64-cpuid-Core-i7-3770-enabled.xml | 1 -
.../x86_64-cpuid-Core-i7-4510U-enabled.xml | 1 -
.../x86_64-cpuid-Core-i7-4600U-enabled.xml | 1 -
.../x86_64-cpuid-Core-i7-5600U-arat-disabled.xml | 1 +
.../x86_64-cpuid-Core-i7-5600U-arat-enabled.xml | 1 -
.../x86_64-cpuid-Core-i7-5600U-enabled.xml | 1 -
.../x86_64-cpuid-Core-i7-7700-enabled.xml | 1 -
.../x86_64-cpuid-Core2-E6850-enabled.xml | 1 -
.../x86_64-cpuid-EPYC-7601-32-Core-disabled.xml | 1 -
.../x86_64-cpuid-EPYC-7601-32-Core-enabled.xml | 2 -
.../x86_64-cpuid-Opteron-2350-disabled.xml | 1 -
.../x86_64-cpuid-Opteron-2350-enabled.xml | 2 -
.../x86_64-cpuid-Opteron-6234-disabled.xml | 1 -
.../x86_64-cpuid-Opteron-6234-enabled.xml | 2 -
.../x86_64-cpuid-Phenom-B95-disabled.xml | 1 -
.../x86_64-cpuid-Phenom-B95-enabled.xml | 2 -
..._64-cpuid-Ryzen-7-1800X-Eight-Core-disabled.xml | 1 -
...6_64-cpuid-Ryzen-7-1800X-Eight-Core-enabled.xml | 2 -
.../x86_64-cpuid-Xeon-E3-1245-v5-enabled.xml | 1 -
.../x86_64-cpuid-Xeon-E5-2630-v3-enabled.xml | 1 -
.../x86_64-cpuid-Xeon-E5-2650-v3-enabled.xml | 1 -
.../x86_64-cpuid-Xeon-E5-2650-v4-disabled.xml | 1 +
.../x86_64-cpuid-Xeon-E5-2650-v4-enabled.xml | 1 -
.../x86_64-cpuid-Xeon-E7-4820-enabled.xml | 1 -
.../x86_64-cpuid-Xeon-E7-4830-enabled.xml | 1 -
.../x86_64-cpuid-Xeon-E7-8890-v3-enabled.xml | 1 -
.../x86_64-cpuid-Xeon-Gold-6148-disabled.xml | 1 +
.../x86_64-cpuid-Xeon-Gold-6148-enabled.xml | 1 -
.../x86_64-cpuid-Xeon-W3520-enabled.xml | 1 -
41 files changed, 60 insertions(+), 63 deletions(-)
--
2.15.1
6 years, 8 months
[libvirt] [PATCH v2] nodedev: update mdev_types caps before dumpxml
by Wu Zongyong
In current implemention, mdev_types caps keep constant all
the time. But, it is possible that a device capable of
mdev_types sometime(for example:bind to proper driver) and
incapable of mdev_types at other times(for example: unbind
from its driver).
We should keep the info of xml dumped out consistent with
real status of the device.
Signed-off-by: Wu Zongyong <cordius.wu(a)huawei.com>
---
v2:
- fix mistakes pointed out by Erik
src/node_device/node_device_linux_sysfs.c | 21 +++++++++++++++++++++
src/node_device/node_device_udev.c | 29 +++++++++++++++++++++++++++++
src/node_device/node_device_udev.h | 18 +++++++++++++-----
3 files changed, 63 insertions(+), 5 deletions(-)
diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c
index 6f438e5..8b00aff 100644
--- a/src/node_device/node_device_linux_sysfs.c
+++ b/src/node_device/node_device_linux_sysfs.c
@@ -29,6 +29,7 @@
#include "dirname.h"
#include "node_device_driver.h"
#include "node_device_hal.h"
+#include "node_device_udev.h"
#include "node_device_linux_sysfs.h"
#include "virerror.h"
#include "viralloc.h"
@@ -175,6 +176,24 @@ nodeDeviceSysfsGetPCIIOMMUGroupCaps(virNodeDevCapPCIDevPtr pci_dev)
return ret;
}
+static int
+nodeDeviceSysfsGetPCIMdevTypesCaps(const char *sysfsPath,
+ virNodeDevCapPCIDevPtr pci_dev)
+{
+ size_t i;
+
+ /* this could be a refresh, so clear out the old data */
+ for (i = 0; i < pci_dev->nmdev_types; i++)
+ virNodeDevCapMdevTypeFree(pci_dev->mdev_types[i]);
+ VIR_FREE(pci_dev->mdev_types);
+ pci_dev->nmdev_types = 0;
+
+ if (udevPCISysfsGetMdevTypesCap(sysfsPath, pci_dev) < 0)
+ return -1;
+
+ return 0;
+}
+
/* nodeDeviceSysfsGetPCIRelatedCaps() get info that is stored in sysfs
* about devices related to this device, i.e. things that can change
@@ -190,6 +209,8 @@ nodeDeviceSysfsGetPCIRelatedDevCaps(const char *sysfsPath,
return -1;
if (nodeDeviceSysfsGetPCIIOMMUGroupCaps(pci_dev) < 0)
return -1;
+ if (nodeDeviceSysfsGetPCIMdevTypesCaps(sysfsPath, pci_dev) < 0)
+ return -1;
return 0;
}
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index e0fca61..781facf 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -506,6 +506,35 @@ udevPCIGetMdevTypesCap(struct udev_device *device,
}
+int
+udevPCISysfsGetMdevTypesCap(const char *sysfsPath,
+ virNodeDevCapPCIDevPtr pci_dev)
+{
+ int ret = -1;
+ udevEventDataPtr priv = NULL;
+ struct udev *udev = NULL;
+ struct udev_device *device = NULL;
+
+ priv = driver->privateData;
+ udev = udev_monitor_get_udev(priv->udev_monitor);
+ device = udev_device_new_from_syspath(udev, sysfsPath);
+ if (!device) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to create udev device from path %s"),
+ sysfsPath);
+ goto cleanup;
+ }
+
+ if (udevPCIGetMdevTypesCap(device, pci_dev) < 0)
+ goto cleanup;
+
+ ret = 0;
+ cleanup:
+ udev_device_unref(device);
+ return ret;
+}
+
+
static int
udevProcessPCI(struct udev_device *device,
virNodeDeviceDefPtr def)
diff --git a/src/node_device/node_device_udev.h b/src/node_device/node_device_udev.h
index f15e520..bbdc70f 100644
--- a/src/node_device/node_device_udev.h
+++ b/src/node_device/node_device_udev.h
@@ -19,10 +19,18 @@
*
* Author: Dave Allan <dallan(a)redhat.com>
*/
+#ifndef __VIR_NODE_DEVICE_UDEV_H__
+# define __VIR_NODE_DEVICE_UDEV_H__
-#include <libudev.h>
-#include <stdint.h>
+# include <libudev.h>
+# include <stdint.h>
-#define SYSFS_DATA_SIZE 4096
-#define DMI_DEVPATH "/sys/devices/virtual/dmi/id"
-#define DMI_DEVPATH_FALLBACK "/sys/class/dmi/id"
+# define SYSFS_DATA_SIZE 4096
+# define DMI_DEVPATH "/sys/devices/virtual/dmi/id"
+# define DMI_DEVPATH_FALLBACK "/sys/class/dmi/id"
+
+int
+udevPCISysfsGetMdevTypesCap(const char *sysfsPath, virNodeDevCapPCIDevPtr pci_dev);
+
+
+#endif /* __VIR_NODE_DEVICE_UDEV_H__ */
--
1.8.3.1
6 years, 8 months
[libvirt] [PATCH 0/4] apparmor: implement more domain callbacks
by Christian Ehrhardt
Based on a discussion in [1] I found that the AppArmor security
module lacked some callbacks. Implementing those not only fixes
the issue I had before but will also cover a few more cases I
didn't even run into so far.
[1]: https://www.redhat.com/archives/libvir-list/2017-December/msg00726.html
Christian Ehrhardt (4):
security, apparmor: implement domainSetPathLabel
security: full path option for DomainSetPathLabel
security, apparmor: add (Set|Restore)ChardevLabel
apparmor, virt-aa-helper: drop static channel rule
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_process.c | 4 +-
src/security/security_apparmor.c | 96 ++++++++++++++++++++++++++++++++++++++++
src/security/security_dac.c | 3 +-
src/security/security_driver.h | 3 +-
src/security/security_manager.c | 5 ++-
src/security/security_manager.h | 3 +-
src/security/security_selinux.c | 3 +-
src/security/security_stack.c | 5 ++-
src/security/virt-aa-helper.c | 2 -
10 files changed, 113 insertions(+), 13 deletions(-)
--
2.7.4
6 years, 8 months
[libvirt] [cim][PATCH 0/2] memory leak fixes in CIM provider
by Adam Majer
In some instances, asprintf allocated memory is not freed
resulting in a slow memory leak.
Adam Majer (2):
Fix memory leak in set_other_id_info
Fix memory leak in set_input_props
src/Virt_ComputerSystem.c | 2 ++
src/Virt_SettingsDefineCapabilities.c | 6 ++++--
2 files changed, 6 insertions(+), 2 deletions(-)
--
2.13.6
6 years, 8 months
[libvirt] [cim][PATCH 1/2] Fix memory leak in set_other_id_info
by Adam Majer
model was allocated by asprintf but never freed after usage
and assignement.
Signed-off-by: Adam Majer <amajer(a)suse.de>
---
src/Virt_ComputerSystem.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/Virt_ComputerSystem.c b/src/Virt_ComputerSystem.c
index da07f93..b4930ac 100644
--- a/src/Virt_ComputerSystem.c
+++ b/src/Virt_ComputerSystem.c
@@ -417,6 +417,8 @@ static int set_other_id_info(const CMPIBroker *broker,
CMPI_string);
}
+ free(model);
+
CMSetProperty(instance, "OtherIdentifyingInfo",
&id_info, CMPI_stringA);
--
2.13.6
6 years, 8 months
[libvirt] [PATCH] tests: Only format the CPU frequency if it's known
by Andrea Bolognani
Instead of formatting 'MHz: 0', which can be confusing, skip the
field altogether. This behavior is consistent with that of 'virsh
nodeinfo'.
Suggested-by: John Ferlan <jferlan(a)redhat.com>
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
.../linux-aarch64-f21-mustang.expected | 2 +-
.../linux-aarch64-rhel74-moonshot.expected | 2 +-
.../linux-aarch64-rhelsa-3.19.0-mustang.expected | 2 +-
.../linux-armv6l-raspberrypi.expected | 2 +-
tests/virhostcputest.c | 28 +++++++++++++++++-----
5 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/tests/virhostcpudata/linux-aarch64-f21-mustang.expected b/tests/virhostcpudata/linux-aarch64-f21-mustang.expected
index ac950dc15..1ee3cf737 100644
--- a/tests/virhostcpudata/linux-aarch64-f21-mustang.expected
+++ b/tests/virhostcpudata/linux-aarch64-f21-mustang.expected
@@ -1 +1 @@
-CPUs: 8/8, MHz: 0, Nodes: 1, Sockets: 4, Cores: 2, Threads: 1
+CPUs: 8/8, Nodes: 1, Sockets: 4, Cores: 2, Threads: 1
diff --git a/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected b/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected
index 6776aa6c2..1926af836 100644
--- a/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected
+++ b/tests/virhostcpudata/linux-aarch64-rhel74-moonshot.expected
@@ -1 +1 @@
-CPUs: 8/8, MHz: 0, Nodes: 1, Sockets: 1, Cores: 8, Threads: 1
+CPUs: 8/8, Nodes: 1, Sockets: 1, Cores: 8, Threads: 1
diff --git a/tests/virhostcpudata/linux-aarch64-rhelsa-3.19.0-mustang.expected b/tests/virhostcpudata/linux-aarch64-rhelsa-3.19.0-mustang.expected
index 6776aa6c2..1926af836 100644
--- a/tests/virhostcpudata/linux-aarch64-rhelsa-3.19.0-mustang.expected
+++ b/tests/virhostcpudata/linux-aarch64-rhelsa-3.19.0-mustang.expected
@@ -1 +1 @@
-CPUs: 8/8, MHz: 0, Nodes: 1, Sockets: 1, Cores: 8, Threads: 1
+CPUs: 8/8, Nodes: 1, Sockets: 1, Cores: 8, Threads: 1
diff --git a/tests/virhostcpudata/linux-armv6l-raspberrypi.expected b/tests/virhostcpudata/linux-armv6l-raspberrypi.expected
index 1c4c713d5..4961316fb 100644
--- a/tests/virhostcpudata/linux-armv6l-raspberrypi.expected
+++ b/tests/virhostcpudata/linux-armv6l-raspberrypi.expected
@@ -1 +1 @@
-CPUs: 1/1, MHz: 0, Nodes: 1, Sockets: 1, Cores: 1, Threads: 1
+CPUs: 1/1, Nodes: 1, Sockets: 1, Cores: 1, Threads: 1
diff --git a/tests/virhostcputest.c b/tests/virhostcputest.c
index d3ee18461..9a1a48098 100644
--- a/tests/virhostcputest.c
+++ b/tests/virhostcputest.c
@@ -32,6 +32,7 @@ linuxTestCompareFiles(const char *cpuinfofile,
const char *outputfile)
{
int ret = -1;
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
char *actualData = NULL;
virNodeInfo nodeinfo;
FILE *cpuinfo;
@@ -57,20 +58,35 @@ linuxTestCompareFiles(const char *cpuinfofile,
}
VIR_FORCE_FCLOSE(cpuinfo);
- if (virAsprintf(&actualData,
- "CPUs: %u/%u, MHz: %u, Nodes: %u, Sockets: %u, "
- "Cores: %u, Threads: %u\n",
- nodeinfo.cpus, VIR_NODEINFO_MAXCPUS(nodeinfo),
- nodeinfo.mhz, nodeinfo.nodes, nodeinfo.sockets,
- nodeinfo.cores, nodeinfo.threads) < 0)
+ virBufferAsprintf(&buf,
+ "CPUs: %u/%u, ",
+ nodeinfo.cpus, VIR_NODEINFO_MAXCPUS(nodeinfo));
+
+ /* Only format the CPU frequency if it's known. This behavior is
+ * consistent with that of 'virsh nodeinfo' */
+ if (nodeinfo.mhz) {
+ virBufferAsprintf(&buf,
+ "MHz: %u, ",
+ nodeinfo.mhz);
+ }
+
+ virBufferAsprintf(&buf,
+ "Nodes: %u, Sockets: %u, Cores: %u, Threads: %u\n",
+ nodeinfo.nodes, nodeinfo.sockets,
+ nodeinfo.cores, nodeinfo.threads);
+
+ if (virBufferError(&buf))
goto fail;
+ actualData = virBufferContentAndReset(&buf);
+
if (virTestCompareToFile(actualData, outputfile) < 0)
goto fail;
ret = 0;
fail:
+ virBufferFreeAndReset(&buf);
VIR_FREE(actualData);
return ret;
}
--
2.14.3
6 years, 8 months
[libvirt] [PATCH] add support of iSER transport type in qemu with libiscsi
by lichstor@gmail.com
From: zhangshengyu <zhangshengyu(a)fusionstack.cn>
---
src/conf/domain_conf.c | 10 ++++++
src/qemu/qemu_block.c | 24 +++++++++++--
src/qemu/qemu_command.c | 3 ++
src/qemu/qemu_parse_command.c | 10 +++++-
src/storage/storage_backend_gluster.c | 1 +
src/util/virstoragefile.c | 3 +-
src/util/virstoragefile.h | 1 +
.../qemuargv2xmldata/disk-drive-network-iser.args | 25 +++++++++++++
tests/qemuargv2xmldata/disk-drive-network-iser.xml | 41 ++++++++++++++++++++++
tests/qemuargv2xmltest.c | 1 +
.../qemuxml2argvdata/disk-drive-network-iser.args | 29 +++++++++++++++
tests/qemuxml2argvdata/disk-drive-network-iser.xml | 37 +++++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
.../qemuxml2xmloutdata/disk-drive-network-iser.xml | 41 ++++++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
15 files changed, 224 insertions(+), 4 deletions(-)
create mode 100644 tests/qemuargv2xmldata/disk-drive-network-iser.args
create mode 100644 tests/qemuargv2xmldata/disk-drive-network-iser.xml
create mode 100644 tests/qemuxml2argvdata/disk-drive-network-iser.args
create mode 100644 tests/qemuxml2argvdata/disk-drive-network-iser.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-drive-network-iser.xml
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9a62bc472..5767575d0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7080,6 +7080,7 @@ virDomainStorageNetworkParseHosts(xmlNodePtr node,
virStorageNetHostDefPtr *hosts,
size_t *nhosts)
{
+ char *transport = NULL;
xmlNodePtr child;
for (child = node->children; child; child = child->next) {
@@ -7091,6 +7092,11 @@ virDomainStorageNetworkParseHosts(xmlNodePtr node,
}
}
+ if ((*hosts) && (transport = virXMLPropString(node, "transport"))) {
+ //VIR_WARN("missing network source transport type");
+ (*hosts)->transport = virStorageNetHostTransportTypeFromString(transport);
+ }
+
return 0;
}
@@ -8495,6 +8501,7 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
if (virDomainStorageNetworkParseHosts(node, &src->hosts, &src->nhosts) < 0)
goto cleanup;
+
virStorageSourceNetworkAssignDefaultPorts(src);
ret = 0;
@@ -22364,6 +22371,9 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
VIR_FREE(path);
+ if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER)
+ virBufferEscapeString(attrBuf, " transport='%s'", "iser");
+
if (src->haveTLS != VIR_TRISTATE_BOOL_ABSENT &&
!(flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE &&
src->tlsFromConfig))
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 585f0255e..49837205f 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -433,6 +433,12 @@ qemuBlockStorageSourceGetURI(virStorageSourcePtr src)
if (VIR_STRDUP(uri->scheme,
virStorageNetProtocolTypeToString(src->protocol)) < 0)
goto cleanup;
+ } else if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER) {
+ uri->port = src->hosts->port;
+
+ if (VIR_STRDUP(uri->scheme,
+ virStorageNetHostTransportTypeToString(src->hosts->transport)) < 0)
+ goto cleanup;
} else {
if (virAsprintf(&uri->scheme, "%s+%s",
virStorageNetProtocolTypeToString(src->protocol),
@@ -506,6 +512,19 @@ qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDefPtr host,
goto cleanup;
break;
+ case VIR_STORAGE_NET_HOST_TRANS_ISER:
+ transport = "iser";
+ if (virAsprintf(&port, "%u", host->port) < 0)
+ goto cleanup;
+
+ if (virJSONValueObjectCreate(&server,
+ "s:type", transport,
+ "s:host", host->name,
+ "s:port", port,
+ NULL) < 0)
+ goto cleanup;
+ break;
+
case VIR_STORAGE_NET_HOST_TRANS_UNIX:
if (virJSONValueObjectCreate(&server,
"s:type", "unix",
@@ -590,7 +609,8 @@ qemuBlockStorageSourceBuildJSONInetSocketAddress(virStorageNetHostDefPtr host)
virJSONValuePtr ret = NULL;
char *port = NULL;
- if (host->transport != VIR_STORAGE_NET_HOST_TRANS_TCP) {
+ if (host->transport != VIR_STORAGE_NET_HOST_TRANS_TCP &&
+ host->transport != VIR_STORAGE_NET_HOST_TRANS_ISER) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("only TCP protocol can be converted to InetSocketAddress"));
return NULL;
@@ -831,7 +851,7 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr src)
"s:portal", portal,
"s:target", target,
"u:lun", lun,
- "s:transport", "tcp",
+ "s:transport", virStorageNetHostTransportTypeToString(src->hosts->transport),
"S:user", username,
"S:password-secret", objalias,
NULL));
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4d0c141e5..eb482097f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -883,6 +883,8 @@ qemuBuildNetworkDriveStr(virStorageSourcePtr src,
if (!((src->hosts->name && strchr(src->hosts->name, ':')) ||
(src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP &&
!src->hosts->name) ||
+ (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER &&
+ !src->hosts->name) ||
(src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_UNIX &&
src->hosts->socket &&
src->hosts->socket[0] != '/'))) {
@@ -891,6 +893,7 @@ qemuBuildNetworkDriveStr(virStorageSourcePtr src,
switch (src->hosts->transport) {
case VIR_STORAGE_NET_HOST_TRANS_TCP:
+ case VIR_STORAGE_NET_HOST_TRANS_ISER:
virBufferAsprintf(&buf, "%s:%u",
src->hosts->name, src->hosts->port);
break;
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index 5fe3f97d0..d376af208 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -70,7 +70,9 @@ qemuParseDriveURIString(virDomainDiskDefPtr def, virURIPtr uri,
if (transp)
*transp++ = 0;
- if (STRNEQ(uri->scheme, scheme)) {
+ if (STREQ(uri->scheme, "iser")) {
+ transp = (char *)"iser";
+ } else if (STRNEQ(uri->scheme, scheme)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid transport/scheme '%s'"), uri->scheme);
goto error;
@@ -709,6 +711,12 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
if (qemuParseISCSIString(def) < 0)
goto error;
+ } else if (STRPREFIX(def->src->path, "iser:")) {
+ def->src->type = VIR_STORAGE_TYPE_NETWORK;
+ def->src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
+
+ if (qemuParseISCSIString(def) < 0)
+ goto error;
} else if (STRPREFIX(def->src->path, "sheepdog:")) {
char *p = def->src->path;
char *port, *vdi;
diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
index 5eea84f16..1452fa0cd 100644
--- a/src/storage/storage_backend_gluster.c
+++ b/src/storage/storage_backend_gluster.c
@@ -608,6 +608,7 @@ virStorageFileBackendGlusterInitServer(virStorageFileBackendGlusterPrivPtr priv,
hoststr = host->socket;
break;
+ case VIR_STORAGE_NET_HOST_TRANS_ISER:
case VIR_STORAGE_NET_HOST_TRANS_LAST:
break;
}
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 5780180a9..63253a9c4 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -92,7 +92,8 @@ VIR_ENUM_IMPL(virStorageNetProtocol, VIR_STORAGE_NET_PROTOCOL_LAST,
VIR_ENUM_IMPL(virStorageNetHostTransport, VIR_STORAGE_NET_HOST_TRANS_LAST,
"tcp",
"unix",
- "rdma")
+ "rdma",
+ "iser")
VIR_ENUM_IMPL(virStorageSourcePoolMode,
VIR_STORAGE_SOURCE_POOL_MODE_LAST,
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index ecd806c93..5a6ec7776 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -147,6 +147,7 @@ typedef enum {
VIR_STORAGE_NET_HOST_TRANS_TCP,
VIR_STORAGE_NET_HOST_TRANS_UNIX,
VIR_STORAGE_NET_HOST_TRANS_RDMA,
+ VIR_STORAGE_NET_HOST_TRANS_ISER,
VIR_STORAGE_NET_HOST_TRANS_LAST
} virStorageNetHostTransport;
diff --git a/tests/qemuargv2xmldata/disk-drive-network-iser.args b/tests/qemuargv2xmldata/disk-drive-network-iser.args
new file mode 100644
index 000000000..c476e759e
--- /dev/null
+++ b/tests/qemuargv2xmldata/disk-drive-network-iser.args
@@ -0,0 +1,25 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=iser://example.org:6000/iqn.1992-01.com.example,format=raw,\
+if=virtio \
+-drive file=iser://example.org:6000/iqn.1992-01.com.example/1,format=raw,\
+if=virtio \
+-net none \
+-serial none \
+-parallel none
diff --git a/tests/qemuargv2xmldata/disk-drive-network-iser.xml b/tests/qemuargv2xmldata/disk-drive-network-iser.xml
new file mode 100644
index 000000000..88f043f66
--- /dev/null
+++ b/tests/qemuargv2xmldata/disk-drive-network-iser.xml
@@ -0,0 +1,41 @@
+<domain type='qemu'>
+ <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/bin/qemu-system-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='iscsi' name='iqn.1992-01.com.example/0' transport='iser'>
+ <host name='example.org' port='6000' transport='iser'/>
+ </source>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='iscsi' name='iqn.1992-01.com.example/1' transport='iser'>
+ <host name='example.org' port='6000' transport='iser'/>
+ </source>
+ <target dev='vdb' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </disk>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
index cb010268c..3a82630e0 100644
--- a/tests/qemuargv2xmltest.c
+++ b/tests/qemuargv2xmltest.c
@@ -213,6 +213,7 @@ mymain(void)
DO_TEST("disk-drive-network-nbd-unix");
DO_TEST("disk-drive-network-iscsi");
DO_TEST("disk-drive-network-iscsi-auth");
+ DO_TEST("disk-drive-network-iser");
DO_TEST("disk-drive-network-gluster");
DO_TEST("disk-drive-network-rbd");
DO_TEST("disk-drive-network-rbd-auth");
diff --git a/tests/qemuxml2argvdata/disk-drive-network-iser.args b/tests/qemuxml2argvdata/disk-drive-network-iser.args
new file mode 100644
index 000000000..49ea467ff
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-drive-network-iser.args
@@ -0,0 +1,29 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=iser://example.org:6000/iqn.1992-01.com.example/0,format=raw,\
+if=none,id=drive-virtio-disk0 \
+-device virtio-blk-pci,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,\
+id=virtio-disk0 \
+-drive file=iser://example.org:6000/iqn.1992-01.com.example/1,format=raw,\
+if=none,id=drive-virtio-disk1 \
+-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,\
+id=virtio-disk1
diff --git a/tests/qemuxml2argvdata/disk-drive-network-iser.xml b/tests/qemuxml2argvdata/disk-drive-network-iser.xml
new file mode 100644
index 000000000..b1634555c
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-drive-network-iser.xml
@@ -0,0 +1,37 @@
+<domain type='qemu'>
+ <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/bin/qemu-system-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='iscsi' name='iqn.1992-01.com.example' transport='iser'>
+ <host name='example.org' port='6000'/>
+ </source>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='iscsi' name='iqn.1992-01.com.example/1' transport='iser'>
+ <host name='example.org' port='6000'/>
+ </source>
+ <target dev='vdb' bus='virtio'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index ca24e0bbb..accfdaf4b 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -936,6 +936,7 @@ mymain(void)
DO_TEST("disk-drive-network-iscsi-lun",
QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI,
QEMU_CAPS_SCSI_BLOCK);
+ DO_TEST("disk-drive-network-iser", NONE);
DO_TEST("disk-drive-network-gluster",
QEMU_CAPS_GLUSTER_DEBUG_LEVEL);
DO_TEST("disk-drive-network-rbd", NONE);
diff --git a/tests/qemuxml2xmloutdata/disk-drive-network-iser.xml b/tests/qemuxml2xmloutdata/disk-drive-network-iser.xml
new file mode 100644
index 000000000..88f043f66
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/disk-drive-network-iser.xml
@@ -0,0 +1,41 @@
+<domain type='qemu'>
+ <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/bin/qemu-system-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='iscsi' name='iqn.1992-01.com.example/0' transport='iser'>
+ <host name='example.org' port='6000' transport='iser'/>
+ </source>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='iscsi' name='iqn.1992-01.com.example/1' transport='iser'>
+ <host name='example.org' port='6000' transport='iser'/>
+ </source>
+ <target dev='vdb' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </disk>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 2be8eb2c1..23f9292c4 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -515,6 +515,7 @@ mymain(void)
DO_TEST("disk-drive-network-nbd-unix", NONE);
DO_TEST("disk-drive-network-iscsi", NONE);
DO_TEST("disk-drive-network-iscsi-auth", NONE);
+ DO_TEST("disk-drive-network-iser", NONE);
DO_TEST("disk-drive-network-gluster", NONE);
DO_TEST("disk-drive-network-rbd", NONE);
DO_TEST("disk-drive-network-rbd-auth", NONE);
--
2.13.6 (Apple Git-96)
6 years, 8 months