[libvirt] [PATCH] util: fix build on non-Linux
by Roman Bogorodskiy
Fix typo in virNetDevPFGetVF() stub:
ATTRUBUTE_UNUSED -> ATTRIBUTE_UNUSED.
While here, use common indent style for arguments in
virNetDevGetVirtualFunctionIndex() stub.
---
Pushed under the build-breaker rule.
src/util/virnetdev.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index b9e9cbe54..93a931912 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -1493,8 +1493,8 @@ virNetDevIsVirtualFunction(const char *ifname ATTRIBUTE_UNUSED)
int
virNetDevGetVirtualFunctionIndex(const char *pfname ATTRIBUTE_UNUSED,
- const char *vfname ATTRIBUTE_UNUSED,
- int *vf_index ATTRIBUTE_UNUSED)
+ const char *vfname ATTRIBUTE_UNUSED,
+ int *vf_index ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Unable to get virtual function index on this platform"));
@@ -1513,7 +1513,7 @@ virNetDevGetPhysicalFunction(const char *ifname ATTRIBUTE_UNUSED,
int
virNetDevPFGetVF(const char *pfname ATTRIBUTE_UNUSED,
int vf ATTRIBUTE_UNUSED,
- char **vfname ATTRUBUTE_UNUSED)
+ char **vfname ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Unable to get virtual function name on this platform"));
--
2.11.0
7 years, 8 months
[libvirt] [PATCH] Coverity fix for virNetDevIPCheckIPv6ForwardingCallback
by Cédric Bosdonnat
Add check for more than one RTA_OIF, even though this is rather
unlikely and get rid of the buggy switch / break.
---
src/util/virnetdevip.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c
index c9ac6baf7..f5662413a 100644
--- a/src/util/virnetdevip.c
+++ b/src/util/virnetdevip.c
@@ -556,15 +556,17 @@ virNetDevIPCheckIPv6ForwardingCallback(const struct nlmsghdr *resp,
if (resp->nlmsg_type != RTM_NEWROUTE)
return ret;
- /* Extract a few attributes */
+ /* Extract a device ID attribute */
for (rta = RTM_RTA(rtmsg); RTA_OK(rta, len); rta = RTA_NEXT(rta, len)) {
- switch (rta->rta_type) {
- case RTA_OIF:
+ if (rta->rta_type == RTA_OIF) {
oif = *(int *)RTA_DATA(rta);
+ /* Should never happen: netlink message would be broken */
+ if (ifname)
+ goto error;
+
if (!(ifname = virNetDevGetName(oif)))
goto error;
- break;
}
}
--
2.12.0
7 years, 8 months
[libvirt] [PATCH] virpci: fix build on non-Linux
by Roman Bogorodskiy
virPCIGetDeviceAddressFromSysfsLink() should return
virPCIDeviceAddressPtr, so return NULL in the stub instead of "-1".
---
Pushed under the build-breaker rule.
src/util/virpci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 546aeb550..65c108f2e 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -2945,7 +2945,7 @@ virPCIDeviceAddressPtr
virPCIGetDeviceAddressFromSysfsLink(const char *device_link ATTRIBUTE_UNUSED)
{
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
- return -1;
+ return NULL;
}
--
2.11.0
7 years, 8 months
[libvirt] ARMv7 guest PCI support broken in 3.0.0 onwards
by Daniel P. Berrange
$ cat arm.xml
<domain type="qemu">
<name>f22-arm32</name>
<uuid>a6bc14fb-585b-40b0-a15b-5e19f26079ba</uuid>
<memory>1048576</memory>
<currentMemory>1048576</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="armv7l" machine="virt">hvm</type>
<boot dev="hd"/>
</os>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-arm</emulator>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/home/berrange/VirtualMachines/demo.qcow2"/>
<target dev="sda" bus="scsi"/>
</disk>
<controller type="scsi" index="0" model="virtio-scsi"/>
<interface type="user">
<mac address="52:54:00:87:d4:c0"/>
<model type="virtio"/>
</interface>
<console type="pty"/>
</devices>
</domain>
$ virsh define arm.xml
Domain f22-arm32 defined from arm.xml
$ virsh start f22-arm32
error: Failed to start domain f22-arm32
error: internal error: qemu unexpectedly closed the monitor: 2017-02-15T09:24:03.967648Z qemu-system-arm: -device ioh3420,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,addr=0x1: MSI is not supported by interrupt controller
2017-02-15T09:24:03.968154Z qemu-system-arm: -device ioh3420,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,addr=0x1: Device initialization failed
I've not bisected it other than to find it works in 2.5.0 and is
broken in 3.0.0
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|
7 years, 8 months
[libvirt] [PATCH 0/3] Report block threshold in bulk stats
by Peter Krempa
This is a follow up to:
https://www.redhat.com/archives/libvir-list/2017-March/msg00650.html
so that management apps can query the current value. The series needs to be
applied on top of the block threshold series. For convenience I've pushed it
to the same remote repository as the original series. You can fetch it here:
git fetch git://pipo.sk/pipo/libvirt.git block-threshold-1
Peter Krempa (3):
util: json: Make function to free JSON values in virHash universal
qemu: block: Add code to fetch block node data by node name
qemu: stats: Display the block threshold size in bulk stats
src/libvirt-domain.c | 4 ++++
src/libvirt_private.syms | 1 +
src/qemu/qemu_block.c | 46 +++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_block.h | 3 +++
src/qemu/qemu_driver.c | 51 +++++++++++++++++++++++++++++++++++++++++---
src/qemu/qemu_monitor_json.c | 10 +--------
src/util/virjson.c | 8 +++++++
src/util/virjson.h | 1 +
tools/virsh.pod | 3 +++
9 files changed, 115 insertions(+), 12 deletions(-)
--
2.12.0
7 years, 8 months
[libvirt] [PATCH v2] qemu: snapshot: Forbid internal snapshots with pflash firmware
by Peter Krempa
If the variable store (<nvram>) file is raw qemu can't do a snapshot of
it and thus the snapshot would be incomplete. QEMU does no reject such
snapshot.
Additionally allowing to use a qcow2 variable store backing file would
solve this issue but then it would become eligible to become target of
the memory dump.
Offline internal snapshot would be incomplete too with either storage
format since libvirt does not handle the pflash file in this case.
Forbid such snapshot so that we can avoid problems.
---
Notes:
v2:
- changed error code to OPERATION_UNSUPPORTED (from CONFIG_UNSUPPORTED)
- dropped mention of QEMU from the error message
- dropped mentions of OVMF or the firmware itself altoghether, the culprit is
the pflash device regardless of the software it contains
- mentioned all the stuff in the commit message and comment
We also will need to introduce a way to snapshot the pflash for external
snapshots which is currently impossible as well, but fortunately does not
have inherent drawbacks as internal snapshots.
src/qemu/qemu_driver.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 676295208..202d190b3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13873,6 +13873,16 @@ qemuDomainSnapshotPrepare(virConnectPtr conn,
goto cleanup;
}
+ /* Internal snapshots don't work with VMs with OVMF loader since qemu does
+ * not snapshot the variable store */
+ if (found_internal &&
+ vm->def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("internal snapshots of a VM with pflash based "
+ "firmware are not supported"));
+ goto cleanup;
+ }
+
/* Alter flags to let later users know what we learned. */
if (external && !active)
*flags |= VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY;
--
2.12.1
7 years, 8 months
[libvirt] [PATCH v3 0/3] qemu: Forbid internal snapshots with pflash-based firmware (OVMF)
by Peter Krempa
Patches 1 and 2 are new in the series and add an option to override the check so
that users can use the feature despite being unsafe.
See patch 3/3 for clarification of the motiovation to do this.
Peter Krempa (3):
virerror: Introduce VIR_ERR_OPERATION_UNSAFE
snapshot: Introduce flag VIR_DOMAIN_SNAPSHOT_CREATE_UNSAFE
qemu: snapshot: Forbid internal snapshots with pflash firmware
include/libvirt/libvirt-domain-snapshot.h | 3 +++
include/libvirt/virterror.h | 1 +
src/qemu/qemu_driver.c | 18 +++++++++++++++++-
src/util/virerror.c | 5 +++++
tools/virsh-snapshot.c | 6 ++++++
tools/virsh.pod | 6 +++++-
6 files changed, 37 insertions(+), 2 deletions(-)
--
2.12.1
7 years, 8 months
[libvirt] [PATCH] Revert "qemu: forbid migration with an IOMMU device"
by Ján Tomko
This reverts commit b7118623ad5a8e6ea75d693881c08873eefa3e28.
Migration was implemented by QEMU commit:
commit 8cdcf3c1e58d04b6811956d7608efeb66c42d719
Author: Peter Xu <peterx(a)redhat.com>
Date: Fri Jan 6 12:06:13 2017 +0800
intel_iommu: allow migration
https://bugzilla.redhat.com/show_bug.cgi?id=1433994
---
src/qemu/qemu_migration.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 15ed830..f5711bc 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2359,12 +2359,6 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver,
_("migration with shmem device is not supported"));
return false;
}
-
- if (vm->def->iommu) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("migration with iommu device is not supported"));
- return false;
- }
}
return true;
--
2.10.2
7 years, 8 months
[libvirt] [PATCH] network: only check for IPv6 RA routes when the network has an IPv6 address
by Laine Stump
commit 00d28a78 added a check to see if there were any IPv6 routes
added by RA (Router Advertisement) via an interface that had accept_ra
set to something other than "2". The check was being done
unconditionally, but it's only relevant if IPv6 forwarding is going to
be turned on, and that will only happen if the network has an IPv6
address.
---
src/network/bridge_driver.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 0336ece..10e8f0e 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -2391,10 +2391,9 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
/* If forward.type != NONE, turn on global IP forwarding */
if (network->def->forward.type != VIR_NETWORK_FORWARD_NONE) {
- if (!virNetDevIPCheckIPv6Forwarding())
+ if (v6present && !virNetDevIPCheckIPv6Forwarding())
goto err3; /* Precise error message already provided */
-
if (networkEnableIPForwarding(v4present, v6present) < 0) {
virReportSystemError(errno, "%s",
_("failed to enable IP forwarding"));
--
2.9.3
7 years, 8 months
[libvirt] [PATCH 00/19] Fix saving/setting/restoring SR-IOV VF MAC address
by Laine Stump
There are multiple bugs filed against both libvirt and the kernel
related to incorrect restoration of MAC addresses for SR-IOV VFs, both
when used via VFIO device assignment and when used for macvtap
passthrough mode
https://bugzilla.redhat.com/1415609 - libvirt
https://bugzilla.redhat.com/1341248 - kernel (igb)
https://bugzilla.redhat.com/1415609 - kernel (ixgbe)
https://bugzilla.redhat.com/1302166 - kernel (mlx, fixed)
Beyond that, there are other problems with incorrect setting and
restoration of VF MAC addresses that don't have their own bug reports
(although they may be partially described in the comments of the BZes
mentioned above). This patch series attempts (and I hope succeeds!) to
fix all of these problems, which can be summarized in these three
points:
* The VF's own MAC address was not being set prior to using it for
macvtap passthrough mode. Instead, due to serious misconception on
my part, the "admin MAC" for that VF was set in the PF. The problem
is that the admin MAC isn't put into use on the VF immediately;
rather it is unused until the next time the VF driver is initialized
(on either the host or in a guest) so setting it had no practical
effect, meaning that the macvtap device's MAC didn't match the MAC
of the VF device it was attached to - this meant that traffic
wouldn't pass unless the device was in promiscuous mode (and
apparently it was back when the code was changed to behave this
way?).
* The VF's own MAC address was never restored after it had been used
(for both VFIO device assignment and for macvtap passthrough mode).
Only the "admin MAC" address (which, again, won't take effect
until/unless the VF driver is reloaded/reinitialized) was restored.
* If the original admin MAC was 00:00:00:00:00:00, libvirt would save
that, then attempt to restore it when the guest was finished with
the device, but for some/many SRIOV-capable net drivers, an all 0
MAC is not allowed to be set (even though that is its initial
value). This would result in the MAC not being changed (of course,
since this is the admin MAC, that didn't actually matter, but the
combination of the error message and the VF's own MAC still being
set to the value used by the guest, users mistakenly believed this
was the source of networking problems (e.g. when the guest moved to
another host, but the old host still had an interface showing its
MAC address).
There are lots of details in the patches. 01 - 07 just clean up and
slightly modify some existing utility functions. 08 - 11 define some
functions to save/restore netdev MAC/vlan settings, and 12-14 change
the existing setup/teardown code for macvtap and hostdev to use the
new functions, then 15 and 17-19 modify their behavior further, while
16 just removes functions that are no longer used.
In the end, the VF's own MAC *and* admin MAC are saved for all SRIOV
VFs when we begin using a VF, and the VF's MAC is restored when
finished. Since the admin MAC doesn't actually have any immediate
practical effect, we don't concern ourselves with assuring it is
restored in all cases (in particular, when use use the VF for VFIO
assignment, we only restore the VF's MAC, but not the admin MAC during
teardown, and when using the VF for macvtap passthrough we avoid
restoring the admin MAC because that would unnecessarily turn on the
"administratively set" flag in the PF driver (described in the commit
log for one of these patches). I might decide to fix the former later,
but for now it just unnecessarily complicates the code for no real
gain).
Laine Stump (19):
util: permit querying a VF MAC address or VLAN tag by itself
util: remove unused args from virNetDevSetVfConfig()
util: use cleanup label consistently in virHostdevNetConfigReplace()
util: eliminate useless local variable
util: make virMacAddrParse more versatile
util: change virPCIGetNetName() to not return error if device has no
net name
util: make virPCIGetDeviceAddressFromSysfsLink() public
util: new function virPCIDeviceRebind()
util: new internal function to permit silent failure of
virNetDevSetMAC()
util: new function virNetDevPFGetVF()
util: new functions virNetDev(Save|Read|Set)NetConfig()
util: use new virNetDev*NetConfig() functions for macvtap
setup/teardown
util: use new virNetDev*NetConfig() functions for hostdev
setup/teardown
util: replace virHostdevNetConfigReplace with ...(Save|Set)NetConfig()
util: save hostdev network device config before unbinding from host
driver
util: after hostdev assignment, restore VF MAC address via setting
admin MAC
util: remove unused functions from virnetdev.c
util: if setting admin MAC to 00:00:00:00:00:00 fails, try
02:00:00:00:00:00
util: try *really* hard to set the MAC address of an SRIOV VF
src/libvirt_private.syms | 10 +-
src/util/virhostdev.c | 171 ++++++--
src/util/virmacaddr.c | 2 +-
src/util/virnetdev.c | 937 +++++++++++++++++++++++++++++++-------------
src/util/virnetdev.h | 25 ++
src/util/virnetdevmacvlan.c | 45 ++-
src/util/virpci.c | 65 ++-
src/util/virpci.h | 4 +
8 files changed, 933 insertions(+), 326 deletions(-)
--
2.9.3
7 years, 8 months