summaryrefslogtreecommitdiff
path: root/src/libvirt_private.syms
Commit message (Collapse)AuthorAgeFilesLines
* util: introduce virCommandPassFDIndexJán Tomko2020-12-011-0/+1
| | | | | | | | Just like virCommandPassFD, but it also returns an index of the passed FD in the FD set. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
* util: json: add virJSONValueObjectGetStringArray convenienceMarc-André Lureau2020-12-011-0/+1
| | | | | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Tested-by: Han Han <hhan@redhat.com>
* util: synchronize with firewalld before we start calling iptables directlyLaine Stump2020-11-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When it is starting up, firewalld will delete all existing iptables rules and chains before adding its own rules. If libvirtd were to try to directly add iptables rules during the time before firewalld has finished initializing, firewalld would end up deleting the rules that libvirtd has just added. Currently this isn't a problem, since libvirtd only adds iptables rules via the firewalld "passthrough command" API, and so firewalld is able to properly serialize everything. However, we will soon be changing libvirtd to add its iptables and ebtables rules by directly calling iptables/ebtables rather than via firewalld, thus removing the serialization of libvirtd adding rules vs. firewalld deleting rules. This will especially apparent (if we don't fix it in advance, as this patch does) when libvirtd is responding to the dbus NameOwnerChanged event, which is used to learn when firewalld has been restarted. In that case, dbus sends the event before firewalld has been able to complete its initialization, so when libvirt responds to the event by adding back its iptables rules (with direct calls to /usr/bin/iptables), some of those rules are added before firewalld has a chance to do its "remove everything" startup protocol. The usual result of this is that libvirt will successfully add its private chains (e.g. LIBVIRT_INP, etc), but then fail when it tries to add a rule jumping to one of those chains (because in the interim, firewalld has deleted the new chains). The solution is for libvirt to preface it's direct calling to iptables with a iptables command sent via firewalld's passthrough command API. Since commands sent to firewalld are completed synchronously, and since firewalld won't service them until it has completed its own initialization, this will assure that by the time libvirt starts calling iptables to add rules, that firewalld will not be following up by deleting any of those rules. To minimize the amount of extra overhead, we request the simplest iptables command possible: "iptables -V" (and aside from logging a debug message, we ignore the result, for good measure). (This patch is being done *before* the patch that switches to calling iptables directly, so that everything will function properly with any fractional part of the series applied). Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
* util/tests: enable locking on iptables/ebtables commandlines by defaultLaine Stump2020-11-241-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | iptables and ip6tables have had a "-w" commandline option to grab a systemwide lock that prevents two iptables invocations from modifying the iptables chains since 2013 (upstream commit 93587a04 in iptables-1.4.20). Similarly, ebtables has had a "--concurrent" commandline option for the same purpose since 2011 (in the upstream ebtables commit f9b4bcb93, which was present in ebtables-2.0.10.4). Libvirt added code to conditionally use the commandline option for iptables/ip6tables in upstream commit ba95426d6f (libvirt-1.2.0, November 2013), and for ebtables in upstream commit dc33e6e4a5 (libvirt-1.2.11, November 2014) (the latter actually *re*-added the locking for iptables/ip6tables, as it had accidentally been removed during a refactor of firewall code in the interim). I say "conditionally" because a check was made during firewall module initialization that tried executing a test command with the -w/--concurrent option, and only continued using it for actual commands if that test command completed successfully. At the time the code was added this was a reasonable thing to do, as it had been less than a year since introduction of -w to iptables, so many distros supported by libvirt were still using iptables (and possibly even ebtables) versions too old to have the new commandline options. It is now 2020, and as far as I can discern from repology.org (and manually examining a RHEL7.9 system), every version of every distro that is supported by libvirt now uses new enough versions of both iptables and ebtables that they all have support for -w/--concurrent. That means we can finally remove the conditional code and simply always use them. Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
* conf: Add virCPUDefAddFeatureIfMissingJiri Denemark2020-11-241-0/+1
| | | | | | | | This new function adds a feature to a CPU definition only if it is not present there yet. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
* virt-host-validate: fix detection with cgroups v2Pavel Hrdina2020-11-191-0/+1
| | | | | | | | | | | | | | | | | | | | | Using virtCgroupNewSelf() is not correct with cgroups v2 because the the virt-host-validate process is executed from from the same cgroup context as the terminal and usually not all controllers are enabled by default. To do a proper check we need to use the root cgroup to see what controllers are actually available. Libvirt or systemd ensures that all controllers are available for VMs as well. This still doesn't solve the devices controller with cgroups v2 where there is no controller as it was replaced by eBPF. Currently libvirt tries to query eBPF programs which usually works only for root as regular users will get permission denied for that operation. Fixes: https://gitlab.com/libvirt/libvirt/-/issues/94 Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* conf: Drop virDomainCapsDeviceDefValidate()Michal Privoznik2020-11-161-1/+0
| | | | | | | | Now that nothing uses virDomainCapsDeviceDefValidate() it can be removed. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
* node_device: detecting mdev_types capability on CSS devicesBoris Fiuczynski2020-11-111-0/+1
| | | | | | | | Add detection of mdev_types capability to channel subsystem devices. Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
* conf: checkpoint: Split virDomainCheckpointRedefinePrep into two functionsPeter Krempa2020-11-091-0/+1
| | | | | | | | | | | | First one prepares and validates the definition, the second one actually either updates an existing checkpoint or assigns definition for the new one. This will allow driver code to add extra validation between those steps. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* util: xml: remove unused function virXMLChildElementCountYi Li2020-11-061-1/+0
| | | | | | Signed-off-by: Yi Li <yili@winhong.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
* util: hash: Add delete-safe hash iteratorPeter Krempa2020-11-061-0/+1
| | | | | | | | | | | | | | 'virHashForEach' historically allowed deletion of the current element as 'virHashRemoveSet' didn't exist. To prevent us from having to deeply analyse all iterators add virHashForEachSafe which first gets a list of elements and iterates them outside of the hash table. This will allow replace the internals of the hash table with other implementation which don't allow such operation. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Matt Coleman <matt@datto.com>
* util: hash: Introduce virHashForEachSortedPeter Krempa2020-11-061-0/+1
| | | | | | | | | Iterate the hash elements sorted by key. This is useful to provide a stable ordering such as in cases when the output is checked in tests. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Matt Coleman <matt@datto.com>
* qemusecuritytest: Skip on non supported platformsMichal Privoznik2020-11-061-0/+4
| | | | | | | | | | | | | | | For seclabel remembering we need to have XATTRs and a special namespace that is accessibly to CAP_SYS_ADMIN only (we don't want regular users to trick us into restoring to a different label). And what qemusecuritytest does is it checks whether we have not left any path behind with XATTRs or not restored to original seclabel after setAll + restoreAll round trip. But it can hardly do so if ran on a platform where there's no XATTR namespace we can use. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
* util: refactor mdev_types method from PCI to mdevBoris Fiuczynski2020-11-041-1/+1
| | | | | | | | | | Extract virPCIGetMdevTypes from PCI as virMediatedDeviceGetMdevTypes into mdev for later reuse. Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com> Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* libvirt: support memory failure eventzhenwei pi2020-10-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Introduce memory failure event. Libvirt should monitor domain's event, then posts it to uplayer. According to the hardware memory corrupted message, a cloud scheduler could migrate domain to another health physical server. Several changes in this patch: public API: include/* src/conf/* src/remote/* src/remote_protocol-structs client: examples/c/misc/event-test.c tools/virsh-domain.c With this patch, each driver could implement its own method to run this new event. Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* util: hash: Remove virHashValueFreePeter Krempa2020-10-221-1/+0
| | | | | | | Use 'g_free' directly. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
* Replace all instances of 'virHashCreate' with 'virHashNew'Peter Krempa2020-10-221-1/+0
| | | | | | | | | | It doesn't make much sense to configure the bucket count in the hash table for each case specifically. Replace all calls of virHashCreate with virHashNew which has a pre-set size and remove virHashCreate completely. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
* conf: nwfilter: Replace 'virNWFilterHashTableCreate' with 'virHashNew'Peter Krempa2020-10-221-1/+1
| | | | | | | | Export the freeing function rather than having a wrapper for the hash creation function. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
* util: virhash: Remove virHashTableSizePeter Krempa2020-10-221-1/+0
| | | | | | | | It's used only in one place in tests which isn't even automatically evaluated. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
* util: remove unused function virPCIGetSysfsFile()Laine Stump2020-10-211-1/+0
| | | | | | Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
* util: support device stats collection for <interface type='hostdev'>zhenwei pi2020-10-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | libvirt can retrieve traffic stats for emulated interfaces that are backed by tap or macvtap devices, but this information wasn't available for hostdev interfaces (those that are implemented by assigning an SR-IOV VF device to a guest using vfio): #virsh domifstat instance --interface=52:54:00:2d:b2:35 error: Failed to get interface stats instance 52:54:00:2d:b2:35 error: internal error: Interface name not provided For some SR-IOV VF devices this information is available via the netlink VFINFO_LIST request/response, and that is what this patch uses to implement stats retrieval for VF. Not that this is dependent on support in the PF driver - for example, the Mellanox ConnectX-4 Lx (mlx5) driver reports usable stats, while Intel 82599 (ixgbe) and 82576 (igb) just report all stats as 0. (this is the same result as "ip -s link show"). Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> Reviewed-by: Laine Stump <laine@redhat.com>
* virnetdev: Introduce virNetDevSetRootQDisc()Michal Privoznik2020-10-131-0/+1
| | | | | | | | | | This helper changes the root qdisc on given interface. Ideally, it would be written using netlink but my attempts to write the code were not successful and thus I've fallen back to virCommand() + tc. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
* bhyve: implement virtio-9p supportRoman Bogorodskiy2020-10-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recently virtio-9p support was added to bhyve. On the host side it looks this way: bhyve .... -s 25:0,virtio-9p,sharename=/path/to/shared/dir It could also have ",ro" suffix to make share read-only. In the Linux guest, this share is mounted with: mount -t 9p sharename /mnt/sharename In the guest user will see the same permissions and ownership information for this directory as on the host. No uid/gid remapping is supported, so those could resolve to wrong user or group names. The same applies to the other side: chowning/chmodding in the guest will set specified ownership and permissions on the host. In libvirt domain XML it's modeled using the 'filesystem' element: <filesystem type='mount'> <source dir='/path/to/shared/dir'/> <target dir='sharename'/> </filesystem> Optional 'readonly' sub-element enables read-only mode. Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* util: delete VIR_ALLOC and VIR_ALLOC_NJán Tomko2020-10-081-2/+0
| | | | | Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
* util: virbitmap: Remove virBitmapCopyPeter Krempa2020-10-051-1/+0
| | | | | | | The function is now unused. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* util: bitamp: Remove virBitmapNewEmptyPeter Krempa2020-10-051-1/+0
| | | | | | | It can be replaced by virBitmapNew(0). Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* util: bitmap: Remove virBitmapNewQuietPeter Krempa2020-10-051-1/+0
| | | | | | | | | We no longer report any errors so all callers can be replaced by virBitmapNew. Additionally virBitmapNew can't return NULL now so error handling is not necessary. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* conf: eliminate virDomainNetDefClear()Laine Stump2020-10-011-1/+0
| | | | | | | | This function is no longer used anywhere except virDomainNetDefFree(), so just inline its contents there. Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* virDomainNetFindIdx: add support for CCW addressesCornelia Huck2020-09-241-0/+1
| | | | | | | | | Allow to match with CCW addresses in addition to PCI addresses (and MAC addresses). Signed-off-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
* conf, qemu: move qemuDomainNVDimmAlignSizePseries to domain_conf.cDaniel Henrique Barboza2020-09-231-0/+1
| | | | | | | | | | | We'll use the auto-alignment function during parse time, in domain_conf.c. Let's move the function to that file, renaming it to virDomainNVDimmAlignSizePseries(). This will also make it clearer that, although QEMU is the only driver that currently supports it, pSeries NVDIMM restrictions aren't tied to QEMU. Reviewed-by: Andrea Bolognani <abologna@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
* bhyve: support parsing fbuf PCI deviceFabian Freyer2020-09-221-0/+1
| | | | | | | | | | | | | | | | | Add a new helper function, bhyveParsePCIFbuf, to parse the bhyve-argv parameters for a frame-buffer device to <graphics/> and <video/> definitions. For now, only the listen address, port, and vga mode are detected. Unsupported parameters are silently skipped. This involves upgrading the private API to expose the virDomainGraphicsDefNew helper function, which is used by bhyveParsePCIFbuf. Signed-off-by: Fabian Freyer <fabian.freyer@physik.tu-berlin.de> Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
* drop libdbus from libvirtPavel Hrdina2020-09-171-17/+0
| | | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* util: introduce helpers for GLib DBus implementationPavel Hrdina2020-09-171-0/+14
| | | | | | | | | | | | | | | | | | | With libdbus our wrappers had a special syntax to create the DBus messages by defining the DBus message signature followed by list of arguments providing data based on the signature. There will be no similar helper with GLib implementation as they provide same functionality via GVariant APIs. The syntax is slightly different mostly for how arrays, variadic types and dictionaries are created/parsed. Additional difference is that with GLib DBus everything is wrapped in extra tuple (struct). For more details refer to the documentation [1]. [1] <https://developer.gnome.org/glib/stable/gvariant-format-strings.html> Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* node_device: mdev vfio-ccw supportBoris Fiuczynski2020-09-151-0/+1
| | | | | | | | | Allow vfio-ccw mdev devices to be created besides vfio-pci mdev devices as well. Reviewed-by: Erik Skultety <eskultet@redhat.com> Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com> Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
* util: remove unused virNetDevIPWaitDadFinish()Laine Stump2020-09-101-1/+0
| | | | | | | | Since we no longer need to wait for IPv6 DAD to complete, we never call this function. Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* util: add stop/drain functions to thread poolNikolay Shirokovskiy2020-09-071-0/+2
| | | | | | | | | Stop just send signal for threads to exit when they finish with current task. Drain waits when all threads will finish. Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
* libvirt: add stateShutdownPrepare/stateShutdownWait to driversNikolay Shirokovskiy2020-09-071-0/+2
| | | | | | | | | | stateShutdownPrepare is supposed to inform driver that it will be closed soon so that the driver can prepare and finish all background threads quickly on stateShutdownWait call. Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
* tests: Add simple test for virDomainMigrateCheckNotLocalMartin Kletzander2020-09-041-0/+1
| | | | | | | | | For this we need to make the function accessible (at least privately). The behaviour will change in following patches and the test helps explaining the change. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
* util: assign tap device names using a monotonically increasing integerLaine Stump2020-09-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When creating a standard tap device, if provided with an ifname that contains "%d", rather than taking that literally as the name to use for the new device, the kernel will instead use that string as a template, and search for the lowest number that could be put in place of %d and produce an otherwise unused and unique name for the new device. For example, if there is no tap device name given in the XML, libvirt will always send "vnet%d" as the device name, and the kernel will create new devices named "vnet0", "vnet1", etc. If one of those devices is deleted, creating a "hole" in the name list, the kernel will always attempt to reuse the name in the hole first before using a name with a higher number (i.e. it finds the lowest possible unused number). The problem with this, as described in the previous patch dealing with macvtap device naming, is that it makes "immediate reuse" of a newly freed tap device name *much* more common, and in the aftermath of deleting a tap device, there is some other necessary cleanup of things which are named based on the device name (nwfilter rules, bandwidth rules, OVS switch ports, to name a few) that could end up stomping over the top of the setup of a new device of the same name for a different guest. Since the kernel "create a name based on a template" functionality for tap devices doesn't exist for macvtap, this patch for standard tap devices is a bit different from the previous patch for macvtap - in particular there was no previous "bitmap ID reservation system" or overly-complex retry loop that needed to be removed. We simply find and unused name, and pass that name on to the kernel instead of "vnet%d". This counter is also wrapped when either it gets to INT_MAX or if the full name would overflow IFNAMSIZ-1 characters. In the case of "vnet%d" and a 32 bit int, we would reach INT_MAX first, but possibly someday someone will change the name from vnet to something else. (NB: It is still possible for a user to provide their own parameterized template name (e.g. "mytap%d") in the XML, and libvirt will just pass that through to the kernel as it always has.) Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* util: replace macvtap name reservation bitmap with a simple counterLaine Stump2020-09-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There have been some reports that, due to libvirt always trying to assign the lowest numbered macvtap / tap device name possible, a new guest would sometimes be started using the same tap device name as previously used by another guest that is in the process of being destroyed *as the new guest is starting. In some cases this has led to, for example, the old guest's qemuProcessStop() code deleting a port from an OVS switch that had just been re-added by the new guest (because the port name is based on only the device name using the port). Similar problems can happen (and I believe have) with nwfilter rules and bandwidth rules (which are both instantiated based on the name of the tap device). A couple patches have been previously proposed to change the ordering of startup and shutdown processing, or to put a mutex around everything related to the tap/macvtap device name usage, but in the end no matter what you do there will still be possible holes, because the device could be deleted outside libvirt's control (for example, regular tap devices are automatically deleted when the qemu process terminates, and that isn't always initiated by libvirt but could instead happen completely asynchronously - libvirt then has no control over the ordering of shutdown operations, and no opportunity to protect it with a mutex.) But this only happens if a new device is created at the same time as one is being deleted. We can effectively eliminate the chance of this happening if we end the practice of always looking for the lowest numbered available device name, and instead just keep an integer that is incremented each time we need a new device name. At some point it will need to wrap back around to 0 (in order to avoid the IFNAMSIZ 15 character limit if nothing else), and we can't guarantee that the new name really will be the *least* recently used name, but "math" suggests that it will be *much* less common that we'll try to re-use the *most* recently used name. This patch implements such a counter for macvtap/macvlan, replacing the existing, and much more complicated, "ID reservation" system. The counter is set according to whatever macvtap/macvlan devices are already in use by guests when libvirtd is started, incremented each time a new device name is needed, and wraps back to 0 when either INT_MAX is reached, or when the resulting device name would be longer than IFNAMSIZ-1 characters (which actually is what happens when the template for the device name is "maccvtap%d"). The result is that no macvtap name will be re-used until the host has created (and possibly destroyed) 99,999,999 devices. Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* bhyve: allow to specify host sound deviceRoman Bogorodskiy2020-08-251-0/+1
| | | | | | | | Allow to map sound playback and recording devices to host devices using "<audio type='oss'/>" OSS audio backend. Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
* conf: allow to map sound device to host deviceRoman Bogorodskiy2020-08-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new device element "<audio>" which allows to map guest sound device specified using the "<sound>" element to specific audio backend. Example: <sound model='ich7'> <audio id='1'/> </sound> <audio id='1' type='oss'> <input dev='/dev/dsp0'/> <output dev='/dev/dsp0'/> </audio> This block maps to OSS audio backend on the host using /dev/dsp0 device for both input (recording) and output (playback). OSS is the only backend supported so far. Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
* qemu: Move virQEMUFileOpenAs to qemu_domain.cPeter Krempa2020-08-241-1/+0
| | | | | | | | | | | | | Commit 43620689794507308fbd3def6992a68ee2f8fa97 moved the function to util/virqemu.c which is compiled also on win32 and geteuid()/getegid() doesn't exist there. Move it to qemu_domain.c which is compiled only when the qemu driver is enabled. Originally I didn't want to put it here as qemu_domain.c is a code dump for helper functions but this is the least invasive fix. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
* qemuOpenFileAs: Move into util/virqemu.cPeter Krempa2020-08-241-0/+1
| | | | | Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* util: delete virStringListFreeJán Tomko2020-08-031-1/+0
| | | | | | | | Now that everything uses g_strfreev, this function is no longer needed. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
* util: virlog: unexport virLogVMessageJán Tomko2020-08-031-1/+0
| | | | | | | | | | | | Last usage out of virlog.c was removed by commit 91268c715cf0293f0751de0450e4d0c06bea18d8 node_device_udev: remove deprecated logging function Also drop the virbuffer.h include - it seems it was never used for anything else than the transitive stdarg.h include. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
* util: Get rid of virFileFlock()Martin Kletzander2020-08-031-1/+0
| | | | | | | | | | | | | It was created to get rid of conditional compilation in the resctrl code and make it usable anywhere else. However this is not something that is going to be used in other places because it is not portable and resctrl is just very specific in this regard. And there is no reason why there could not be a preprocessor conditional in the resctrl code. Also the interface of virFileFlock() was very ambiguous which lead to some issues. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* qemu: add support for shmem-{plain, doorbell} roleWang Xin2020-08-031-0/+2
| | | | | | | | | | | | | | | | | | | Role(master or peer) controls how the domain behaves on migration. For more details about migration with ivshmem, see https://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/system/ivshmem.rst;hb=HEAD It's a optional attribute in libvirt, and qemu will choose default role for ivshmem device if the user is not specified. With device property 'role', the value can be 'master' or 'peer'. - 'master' (means 'master=on' in qemu), the guest will copy the shared memory on migration to the destination host. - 'peer' (means 'master=off' in qemu), the migration is disabled. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Signed-off-by: Yang Hang <yanghang44@huawei.com> Signed-off-by: Wang Xin <wangxinxin.wang@huawei.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
* util: add a helper method for controlling the COW flag on btrfsDaniel P. Berrangé2020-07-231-0/+1
| | | | | | | | | | | | | | | | btrfs defaults to performing copy-on-write for files. This is often undesirable for VM images, so we need to be able to control whether this behaviour is used. The virFileSetCOW() will allow for this. We use a tristate, since out of the box, we want the default behaviour attempt to disable cow, but only on btrfs, silently do nothing on non-btrfs. If someone explicitly asks to disable/enable cow, then we want to raise a hard error on non-btrfs. Reviewed-by: Neal Gompa <ngompa13@gmail.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* security: Reintroduce virSecurityManager{Set,Restore}SavedStateLabelMichal Privoznik2020-07-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | These APIs were removed/renamed in v6.5.0-rc1~142 and v6.5.0-rc1~141 because they deemed unused. And if it wasn't for the RFE [1] things would stay that way. The RFE asks for us to not change DAC ownership on the file a domain is restoring from. We have been doing that for ages (if not forever), nevertheless it's annoying because if the restore file is on an NFS remembering owner won't help - NFS doesn't support XATTRs yet. But more importantly, there is no need for us to chown() the file because when restoring the domain the file is opened and the FD is then passed to QEMU. Therefore, we really need only to set SELinux and AppArmor. This reverts bd22eec903976c5c51b1d00e335c315699e5acd6. This partially reverts 4ccbd207f213066c000f43eb544eb00ec745023b. The difference to the original code is that secdrivers are now not required to provide dummy implementation to avoid virReportUnsupportedError(). The callback is run if it exists, if it doesn't zero is returned without any error. 1: https://bugzilla.redhat.com/show_bug.cgi?id=1851016 Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>