]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
10 years agoqemu: Disallow NUMA/network tuning for session mode
Erik Skultety [Wed, 1 Oct 2014 12:57:32 +0000 (14:57 +0200)]
qemu: Disallow NUMA/network tuning for session mode

Tuning NUMA or network interface parameters requires root
privileges to manage cgroups. Thus an attempt to set some of these
parameters in session mode on a running domain should be invalid
followed by an error. An example might be memory tuning which raises
an error in such case.

The following behavior in session mode will be present after applying
this patch:

  Tuning  |      SET      |   GET  |
----------|---------------|--------|
NUMA      | shut off only | always |
Memory    |     never     | never  |
Interface |     never     | always |

Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1126762

10 years agoqemu: migration: Make check for empty hook XML robust
Peter Krempa [Wed, 22 Oct 2014 09:27:36 +0000 (11:27 +0200)]
qemu: migration: Make check for empty hook XML robust

Also consider whitespace only strings returned from the hook as empty
result.

10 years agoqemu: restore: Fix restoring of VM when the restore hook returns empty XML
Peter Krempa [Wed, 22 Oct 2014 09:22:08 +0000 (11:22 +0200)]
qemu: restore: Fix restoring of VM when the restore hook returns empty XML

The documentation for the restore hook states that returning an empty
XML is equivalent with copying the input. There was a bug in the code
checking the returned string by checking the string instead of the
contents. Use the new helper to check if the string is empty.

10 years agoutil: string: Add helper to check whether string is empty
Peter Krempa [Wed, 22 Oct 2014 08:26:42 +0000 (10:26 +0200)]
util: string: Add helper to check whether string is empty

The helper checks whether a string contains only whitespace or is NULL.
This will be helpful to skip cases where a user string is optional, but
may be provided empty with the same meaning.

10 years agodoc: HACKING: Regenerate after recent change
Peter Krempa [Wed, 22 Oct 2014 15:50:08 +0000 (17:50 +0200)]
doc: HACKING: Regenerate after recent change

10 years agoAdd support for /run/initctl
Rick Harris [Wed, 22 Oct 2014 12:09:49 +0000 (13:09 +0100)]
Add support for /run/initctl

Newer versions of Debian use '/run/initctl' instead of '/dev/initctl'.
This patch updates the code to search for the FIFO from a list of
well-known locations.

10 years agodocs: fix an improper git browsable address
Chen Hanxiao [Wed, 22 Oct 2014 09:38:33 +0000 (17:38 +0800)]
docs: fix an improper git browsable address

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
10 years agoFix cast errors with clang
Roman Bogorodskiy [Tue, 21 Oct 2014 14:22:36 +0000 (18:22 +0400)]
Fix cast errors with clang

Build with clang fails with:

  CC       util/libvirt_util_la-virsocketaddr.lo
util/virsocketaddr.c:904:17: error: cast from 'struct sockaddr *' to
'struct sockaddr_in *' increases required alignment from 1 to 4
[-Werror,-Wcast-align]
        inet4 = (struct sockaddr_in*) res->ai_addr;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
util/virsocketaddr.c:909:17: error: cast from 'struct sockaddr *' to
'struct sockaddr_in6 *' increases required alignment from 1 to 4
[-Werror,-Wcast-align]
        inet6 = (struct sockaddr_in6*) res->ai_addr;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

Fix that by replacing virSocketAddrParseInternal() call with
virSocketAddrParse() in the virSocketAddrIsNumericLocalhost() function.
virSocketAddrParse stores an address in virSocketAddr.
virSocketAddr uses a union to store an address, so it doesn't
need casting.

10 years agodocs: Mention repository locations in contributor guidelines
Martin Kletzander [Tue, 21 Oct 2014 10:20:56 +0000 (12:20 +0200)]
docs: Mention repository locations in contributor guidelines

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: unref cfg after TerminateMachine has been called
Martin Kletzander [Tue, 21 Oct 2014 09:44:13 +0000 (11:44 +0200)]
qemu: unref cfg after TerminateMachine has been called

Commit 4882618ed13b469d92fa8b2b4a158fdb17dbe9f1 added the code that
requests driver cfg, but forgot to unref it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: x86_64 is good enough for i686
Lubomir Rintel [Thu, 16 Oct 2014 19:28:00 +0000 (21:28 +0200)]
qemu: x86_64 is good enough for i686

virt-manager on Fedora sets up i686 hosts with "/usr/bin/qemu-kvm" emulator,
which in turn unconditionally execs qemu-system-x86_64 querying capabilities
then fails:

Error launching details: invalid argument: architecture from emulator 'x86_64' doesn't match given architecture 'i686'

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/engine.py", line 748, in _show_vm_helper
    details = self._get_details_dialog(uri, vm.get_connkey())
  File "/usr/share/virt-manager/virtManager/engine.py", line 726, in _get_details_dialog
    obj = vmmDetails(conn.get_vm(connkey))
  File "/usr/share/virt-manager/virtManager/details.py", line 399, in __init__
    self.init_details()
  File "/usr/share/virt-manager/virtManager/details.py", line 784, in init_details
    domcaps = self.vm.get_domain_capabilities()
  File "/usr/share/virt-manager/virtManager/domain.py", line 518, in get_domain_capabilities
    self.get_xmlobj().os.machine, self.get_xmlobj().type)
  File "/usr/lib/python2.7/site-packages/libvirt.py", line 3492, in getDomainCapabilities
    if ret is None: raise libvirtError ('virConnectGetDomainCapabilities() failed', conn=self)
libvirtError: invalid argument: architecture from emulator 'x86_64' doesn't match given architecture 'i686'

Journal:

Oct 16 21:08:26 goatlord.localdomain libvirtd[1530]: invalid argument: architecture from emulator 'x86_64' doesn't match given architecture 'i686'

10 years agoqemu: move setting emulatorpin ahead of monitor showing up
Zhou yimin [Thu, 16 Oct 2014 14:18:48 +0000 (22:18 +0800)]
qemu: move setting emulatorpin ahead of monitor showing up

If VM is configured with many devices(including passthrough devices)
and large memory, libvirtd will take seconds(in the worst case) to
wait for monitor. In this period the qemu process may run on any
PCPU though I intend to pin emulator to the specified PCPU in xml
configuration.

Actually qemu process takes high cpu usage during vm startup.
So this is not the strict CPU isolation in this case.

Signed-off-by: Zhou yimin <zhouyimin@huawei.com>
10 years agodocs: apps: Update references to virt-p2v and virt-v2v.
Richard W.M. Jones [Sat, 18 Oct 2014 14:20:26 +0000 (15:20 +0100)]
docs: apps: Update references to virt-p2v and virt-v2v.

These tools have been rewritten upstream, so you don't need to link to
the old tools, link to the new ones and mention they are part of
libguestfs.

Also remove the link to "Poor man's P2V".  There's no real reason to
use that technique any longer since the rewritten tools are simple,
fast and highly capable.

10 years agotests: fix incorrect caps for shmem-invalid-size, shmem-small-size
Maxime Leroy [Fri, 17 Oct 2014 16:05:38 +0000 (18:05 +0200)]
tests: fix incorrect caps for shmem-invalid-size, shmem-small-size

VIR_TEST_DEBUG=2 ./qemuxml2argvtest generates the following output:

409) QEMU XML-2-ARGV shmem-invalid-size
... Got expected error: unsupported configuration: ivshmem device is not \
 supported with this QEMU binary
OK
410) QEMU XML-2-ARGV shmem-small-size
... Got expected error: unsupported configuration: ivshmem device is not \
supported with this QEMU binary
OK

We should have:

409) QEMU XML-2-ARGV shmem-invalid-size
... Got expected error: XML error: shmem size must be a power of two
OK
410) QEMU XML-2-ARGV shmem-small-size
... Got expected error: XML error: shmem size must be at least 1 MiB
OK

This commit fixes the issue by providing QEMU_CAPS_DEVICE_IVSHMEM caps
for shmem-invalid-size, shmem-small-size test.

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
10 years agoconf: tests: fix virDomainNetDefFormat for vhost-user in client mode
Maxime Leroy [Fri, 17 Oct 2014 16:45:18 +0000 (18:45 +0200)]
conf: tests: fix virDomainNetDefFormat for vhost-user in client mode

The mode attribute is required for the source element of vhost-user.
Thus virDomainNetDefFormat should always generate a xml with it and not
only when the mode is server.

The commit fixes the issue. And it adds a vhostuser interface in
'client' mode to qemuxml2argv-net-vhostuser.(args|xml) to test this
usecase.

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
10 years agolibxl: add missing 'break' from commit 1298daca
Jim Fehlig [Thu, 16 Oct 2014 06:48:57 +0000 (00:48 -0600)]
libxl: add missing 'break' from commit 1298daca

Add missing 'break's from commit 1298daca, as noted by John Ferlan

https://www.redhat.com/archives/libvir-list/2014-October/msg00430.html

10 years agoqemu: Convert qemuDomainUpdateDeviceConfig to typecasted enum
Peter Krempa [Wed, 15 Oct 2014 10:24:02 +0000 (12:24 +0200)]
qemu: Convert qemuDomainUpdateDeviceConfig to typecasted enum

10 years agoqemu: Convert qemuDomainDetachDeviceConfig to typecasted enum
Peter Krempa [Wed, 15 Oct 2014 10:24:02 +0000 (12:24 +0200)]
qemu: Convert qemuDomainDetachDeviceConfig to typecasted enum

10 years agoqemu: Convert qemuDomainAttachDeviceConfig to typecasted enum
Peter Krempa [Wed, 15 Oct 2014 10:24:02 +0000 (12:24 +0200)]
qemu: Convert qemuDomainAttachDeviceConfig to typecasted enum

10 years agoqemu: Convert qemuDomainUpdateDeviceLive to typecasted enum
Peter Krempa [Wed, 15 Oct 2014 10:24:02 +0000 (12:24 +0200)]
qemu: Convert qemuDomainUpdateDeviceLive to typecasted enum

10 years agoqemu: Convert qemuDomainDetachDeviceLive to typecasted enum
Peter Krempa [Wed, 15 Oct 2014 10:24:02 +0000 (12:24 +0200)]
qemu: Convert qemuDomainDetachDeviceLive to typecasted enum

10 years agoconf: fix an memory leak in virSocketAddrIsNumericLocalhost()
Chen Fan [Wed, 15 Oct 2014 09:36:29 +0000 (17:36 +0800)]
conf: fix an memory leak in virSocketAddrIsNumericLocalhost()

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
10 years agoconf: Move definition of virDomainParseMemory
Peter Krempa [Mon, 29 Sep 2014 15:38:18 +0000 (17:38 +0200)]
conf: Move definition of virDomainParseMemory

Shove it to the top of the file so that it can be reused earlier.

10 years agoImplement empty post parse callbacks for all drivers
Peter Krempa [Mon, 6 Oct 2014 15:28:46 +0000 (17:28 +0200)]
Implement empty post parse callbacks for all drivers

To allow easy implementation of a callback check this patch adds empty
post parse callbacks to drivers that were missing them.

10 years agoqemu: monitor: Add functions for object hot-add/remove
Peter Krempa [Tue, 23 Sep 2014 11:25:25 +0000 (13:25 +0200)]
qemu: monitor: Add functions for object hot-add/remove

To allow live modification of device backends in qemu libvirt needs to
be able to hot-add/remove "objects". Add monitor backend functions to
allow this.

This function will be used for hot-add/remove of RNG backends,
IOThreads, memory backing objects, etc.

10 years agoutil: json: Add option to skip adding a JSON object if it is NULL
Peter Krempa [Wed, 15 Oct 2014 07:41:49 +0000 (09:41 +0200)]
util: json: Add option to skip adding a JSON object if it is NULL

Add a new option specifier that will optionally add a JSON key=value pair
containing a nested object if the added object isn't NULL.

10 years agoutil: json: Improve handling and docs for adding JSON objects
Peter Krempa [Tue, 23 Sep 2014 09:48:08 +0000 (11:48 +0200)]
util: json: Improve handling and docs for adding JSON objects

The JSON structure constructor has an option to add JSON arrays to the
constructed object. The description is inaccurate as it can add any json
object even a dict. Change the docs to cover this option and reject
adding NULL objects.

10 years agoutil: json: Split out code to create json value objects
Peter Krempa [Mon, 22 Sep 2014 14:35:02 +0000 (16:35 +0200)]
util: json: Split out code to create json value objects

Our qemu monitor code has a converter from key-value pairs to a json
value object. I want to re-use the code later and having it part of the
monitor command generator is inflexible. Split it out into a separate
helper.

10 years agoqemu: hotplug: Use typecasted switch statement when plugging new devices
Peter Krempa [Mon, 22 Sep 2014 11:42:02 +0000 (13:42 +0200)]
qemu: hotplug: Use typecasted switch statement when plugging new devices

10 years agoconf: Add compile time check that devices were checked for ABI stability
Peter Krempa [Mon, 29 Sep 2014 16:43:34 +0000 (18:43 +0200)]
conf: Add compile time check that devices were checked for ABI stability

As in the device info iterator add a switch that will force the compiler
to check that new device types are added to the ABI stability checker.

10 years agoconf: shmem: Add ABI stability check
Peter Krempa [Tue, 7 Oct 2014 12:26:32 +0000 (14:26 +0200)]
conf: shmem: Add ABI stability check

Although the device will probably inhibit migration add checks to make
sure that the configuration change gets caught.

10 years agoconf: Improve adding of new address types
Peter Krempa [Tue, 7 Oct 2014 15:21:45 +0000 (17:21 +0200)]
conf: Improve adding of new address types

Use typecasted switch statement and note the type used to select the
address type in a comment.

10 years agoCleanup maintainers list
Jiri Denemark [Tue, 14 Oct 2014 21:03:13 +0000 (23:03 +0200)]
Cleanup maintainers list

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agolibvirt: Document UNDEFINE_NVRAM in UndefineFlags doc
Cole Robinson [Tue, 14 Oct 2014 09:27:33 +0000 (11:27 +0200)]
libvirt: Document UNDEFINE_NVRAM in UndefineFlags doc

10 years agoconf: fix a wrong comment in virSocketAddrNumericFamily()
Chen Fan [Wed, 15 Oct 2014 07:50:09 +0000 (15:50 +0800)]
conf: fix a wrong comment in virSocketAddrNumericFamily()

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
10 years agoconf: Check whether migration_address is localhost
Chen Fan [Tue, 7 Oct 2014 04:07:32 +0000 (12:07 +0800)]
conf: Check whether migration_address is localhost

When enabling the migration_address option, by default it is
set to "127.0.0.1", but it's not a valid address for migration.
so we should add verification and set the default migration_address
to "0.0.0.0".

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agoconf: add check if migration_host is a localhost address
Chen Fan [Tue, 7 Oct 2014 04:07:31 +0000 (12:07 +0800)]
conf: add check if migration_host is a localhost address

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agomigration: add migration_host support for IPv6 address without brackets
Chen Fan [Tue, 7 Oct 2014 04:07:30 +0000 (12:07 +0800)]
migration: add migration_host support for IPv6 address without brackets

if specifying migration_host to an Ipv6 address without brackets,
it was resolved to an incorrect address, such as:
    tcp:2001:0DB8::1428:4444,
but the correct address should be:
    tcp:[2001:0DB8::1428]:4444
so we should add brackets when parsing it.

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
10 years agoIntroduce virStringStripIPv6Brackets
Ján Tomko [Tue, 7 Oct 2014 15:27:40 +0000 (17:27 +0200)]
Introduce virStringStripIPv6Brackets

Helper function to strip the brackets from an IPv6 address.
Tested by viruritest.

10 years agovirsh: domain: Use global constant for XML file size limit
Peter Krempa [Tue, 14 Oct 2014 08:04:31 +0000 (10:04 +0200)]
virsh: domain: Use global constant for XML file size limit

Few places still used hardcoded limit for maximum XML size for commands
that accept XML files. The hardcoded limits ranged from 8k to 1M. Use
VSH_MAX_XML_FILE to express this limit in a unified way. This will bump
the limit for the commands that used hardcoded string lengths to 10M.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1152427

10 years agovirsh: man: Fix description of --live/--config usage
Peter Krempa [Tue, 14 Oct 2014 07:41:24 +0000 (09:41 +0200)]
virsh: man: Fix description of --live/--config usage

dommemstat and blkdeviotune's man page incorrectly stated the usage of
--live and --config.

10 years agoconf: improve the comments for "xmlopt"
Wang Rui [Sat, 11 Oct 2014 06:09:22 +0000 (14:09 +0800)]
conf: improve the comments for "xmlopt"

Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
10 years agoFix leftover typo '&' -> '&&'
Martin Kletzander [Thu, 9 Oct 2014 08:00:05 +0000 (10:00 +0200)]
Fix leftover typo '&' -> '&&'

The actual origin of this so called typo are two commits.  The first one
was commit 72f8a7f that came up with the following condition:

if ((i == 8) & (flags & VIR_QEMU_PROCESS_KILL_FORCE))

Fortunately this succeeded thanks to bool being (int)1 and
VIR_QEMU_PROCESS_KILL_FORCE having the value of 1 << 0.  The check was
then moved and altered in 8fd38231179c394f07d8a26bcbf3a0faa5eeaf24 to
current state:

if ((i == 50) & force)

that will work again (both sides of '&' being booleans), but since this
was missed so many times, it may pose a problem in the future in case it
gets copy-pasted again.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agolibxl: Implement basic video device selection
Stefan Bader [Tue, 1 Jul 2014 07:58:18 +0000 (09:58 +0200)]
libxl: Implement basic video device selection

This started as an investigation into an issue where libvirt (using the
libxl driver) and the Xen host, like an old couple, could not agree on
who is responsible for selecting the VNC port to use.

Things usually (and a bit surprisingly) did work because, just like that
old couple, they had the same idea on what to do by default. However it
was possible that this ended up in a big argument.

The problem is that display information exists in two different places:
in the vfbs list and in the build info. And for launching the device model,
only the latter is used. But that never gets initialized from libvirt. So
Xen allows the device model to select a default port while libvirt thinks
it has told Xen that this is done by libvirt (though the vfbs config).

While fixing that, I made a stab at actually evaluating the configuration
of the video device. So that it is now possible to at least decide between
a Cirrus or standard VGA emulation and to modify the VRAM within certain
limits using libvirt.

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agolibxl: Add function to determine device model type
Jim Fehlig [Fri, 19 Sep 2014 16:32:43 +0000 (10:32 -0600)]
libxl: Add function to determine device model type

This patch introduces a function to detect whether the specified
emulator is QEMU_XEN or QEMU_XEN_TRADITIONAL.  Detection is based on the
string "Options specific to the Xen version:" in '$qemu -help' output.
AFAIK, the only qemu containing that string in help output is the
old Xen fork (aka qemu-dm).

Note:
QEMU_XEN means a qemu that contains support for Xen.

QEMU_XEN_TRADITIONAL means Xen's old forked qemu 0.10.2

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agoXen: Defer setting default vram value to Xen drivers
Jim Fehlig [Fri, 19 Sep 2014 16:13:40 +0000 (10:13 -0600)]
Xen: Defer setting default vram value to Xen drivers

Allow the Xen drivers to determine default vram values.  Sane
default vaules depend on the device model being used, so the
drivers are in the best position to determine the defaults.

For the legacy xen driver, it is best to maintain the existing
logic for setting default vram values to ensure there are no
regressions.  The libxl driver currently does not support
configuring a video device.  Support will be added in a
subsequent patch, where the benefit of this change will be
reaped.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agolibxl: Copy user-specified keymap to libxl build info struct
Jim Fehlig [Fri, 19 Sep 2014 16:38:37 +0000 (10:38 -0600)]
libxl: Copy user-specified keymap to libxl build info struct

Commit 4dfc34c3 missed copying the user-specified keymap to
libxl_domain_build_info struct when creating a VFB device.

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agoqemu: save domain status after set domain's numa parameters
Shanzhi Yu [Mon, 6 Oct 2014 15:00:00 +0000 (17:00 +0200)]
qemu: save domain status after set domain's numa parameters

After set domain's numa parameters for running domain, save the change,
save the change into live xml is needed to survive restarting the libvirtd,
same story with bug 1146511; meanwihle add call
qemuDomainObjBeginJob/qemuDomainObjEndJob in qemuDomainSetNumaParameters

Signed-off-by: Shanzhi Yu <shyu@redhat.com>
10 years agoqemu: call qemuDomainObjBeginJob/qemuDomainObjEndJob in qemuDomainSetInterfaceParameters
Shanzhi Yu [Mon, 6 Oct 2014 15:00:00 +0000 (17:00 +0200)]
qemu: call qemuDomainObjBeginJob/qemuDomainObjEndJob in qemuDomainSetInterfaceParameters

add call qemuDomainObjBeginJob/qemuDomainObjEndJob in
qemuDomainSetInterfaceParameters

Signed-off-by: Shanzhi Yu <shyu@redhat.com>
10 years agoqemu: save domain status after set the blkio parameters
Shanzhi Yu [Mon, 6 Oct 2014 15:00:00 +0000 (17:00 +0200)]
qemu: save domain status after set the blkio parameters

After set the blkio parameters for running domain, save the change into
live xml is needed to survive restarting the libvirtd, same story with
bug 1146511, meanwhile add call qemuDomainObjBeginJob/qemuDomainObjEndJob
in qemuDomainSetBlkioParameters

Signed-off-by: Shanzhi Yu <shyu@redhat.com>
10 years agoFix build-time pkg-config files in VPATH
Jiri Denemark [Tue, 7 Oct 2014 13:22:52 +0000 (15:22 +0200)]
Fix build-time pkg-config files in VPATH

The pkg-config files in src/ make it pretty easy to build language
bindings against an uninstalled libvirt, however, they don't work with
VPATH builds. The reason is that all *-api.xml files are generated in
source rather than build directory.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agosecurity_selinux: Don't relabel /dev/net/tun
Michal Privoznik [Tue, 7 Oct 2014 14:22:17 +0000 (16:22 +0200)]
security_selinux: Don't relabel /dev/net/tun

https://bugzilla.redhat.com/show_bug.cgi?id=1147057

The code for relabelling the TAP FD is there due to a race. When
libvirt creates a /dev/tapN device it's labeled as
'system_u:object_r:device_t:s0' by default. Later, when
udev/systemd reacts to this device, it's relabelled to the
expected label 'system_u:object_r:tun_tap_device_t:s0'. Hence, we
have a code that relabels the device, to cut the race down. For
more info see ae368ebfcc4.

But the problem is, the relabel function is called on all TUN/TAP
devices. Yes, on /dev/net/tun too. This is however a special kind
of device - other processes uses it too. We shouldn't touch it's
label then.

Ideally, there would an API in SELinux that would label just the
passed FD and not the underlying path. That way, we wouldn't need
to care as we would be not labeling /dev/net/tun but the FD
passed to the domain. Unfortunately, there's no such API so we
have to workaround until then.

Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoFix build with older libcurl
Ján Tomko [Wed, 8 Oct 2014 07:13:40 +0000 (09:13 +0200)]
Fix build with older libcurl

Add ATTRIBUTE_UNUSED marker to the unused timeout_ms option
in esxVI_MultiCURL_TimerCallback.

Introduced by commit 125007d.

10 years agoesx: Implement virDomainScreenshot using libcurl stream driver
Matthias Bolte [Sun, 30 Mar 2014 18:45:07 +0000 (20:45 +0200)]
esx: Implement virDomainScreenshot using libcurl stream driver

This implementation uses the https://esx-server/screen?id=<id> way to get
a screenshot of a running domain. Compared to the CreateScreenshot_Task
way this works since ESX 2.5 while CreateScreenshot_Task was added in
version 4.0.

The newly added libcurl stream driver is used to directly provide the
downloaded data without saving it to a temporary file first.

10 years agoesx: Add libcurl based stream driver
Matthias Bolte [Sun, 30 Mar 2014 18:37:00 +0000 (20:37 +0200)]
esx: Add libcurl based stream driver

This allows to implement libvirt functions that use streams, such as
virDoaminScreenshot, without the need to store the downloaded data in
a temporary file first. The stream driver directly interacts with
libcurl to send and receive data.

The driver uses the libcurl multi interface that allows to do a transfer
in multiple curl_multi_perform() calls. The easy interface would do the
whole transfer in a single curl_easy_perform() call. This doesn't work
with the libvirt stream API that is driven by multiple calls to the
virStreamSend() and virStreamRecv() functions.

The curl_multi_wait() function is used to do blocking operations. But it
was added in libcurl 7.28.0. For older versions it is emulated using the
socket callback of the multi interface.

The current driver only supports blocking operations. There is already
some code in place for non-blocking mode but it is not complete.

10 years agoqemu: change macvtap device MAC address in response to NIC_RX_FILTER_CHANGED
Laine Stump [Wed, 24 Sep 2014 08:30:04 +0000 (04:30 -0400)]
qemu: change macvtap device MAC address in response to NIC_RX_FILTER_CHANGED

This patch fills in the functionality of
processNicRxFilterChangedEvent().  It now checks if it is appropriate
to respond to the NIC_RX_FILTER_CHANGED event (based on device type
and configuration) and takes appropriate action. Currently it checks
if the guest interface has been configured with
trustGuestRxFilters='yes', and if the host side device is macvtap. If
so, and the MAC address on the guest has changed, the MAC address of
the macvtap device is changed to match.

The result of this is that networking from the guest will continue to
work if the mac address of a macvtap-connected network device is
changed from within the guest, as long as trustGuestRxFilters='yes'
(previously changing the MAC address in the guest would break
networking).

10 years agoqemu: setup infrastructure to handle NIC_RX_FILTER_CHANGED event
Laine Stump [Wed, 17 Sep 2014 17:07:50 +0000 (13:07 -0400)]
qemu: setup infrastructure to handle NIC_RX_FILTER_CHANGED event

NIC_RX_FILTER_CHANGED is sent by qemu any time a NIC driver in the
guest modified the NIC's RX Filter (for example, if the MAC address of
the NIC is changed by the guest).

This patch doesn't do anything useful with that event; it just sets up
all the plumbing to get news of the event into a worker thread with
all proper locking/reference counting, and provide an easy place to
add in desired functionality.

See src/qemu/EVENTHANDLERS.txt for information/instructions on adding
a libvirt-internal handler for a qemu event (using
NIC_RX_FILTER_CHANGED as an example).

10 years agoqemu: add short document on qemu event handlers
Laine Stump [Thu, 2 Oct 2014 15:46:30 +0000 (11:46 -0400)]
qemu: add short document on qemu event handlers

This text was in the commit log for the patch that added the event
handler for NIC_RX_FILTER_CHANGED, and John Ferlan expressed a desire
that the information not be "lost", so I've put it into a file in the
qemu directory, hoping that it might catch the attention of future
writers of handlers for qemu events.

10 years agoqemu: qemuMonitorQueryRxFilter - retrieve guest netdev rx-filter
Laine Stump [Mon, 22 Sep 2014 16:19:41 +0000 (12:19 -0400)]
qemu: qemuMonitorQueryRxFilter - retrieve guest netdev rx-filter

This function can be called at any time to get the current status of a
guest's network device rx-filter. In particular it is useful to call
after libvirt recieves a NIC_RX_FILTER_CHANGED event - this event only
tells you that something has changed in the rx-filter, the details are
retrieved with the query-rx-filter monitor command (only available in
the json monitor). The command sent to the qemu monitor looks like this:

  {"execute":"query-rx-filter", "arguments": {"name":"net2"} }'

and the results will look something like this:

{
    "return": [
        {
            "promiscuous": false,
            "name": "net2",
            "main-mac": "52:54:00:98:2d:e3",
            "unicast": "normal",
            "vlan": "normal",
            "vlan-table": [
                42,
                0
            ],
            "unicast-table": [

            ],
            "multicast": "normal",
            "multicast-overflow": false,
            "unicast-overflow": false,
            "multicast-table": [
                "33:33:ff:98:2d:e3",
                "01:80:c2:00:00:21",
                "01:00:5e:00:00:fb",
                "33:33:ff:98:2d:e2",
                "01:00:5e:00:00:01",
                "33:33:00:00:00:01"
            ],
            "broadcast-allowed": false
        }
    ],
    "id": "libvirt-14"
}

This is all parsed from JSON into a virNetDevRxFilter object for
easier consumption. (unicast-table is usually empty, but is also an
array of mac addresses similar to multicast-table).

(NB: LIBNL_CFLAGS was added to tests/Makefile.am because virnetdev.h
now includes util/virnetlink.h, which includes netlink/msg.h when
appropriate. Without LIBNL_CFLAGS, gcc can't find that file (if
libnl/netlink isn't available, LIBNL_CFLAGS will be empty and
virnetlink.h won't try to include netlink/msg.h anyway).)

10 years agoutil: define virNetDevRxFilter and basic utility functions
Laine Stump [Sat, 20 Sep 2014 18:39:44 +0000 (14:39 -0400)]
util: define virNetDevRxFilter and basic utility functions

This same structure will be used to retrieve RX filter info for
interfaces on the host via netlink messages, and RX filter info for
interfaces on the guest via the qemu "query-rx-filter" command.

10 years agonetwork: set interface actual trustGuestRxFilters from network/portgroup
Laine Stump [Tue, 23 Sep 2014 18:54:16 +0000 (14:54 -0400)]
network: set interface actual trustGuestRxFilters from network/portgroup

As is done with other items such as vlan, virtualport, and bandwidth,
set the actual trustGuestRxFilters value to be used by a domain
interface according to a merge of the same attribute in the interface,
portgroup, and network in use. the interface setting always takes
precedence (if specified), followed by portgroup, and finally the
setting in the network is used if it's not specified in the interface
or portgroup.

10 years agoconf: add trustGuestRxFilters attribute to network and domain interface
Laine Stump [Tue, 23 Sep 2014 18:19:08 +0000 (14:19 -0400)]
conf: add trustGuestRxFilters attribute to network and domain interface

This new attribute will control whether or not libvirt will pay
attention to guest notifications about changes to network device mac
addresses and receive filters. The default for this is 'no' (for
security reasons). If it is set to 'yes' *and* the specified device
model and connection support it (currently only macvtap+virtio) then
libvirt will watch for NIC_RX_FILTER_CHANGED events, and when it
receives one, it will issue a query-rx-filter command, retrieve the
result, and modify the host-side macvtap interface's mac address and
unicast/multicast filters accordingly.

The functionality behind this attribute will be in a later patch. This
patch merely adds the attribute to the top-level of a domain's
<interface> as well as to <network> and <portgroup>, and adds
documentation and schema/xml2xml tests. Rather than adding even more
test files, I've just added the net attribute in various applicable
places of existing test files.

10 years agoqemu: Remove possible NULL deref in debug output
John Ferlan [Wed, 24 Sep 2014 12:30:09 +0000 (08:30 -0400)]
qemu: Remove possible NULL deref in debug output

Check for !dev->info.alias was done after a VIR_DEBUG() statement
that already tried to print - just flip sequence

10 years agoqemu: Remove need for virConnectPtr in hotunplug detach host, net
John Ferlan [Wed, 24 Sep 2014 12:31:32 +0000 (08:31 -0400)]
qemu: Remove need for virConnectPtr in hotunplug detach host, net

Prior patch removed the need for the virConnectPtr in the unplug
detach host path which caused ripple effect to remove in multiple
callers.  The previous patch just left things as ATTRIBUTE_UNUSED -
this patch will remove the variable.

10 years agoqemu: Fix hot unplug of SCSI_HOST device
John Ferlan [Tue, 23 Sep 2014 22:53:25 +0000 (18:53 -0400)]
qemu: Fix hot unplug of SCSI_HOST device

https://bugzilla.redhat.com/show_bug.cgi?id=1141732

Introduced by commit id '8f76ad99' the logic to detach a scsi_host
device (SCSI or iSCSI) fails when attempting to remove the 'drive'
because as I found in my investigation - the DelDevice takes care of
that for us.

The investigation turned up commits to adjust the logic for the
qemuMonitorDelDevice and qemuMonitorDriveDel processing for interfaces
(commit id '81f76598'), disk bus=VIRTIO,SCSI,USB (commit id '0635785b'),
and chr devices (commit id '55b21f9b'), but nothing with the host devices.

This commit uses the model for the previous set of changes and applies
it to the hostdev path. The call to qemuDomainDetachHostSCSIDevice will
return to qemuDomainDetachThisHostDevice handling either the audit of
the failure or the wait for the removal and then call into
qemuDomainRemoveHostDevice for the event, removal from the domain hostdev
list, and audit of the removal similar to other paths.

NOTE: For now the 'conn' param to +qemuDomainDetachHostSCSIDevice is left
as ATTRIBUTE_UNUSED.  Removing requires a cascade of other changes to be
left for a future patch.

10 years agomaint: update .mailmap
Eric Blake [Mon, 6 Oct 2014 14:23:47 +0000 (08:23 -0600)]
maint: update .mailmap

Consolidate several commits made by James:
https://www.redhat.com/archives/libvir-list/2014-September/msg01156.html

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoInclude .libs in libdir in source tree pkg-config files
Ján Tomko [Wed, 1 Oct 2014 12:46:54 +0000 (14:46 +0200)]
Include .libs in libdir in source tree pkg-config files

This lets me build against an uninstalled source tree without
libtool.

10 years agodocs: fix a typo in drvlxc
Chen Hanxiao [Mon, 6 Oct 2014 09:28:40 +0000 (17:28 +0800)]
docs: fix a typo in drvlxc

s/the/The

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
10 years agominor shmem clean-ups
Martin Kletzander [Sat, 4 Oct 2014 08:46:22 +0000 (10:46 +0200)]
minor shmem clean-ups

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoutil: Prepare URI formatting for libxml2 >= 2.9.2
Martin Kletzander [Fri, 3 Oct 2014 16:27:01 +0000 (18:27 +0200)]
util: Prepare URI formatting for libxml2 >= 2.9.2

Since commit 8eb55d782a2b9afacc7938694891cc6fad7b42a5 libxml2 removes
two slashes from the URI when there is no server part.  This is fixed
with beb7281055dbf0ed4d041022a67c6c5cfd126f25, but only if the calling
application calls xmlSaveUri() on URI that xmlURIParse() parsed.  And
that is not the case in virURIFormat().  virURIFormat() accepts
virURIPtr that can be created without parsing it and we do that when we
format network storage paths for gluster for example.  Even though
virStorageSourceParseBackingURI() uses virURIParse(), it throws that data
structure right away.

Since we want to format URIs as URIs and not absolute URIs or opaque
URIs (see RFC 3986), we can specify that with a special hack thanks to
commit beb7281055dbf0ed4d041022a67c6c5cfd126f25, by setting port to -1.

This fixes qemuxml2argvtest test where the disk-drive-network-gluster
case was failing.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agovbox: remove unused code that causes build failures
Martin Kletzander [Fri, 3 Oct 2014 17:06:33 +0000 (19:06 +0200)]
vbox: remove unused code that causes build failures

Since 87dea4fcffb2d1b120e7841adc0e3d8ea97ed777 vboxGetDrivers() is not
used for getting the vbox network driver.  The only call the code does
is using NULL as the @networkDriver_ret param , but the code still used
vbox[0-9][0-9]NetworkDriver that didn't exist anymore.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: Build command line for ivshmem device
Martin Kletzander [Thu, 25 Sep 2014 07:00:47 +0000 (09:00 +0200)]
qemu: Build command line for ivshmem device

This patch implements support for the ivshmem device in QEMU.

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: add capability probing for ivshmem device
Maxime Leroy [Fri, 22 Aug 2014 10:47:02 +0000 (12:47 +0200)]
qemu: add capability probing for ivshmem device

Ivshmem is supported by QEMU since 0.13 release.

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agodocs, conf, schema: add support for shmem device
Martin Kletzander [Mon, 22 Sep 2014 08:49:39 +0000 (10:49 +0200)]
docs, conf, schema: add support for shmem device

This patch adds parsing/formatting code as well as documentation for
shared memory devices.  This will currently be only accessible in QEMU
using it's ivshmem device, but is designed as generic as possible to
allow future expansion for other hypervisors.

In the devices section in the domain XML users may specify:

- For shmem device using a server:

 <shmem name='shmem0'>
   <server path='/tmp/socket-ivshmem0'/>
   <size unit='M'>32</size>
   <msi vectors='32' ioeventfd='on'/>
 </shmem>

- For ivshmem device not using an ivshmem server:

 <shmem name='shmem1'>
   <size unit='M'>32</size>
 </shmem>

Most of the configuration is made optional so it also allows
specifications like:

 <shmem name='shmem1/>
 <shmem name='shmem2'>
   <server/>
 </shmem>

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: support nospace reason in io error event
Eric Blake [Fri, 3 Oct 2014 14:46:25 +0000 (08:46 -0600)]
qemu: support nospace reason in io error event

Aeons ago (commit 34dcbbb4, v0.8.2), we added a new libvirt event
(VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON) in order to tell the user WHY
the guest halted.  This is because at least VDSM wants to react
differently to ENOSPC events (resize the lvm partition to be larger,
and resume the guest as if nothing had happened) from all other events
(I/O is hosed, throw up our hands and flag things as broken).  At the
time this was done, downstream RHEL qemu added a vendor extension
'__com.redhat_reason', which would be exactly one of these strings:
"enospc", "eperm", "eio", and "eother".  In our stupidity, we exposed
those exact strings to clients, rather than an enum, and we also
return "" if we did not have access to a reason (which was the case
for upstream qemu).

Fast forward to now: upstream qemu commit c7c2ff0c (will be qemu 2.2)
FINALLY adds a 'nospace' boolean, after discussion with multiple
projects determined that VDSM really doesn't care about distinction
between any other error types.  So this patch converts 'nospace' into
the string "enospc" for compatibility with RHEL clients that were
already used to the downstream extension, while leaving the reason
blank for all other cases (no change from the status quo).

See also https://bugzilla.redhat.com/show_bug.cgi?id=1119784

* src/qemu/qemu_monitor_json.c (qewmuMonitorJSONHandleIOError):
Parse reason field from modern qemu.
* include/libvirt/libvirt.h.in
(virConnectDomainEventIOErrorReasonCallback): Document it.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoqemu: Don't compare CPU against host for TCG
Cole Robinson [Tue, 23 Sep 2014 17:07:09 +0000 (13:07 -0400)]
qemu: Don't compare CPU against host for TCG

Right now when building the qemu command line, we try to do various
unconditional validations of the guest CPU against the host CPU. However
this checks are overly applied. The only time we should use the checks
are:

- The user requests host-model/host-passthrough, or

- When KVM is requsted. CPU features requested in TCG mode are always
  emulated by qemu and are independent of the host CPU, so no host CPU
  checks should be performed.

Right now if trying to specify a CPU for arm on an x86 host, it attempts
to do non-sensical validation and falls over.

Switch all the test cases that were intending to test CPU validation to
use KVM, so they continue to test the intended code.

Amend some aarch64 XML tests with a CPU model, to ensure things work
correctly.

10 years agoqemu_command: Split qemuBuildCpuArgStr
Cole Robinson [Tue, 23 Sep 2014 15:35:57 +0000 (11:35 -0400)]
qemu_command: Split qemuBuildCpuArgStr

Move the CPU mode/model handling to its own function. This is just
code movement and re-indentation.

10 years agoconfigure: improve misleading libnl3-devel missing error message
Shanzhi Yu [Fri, 26 Sep 2014 05:50:13 +0000 (13:50 +0800)]
configure: improve misleading libnl3-devel missing error message

When building libvirt from source with netcf-devel installed, the
configure script reports error "libnl-devel >=3.0 is required for
macvtap support", while actually libnl3-devel is required.

Signed-off-by: Shanzhi Yu <shyu@redhat.com>
10 years agoqemu: Improve domainSetTime error info report
Shanzhi Yu [Tue, 30 Sep 2014 13:36:23 +0000 (21:36 +0800)]
qemu: Improve domainSetTime error info report

check domain's status before call virQEMUCapsGet to report a accurate
error when domain is shut off

Resolve: https://bugzilla.redhat.com/show_bug.cgi?id=1147847
Signed-off-by: Shanzhi Yu <shyu@redhat.com>
10 years agoMakefile: Fix build without driver modules
Michal Privoznik [Fri, 3 Oct 2014 11:59:12 +0000 (13:59 +0200)]
Makefile: Fix build without driver modules

After 87dea4fcf one can observe a build failure:

./autogen.sh --system --without-driver-modules && make

  CCLD     libvirtd
../src/.libs/libvirt_driver_vbox.a(libvirt_driver_vbox_impl_la-vbox_driver.o):
In function `vboxNetworkRegister':
/home/jtomko/work/libvirt/libvirt.git/src/vbox/vbox_driver.c:168: undefined
reference to `vboxGetNetworkDriver'
collect2: error: ld returned 1 exit status
make[3]: *** [libvirtd] Error 1

The problem is that when building without driver modules the VBOX
network driver is not linked into the the VBOX driver.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agovbox: New network driver
Taowei [Thu, 2 Oct 2014 03:30:38 +0000 (11:30 +0800)]
vbox: New network driver

This patch seperate the domain driver and the network driver.

libvirt_driver_vbox_impl.la has been linked in the network driver.
So that the version specified codes in vbox_V*.c would only be
compiled once.

The vboxGetNetworkDriver provides a simple interface to get vbox
network driver.

10 years agovbox: Rewrite vboxNetworkGetXMLDesc
Taowei [Thu, 2 Oct 2014 03:30:37 +0000 (11:30 +0800)]
vbox: Rewrite vboxNetworkGetXMLDesc

10 years agovbox: Rewrite vboxNetworkCreate
Taowei [Thu, 2 Oct 2014 03:30:36 +0000 (11:30 +0800)]
vbox: Rewrite vboxNetworkCreate

10 years agovbox: Rewrite vboxNetworkUndefineDestroy
Taowei [Thu, 2 Oct 2014 03:30:35 +0000 (11:30 +0800)]
vbox: Rewrite vboxNetworkUndefineDestroy

This patch rewrites two public APIs. They are vboxNetworkUndefine
and vboxNetworkDestroy. They use the same core function
vboxNetworkUndefineDestroy. I merged it in one patch.

10 years agovbox: Rewrite vboxNetworkDefineCreateXML
Taowei [Thu, 2 Oct 2014 03:30:34 +0000 (11:30 +0800)]
vbox: Rewrite vboxNetworkDefineCreateXML

This patch actually contains two public API, virNetworkDefineXML
and virNetworkCreateXML. They use the same core function
vboxNetworkDefineCreateXML. So I merged it together.

10 years agovbox: Rewrite vboxNetworkLookupByName
Taowei [Thu, 2 Oct 2014 03:30:33 +0000 (11:30 +0800)]
vbox: Rewrite vboxNetworkLookupByName

10 years agovbox: Rewrite vboxNetworkLookupByUUID
Taowei [Thu, 2 Oct 2014 03:30:32 +0000 (11:30 +0800)]
vbox: Rewrite vboxNetworkLookupByUUID

10 years agovbox: Rewrite vboxConnectListDefinedNetworks
Taowei [Thu, 2 Oct 2014 03:30:31 +0000 (11:30 +0800)]
vbox: Rewrite vboxConnectListDefinedNetworks

10 years agovbox: Rewrite vboxConnectNumOfDefinedNetworks
Taowei [Thu, 2 Oct 2014 03:30:30 +0000 (11:30 +0800)]
vbox: Rewrite vboxConnectNumOfDefinedNetworks

10 years agovbox: Rewrite vboxConnectListNetworks
Taowei [Thu, 2 Oct 2014 03:30:29 +0000 (11:30 +0800)]
vbox: Rewrite vboxConnectListNetworks

10 years agovbox: Rewrite vboxConnectNumOfNetworks
Taowei [Thu, 2 Oct 2014 03:30:28 +0000 (11:30 +0800)]
vbox: Rewrite vboxConnectNumOfNetworks

10 years agovbox: Rewrite vboxNetworkClose
Taowei [Thu, 2 Oct 2014 03:30:27 +0000 (11:30 +0800)]
vbox: Rewrite vboxNetworkClose

10 years agovbox: Rewrite vboxNetworkOpen
Taowei [Thu, 2 Oct 2014 03:30:26 +0000 (11:30 +0800)]
vbox: Rewrite vboxNetworkOpen

10 years agovbox: Interfaces for register per parties
Taowei [Thu, 2 Oct 2014 03:30:25 +0000 (11:30 +0800)]
vbox: Interfaces for register per parties

The patch dbb4cbf532fa by Michal has splited the vbox driver into
three parties. This modification brings a more suitable interface
to the previous patch.

The new function vboxGetDriver is introduced to get the
corresponding vbox domain driver directly thought the vbox version.

Functions like vboxGetNetworkDriver and vboxGetStorageDriver
will be introduced after rewriting it's drivers.

This patch, by the way, fixed the align problem for vbox in
Makefile.am

10 years agoqemu: Fix updating balloon period in live XML
Erik Skultety [Thu, 2 Oct 2014 12:48:02 +0000 (14:48 +0200)]
qemu: Fix updating balloon period in live XML

Up until now, we set memballoon period in monitor successfully, however
we did not update domain definition structure, thus dumpxml was omitting
period attribute in memballoon element

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1140960

10 years agoqemu: Fix updating bandwidth limits in live XML
Erik Skultety [Thu, 2 Oct 2014 12:48:01 +0000 (14:48 +0200)]
qemu: Fix updating bandwidth limits in live XML

When trying to update bandwidth limits on a running domain, limits get
updated in our internal structures, however XML parser reads
bandwidth limits from network 'actual' definition. Committing this patch
it is now available to update bandwidth 'actual' definition as well,
thus updating domain runtime XML.

10 years agoAdd virCgroupTerminateMachine stub
Ján Tomko [Thu, 2 Oct 2014 09:05:50 +0000 (11:05 +0200)]
Add virCgroupTerminateMachine stub

Fix the build on FreeBSD, broken by commit 4882618.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agobuild: fix build on non-Linux
Eric Blake [Thu, 2 Oct 2014 03:18:52 +0000 (21:18 -0600)]
build: fix build on non-Linux

A cygwin build of 1.2.9 fails with:

util/virprocess.c:87:27: fatal error: sys/syscall.h: No such file or directory
 #  include <sys/syscall.h>

But in reality, the ONLY user of setns() is lxc, which is Linux-only.
It's easiest to just limit the setns workarounds to Linux.

* src/util/virprocess.c (setns): Limit definition to Linux.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoMake editor used for 'virsh edit' configurable
Guido Günther [Sun, 28 Sep 2014 08:34:03 +0000 (10:34 +0200)]
Make editor used for 'virsh edit' configurable

Debian wants to use 'sensible-editor' instead of vi other distros might
want to use other defaults. This avoids distro specific patches.

10 years agoqemu: use systemd's TerminateMachine to kill all processes
Guido Günther [Thu, 25 Sep 2014 11:32:58 +0000 (13:32 +0200)]
qemu: use systemd's TerminateMachine to kill all processes

If we don't properly clean up all processes in the
machine-<vmname>.scope systemd won't remove the cgroup and subsequent vm
starts fail with

  'CreateMachine: File exists'

Additional processes can e.g. be added via

  echo $PID > /sys/fs/cgroup/systemd/machine.slice/machine-${VMNAME}.scope/tasks

but there are other cases like

  http://bugs.debian.org/761521

Invoke TerminateMachine to be on the safe side since systemd tracks the
cgroup anyway. This is a noop if all processes have terminated already.