]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
11 years agolibxl: use job functions when cleaning up a domain
Jim Fehlig [Wed, 12 Feb 2014 23:06:41 +0000 (16:06 -0700)]
libxl: use job functions when cleaning up a domain

When explicitly destroying a domain (libxlDomainDestroyFlags), or
handling an out-of-band domain shutdown event, cleanup the domain
in the context of a job.  Introduce libxlVmCleanupJob to wrap
libxlVmCleanup in a job block.

11 years agolibxl: use job functions in libxlDomain{Suspend,Resume}
Jim Fehlig [Thu, 6 Feb 2014 23:21:50 +0000 (16:21 -0700)]
libxl: use job functions in libxlDomain{Suspend,Resume}

These operations aren't necessarily time consuming, but need to
wait in the queue of modify jobs.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
11 years agolibxl: use job functions in libxlDomainSetMemoryFlags
Jim Fehlig [Thu, 6 Feb 2014 23:10:25 +0000 (16:10 -0700)]
libxl: use job functions in libxlDomainSetMemoryFlags

Large balloon operation can be time consuming.  Use the recently
added job functions and unlock the virDomainObj while ballooning.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
11 years agolibxl: use job functions in libxlVmStart
Jim Fehlig [Thu, 6 Feb 2014 22:21:36 +0000 (15:21 -0700)]
libxl: use job functions in libxlVmStart

Creating a large domain could potentially be time consuming.  Use the
recently added job functions and unlock the virDomainObj while
the create operation is in progress.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
11 years agolibxl: Add job support to libxl driver
Jim Fehlig [Thu, 19 Dec 2013 05:54:39 +0000 (13:54 +0800)]
libxl: Add job support to libxl driver

Follows the pattern used in the QEMU driver for managing multiple,
simultaneous jobs within the driver.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
11 years agolibxl: remove libxlVmReap function
Jim Fehlig [Wed, 12 Feb 2014 22:22:18 +0000 (15:22 -0700)]
libxl: remove libxlVmReap function

This function, which only has five call sites, simply calls
libxl_domain_destroy and libxlVmCleanup.  Call those functions
directly at the call sites, allowing more control over how a
domain is destroyed and cleaned up.  This patch maintains the
existing semantic, leaving changes to a subsequent patch.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
11 years agolibxl: always set vm id to -1 on shutdown
Jim Fehlig [Wed, 12 Feb 2014 21:59:13 +0000 (14:59 -0700)]
libxl: always set vm id to -1 on shutdown

Once a domain has reached the shutdown state, set its ID to -1.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
11 years agoqemu: Use virtio network device for aarch64/virt
Oleg Strikov [Fri, 14 Feb 2014 14:09:00 +0000 (18:09 +0400)]
qemu: Use virtio network device for aarch64/virt

This patch changes network device type used by default from rtl8139
to virtio when architecture type is aarch64 and machine type is virt.
Qemu doesn't support any other machine types for aarch64 right now and
we can't make any other aarch64-specific tuning in this function yet.

Signed-off-by: Oleg Strikov <oleg.strikov@canonical.com>
11 years agobhyve: add a basic driver
Roman Bogorodskiy [Tue, 18 Feb 2014 10:08:10 +0000 (14:08 +0400)]
bhyve: add a basic driver

At this point it has a limited functionality and is highly
experimental. Supported domain operations are:

  * define
  * start
  * destroy
  * dumpxml
  * dominfo

It's only possible to have only one disk device and only one
network, which should be of type bridge.

11 years agoAdd a default USB keyboard and USB mouse for PPC64
Li Zhang [Mon, 17 Feb 2014 10:17:58 +0000 (18:17 +0800)]
Add a default USB keyboard and USB mouse for PPC64

There is no keyboard working on PPC64 and PS2 mouse is only for X86
when graphics are enabled.

Add a USB keyboard and USB mouse for PPC64 when graphics are enabled.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
11 years agoxen: format xen config for USB keyboard
Li Zhang [Mon, 17 Feb 2014 10:17:57 +0000 (18:17 +0800)]
xen: format xen config for USB keyboard

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
11 years agoqemu: format qemu command line for USB keyboard
Li Zhang [Mon, 17 Feb 2014 10:17:56 +0000 (18:17 +0800)]
qemu: format qemu command line for USB keyboard

Format qemu command line for USB keyboard
and add test cases for it.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
11 years agoqemu: Add USB keyboard capability
Li Zhang [Mon, 17 Feb 2014 10:17:55 +0000 (18:17 +0800)]
qemu: Add USB keyboard capability

Add USB keyboard capability probing and test cases.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
11 years agoconf: Remove the implicit PS2 devices for non-X86 platforms
Li Zhang [Mon, 17 Feb 2014 10:17:54 +0000 (18:17 +0800)]
conf: Remove the implicit PS2 devices for non-X86 platforms

PS2 devices only work on X86 platform, other platforms may need
USB devices instead. Athough it doesn't influence the QEMU command line,
it's not right to add PS2 mouse/keyboard for non-X86 platform.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
11 years agoconf: Add keyboard input device type
Li Zhang [Mon, 17 Feb 2014 10:17:53 +0000 (18:17 +0800)]
conf: Add keyboard input device type

There is no keyboard support currently in libvirt.

For some platforms (PPC64 QEMU) this makes graphics unusable,
since the keyboard is not implicit and it can't be added via libvirt.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
11 years agoconf: Add one interface to add default input devices
Li Zhang [Mon, 17 Feb 2014 10:17:52 +0000 (18:17 +0800)]
conf: Add one interface to add default input devices

Use it for the default mouse.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
11 years agobridge_driver.h: Fix build --without-network
Michal Privoznik [Tue, 18 Feb 2014 17:40:28 +0000 (18:40 +0100)]
bridge_driver.h: Fix build --without-network

The networkNotifyActualDevice function is accepting two arguments, not
one:

qemu/qemu_process.c: In function 'qemuProcessNotifyNets':
qemu/qemu_process.c:2776:47: error: macro "networkNotifyActualDevice" passed 2 arguments, but takes just 1
         if (networkNotifyActualDevice(def, net) < 0)
                                               ^

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoFix conflicting types of virInitctlSetRunLevel
Ján Tomko [Tue, 18 Feb 2014 14:01:32 +0000 (15:01 +0100)]
Fix conflicting types of virInitctlSetRunLevel

aebbcdd didn't change the non-linux definition of the function,
breaking the build on FreeBSD:

../../src/util/virinitctl.c:164: error: conflicting types for
'virInitctlSetRunLevel'
../../src/util/virinitctl.h:40: error: previous declaration of
'virInitctlSetRunLevel' was here

11 years agonetwork: Taint networks that are using hook script
Michal Privoznik [Tue, 4 Feb 2014 16:36:54 +0000 (17:36 +0100)]
network: Taint networks that are using hook script

Basically, the idea is copied from domain code, where tainting
exists for a while. Currently, only one taint reason exists -
VIR_NETWORK_TAINT_HOOK to mark those networks which caused invoking
of hook script.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agonetwork: Introduce network hooks
Michal Privoznik [Fri, 31 Jan 2014 15:48:06 +0000 (16:48 +0100)]
network: Introduce network hooks

There might be some use cases, where user wants to prepare the host or
its environment prior to starting a network and do some cleanup after
the network has been shut down. Consider all the functionality that
libvirt doesn't currently have as an example what a hook script can
possibly do.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agonetwork_conf: Expose virNetworkDefFormatInternal
Michal Privoznik [Wed, 12 Feb 2014 16:36:35 +0000 (17:36 +0100)]
network_conf: Expose virNetworkDefFormatInternal

In the next patch I'm going to need the network format function that
takes virBuffer as argument. However, slightly change of name is more
appropriate then: virNetworkDefFormatBuf to match the rest of functions
that format an object to buffer.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoCVE-2013-6456: Avoid unsafe use of /proc/$PID/root in LXC hotunplug code
Daniel P. Berrange [Thu, 30 Jan 2014 17:58:36 +0000 (17:58 +0000)]
CVE-2013-6456: Avoid unsafe use of /proc/$PID/root in LXC hotunplug code

Rewrite multiple hotunplug functions to to use the
virProcessRunInMountNamespace helper. This avoids
risk of a malicious guest replacing /dev with an absolute
symlink, tricking the driver into changing the host OS
filesystem.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoCVE-2013-6456: Avoid unsafe use of /proc/$PID/root in LXC chardev hostdev hotplug
Daniel P. Berrange [Thu, 30 Jan 2014 17:47:39 +0000 (17:47 +0000)]
CVE-2013-6456: Avoid unsafe use of /proc/$PID/root in LXC chardev hostdev hotplug

Rewrite lxcDomainAttachDeviceHostdevMiscLive function
to use the virProcessRunInMountNamespace helper. This avoids
risk of a malicious guest replacing /dev with a absolute
symlink, tricking the driver into changing the host OS
filesystem.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoCVE-2013-6456: Avoid unsafe use of /proc/$PID/root in LXC block hostdev hotplug
Daniel P. Berrange [Thu, 30 Jan 2014 17:45:08 +0000 (17:45 +0000)]
CVE-2013-6456: Avoid unsafe use of /proc/$PID/root in LXC block hostdev hotplug

Rewrite lxcDomainAttachDeviceHostdevStorageLive function
to use the virProcessRunInMountNamespace helper. This avoids
risk of a malicious guest replacing /dev with a absolute
symlink, tricking the driver into changing the host OS
filesystem.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoCVE-2013-6456: Avoid unsafe use of /proc/$PID/root in LXC USB hotplug
Daniel P. Berrange [Thu, 30 Jan 2014 16:34:19 +0000 (16:34 +0000)]
CVE-2013-6456: Avoid unsafe use of /proc/$PID/root in LXC USB hotplug

Rewrite lxcDomainAttachDeviceHostdevSubsysUSBLive function
to use the virProcessRunInMountNamespace helper. This avoids
risk of a malicious guest replacing /dev with a absolute
symlink, tricking the driver into changing the host OS
filesystem.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoCVE-2013-6456: Avoid unsafe use of /proc/$PID/root in LXC disk hotplug
Daniel P. Berrange [Thu, 30 Jan 2014 15:59:20 +0000 (15:59 +0000)]
CVE-2013-6456: Avoid unsafe use of /proc/$PID/root in LXC disk hotplug

Rewrite lxcDomainAttachDeviceDiskLive function to use the
virProcessRunInMountNamespace helper. This avoids risk of
a malicious guest replacing /dev with a absolute symlink,
tricking the driver into changing the host OS filesystem.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoCVE-2013-6456: Avoid unsafe use of /proc/$PID/root in LXC shutdown/reboot code
Eric Blake [Tue, 24 Dec 2013 05:55:51 +0000 (22:55 -0700)]
CVE-2013-6456: Avoid unsafe use of /proc/$PID/root in LXC shutdown/reboot code

Use helper virProcessRunInMountNamespace in lxcDomainShutdownFlags and
lxcDomainReboot.  Otherwise, a malicious guest could use symlinks
to force the host to manipulate the wrong file in the host's namespace.

Idea by Dan Berrange, based on an initial report by Reco
<recoverym4n@gmail.com> at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732394

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoAdd helper for running code in separate namespaces
Daniel P. Berrange [Thu, 30 Jan 2014 13:11:23 +0000 (13:11 +0000)]
Add helper for running code in separate namespaces

Implement virProcessRunInMountNamespace, which runs callback of type
virProcessNamespaceCallback in a container namespace. This uses a
child process to run the callback, since you can't change the mount
namespace of a thread. This implies that callbacks have to be careful
about what code they run due to async safety rules.

Idea by Dan Berrange, based on an initial report by Reco
<recoverym4n@gmail.com> at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732394

Signed-off-by: Daniel Berrange <berrange@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoAdd virFileMakeParentPath helper function
Daniel P. Berrange [Thu, 30 Jan 2014 17:06:39 +0000 (17:06 +0000)]
Add virFileMakeParentPath helper function

Add a helper function which takes a file path and ensures
that all directory components leading up to the file exist.
IOW, it strips the filename part of the path and passes
the result to virFileMakePath.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoMove check for cgroup devices ACL upfront in LXC hotplug
Daniel P. Berrange [Wed, 5 Feb 2014 17:48:03 +0000 (17:48 +0000)]
Move check for cgroup devices ACL upfront in LXC hotplug

The check for whether the cgroup devices ACL is available is
done quite late during LXC hotplug - in fact after the device
node is already created in the container in some cases. Better
to do it upfront so we fail immediately.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoDisks are always block devices, never character devices
Daniel P. Berrange [Wed, 5 Feb 2014 11:01:09 +0000 (11:01 +0000)]
Disks are always block devices, never character devices

The LXC disk hotplug code was allowing block or character devices
to be given as disk. A disk is always a block device.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix reset of cgroup when detaching USB device from LXC guests
Daniel P. Berrange [Tue, 4 Feb 2014 17:41:22 +0000 (17:41 +0000)]
Fix reset of cgroup when detaching USB device from LXC guests

When detaching a USB device from an LXC guest we must remove
the device from the cgroup ACL. Unfortunately we were telling
the cgroup code to use the guest /dev path, not the host /dev
path, and the guest device node had already been unlinked.
This was, however, fortunate since the code passed &priv->cgroup
instead of priv->cgroup, so would have crash if the device node
were accessible.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRecord hotplugged USB device in LXC live guest config
Daniel P. Berrange [Tue, 4 Feb 2014 16:46:28 +0000 (16:46 +0000)]
Record hotplugged USB device in LXC live guest config

After hotplugging a USB device, the LXC driver forgot
to add the device def to the virDomainDefPtr.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix path used for USB device attach with LXC
Daniel P. Berrange [Tue, 4 Feb 2014 16:43:18 +0000 (16:43 +0000)]
Fix path used for USB device attach with LXC

The LXC code missed the 'usb' component out of the path
/dev/bus/usb/$BUSNUM/$DEVNUM, so it failed to actually
setup cgroups for the device. This was in fact lucky
because the call to virLXCSetupHostUsbDeviceCgroup
was also mistakenly passing '&priv->cgroup' instead of
just 'priv->cgroup'. So once the path is fixed, libvirtd
would then crash trying to access the bogus virCgroupPtr
pointer. This would have been a security issue, were it
not for the bogus path preventing the pointer reference
being reached.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoDon't block use of USB with containers
Daniel P. Berrange [Tue, 4 Feb 2014 16:21:12 +0000 (16:21 +0000)]
Don't block use of USB with containers

virDomainDefCompatibleDevice blocks use of USB if no USB
controller is present. This is not correct for containers
since devices can be assigned directly regardless of any
controllers.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoqemu: Implement VIR_DOMAIN_TAINT_HOOK
Michal Privoznik [Tue, 4 Feb 2014 15:42:13 +0000 (16:42 +0100)]
qemu: Implement VIR_DOMAIN_TAINT_HOOK

Currently, there's just one place where we care if hook script is
changing the domain XML: migration hook for incoming migration. In
all other places where a hook script is executed, we don't read the
XML back from the script.

Anyway, the hook script can alter domain XML and hence we should taint
it if the script did.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agovirDomainTaintFlags: Introduce VIR_DOMAIN_TAINT_HOOK
Michal Privoznik [Tue, 4 Feb 2014 15:36:37 +0000 (16:36 +0100)]
virDomainTaintFlags: Introduce VIR_DOMAIN_TAINT_HOOK

This new flag is to be used for tainting domains which
XML definition was altered at runtime by a hook script.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoRevert "storage: Introduce internal pool support"
Peter Krempa [Fri, 14 Feb 2014 15:03:22 +0000 (16:03 +0100)]
Revert "storage: Introduce internal pool support"

The internal pools were an idea in one of the first iterations of the
gluster series, which we decided not to use. Somehow the patch still
got pushed. Remove it as the internal flag isn't needed.

This reverts commit 362da8209d760fc1acd3a1c8df5b04aa676492eb.

11 years agoAdd tests for secret XML parsing
Ján Tomko [Fri, 14 Feb 2014 14:44:59 +0000 (15:44 +0100)]
Add tests for secret XML parsing

also validate it against the RNG schema.

11 years agodocs: remove <auth> from secret XML format
Ján Tomko [Fri, 14 Feb 2014 14:37:06 +0000 (15:37 +0100)]
docs: remove <auth> from secret XML format

This belongs to the pool definition.

11 years agoForgot to add lxcconf2xmldata to dist.
Cédric Bosdonnat [Fri, 14 Feb 2014 15:06:55 +0000 (16:06 +0100)]
Forgot to add lxcconf2xmldata to dist.

11 years agolxc: Don't shadow global symbol "link"
Peter Krempa [Fri, 14 Feb 2014 12:46:35 +0000 (13:46 +0100)]
lxc: Don't shadow global symbol "link"

Yet another variable name frowned upon by older compilers. Introduced in
commit b73c029d.

11 years agoSupport IPv6 in port allocator
Ján Tomko [Fri, 18 Oct 2013 11:52:03 +0000 (13:52 +0200)]
Support IPv6 in port allocator

Also try to bind on IPv6 to check if the port is occupied.

Change the mocked bind in the test to return EADDRINUSE
for some ports only for the IPv4/IPv6 socket if we're testing
on a host with IPv6 compiled in.

Also mock socket() to make it fail with EAFNOTSUPPORTED
if LIBVIRT_TEST_IPV4ONLY is set in the environment, to
simulate a host without IPv6 support in the kernel. The
tests are repeated again with this variable set.

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

11 years agoSplit out bind() from virPortAllocatorAcquire
Ján Tomko [Thu, 31 Oct 2013 14:14:15 +0000 (15:14 +0100)]
Split out bind() from virPortAllocatorAcquire

11 years agostorage: gluster: Don't leak private data when storage file init fails
Peter Krempa [Fri, 14 Feb 2014 12:08:39 +0000 (13:08 +0100)]
storage: gluster: Don't leak private data when storage file init fails

In a44b7b87bcc6681e2939f65a3552fc96f68bc7b6 I've introduced a function
that initializes a storage file wrapper object on gluster based volumes.

The initialization function leaks the private data pointer in case of
failure. This patch fixes it.

Reported by John Ferlan.

11 years agostorage: Fix build with older compilers afeter gluster snapshot series
Peter Krempa [Fri, 14 Feb 2014 10:46:37 +0000 (11:46 +0100)]
storage: Fix build with older compilers afeter gluster snapshot series

In commit e32268184b4fd1611ed5ffd3c758b8f6a34152e6 I accidentally added
twice a typedef for virStorageFileBackend when I moved it between files
across patch iterations. The double declaration breaks build on older
compilers in RHEL5 and FreeBSD.

Remove the spurious definition.

11 years agoqemu: snapshot: Add support for external active snapshots on gluster
Peter Krempa [Mon, 25 Nov 2013 17:56:24 +0000 (18:56 +0100)]
qemu: snapshot: Add support for external active snapshots on gluster

Add support for gluster backed images as sources for snapshots in the
qemu driver. This will also simplify adding further network backed
volumes as sources for snapshot in case qemu will support them.

11 years agoqemu: snapshot: Use new APIs to detect presence of existing storage files
Peter Krempa [Tue, 11 Feb 2014 16:18:35 +0000 (17:18 +0100)]
qemu: snapshot: Use new APIs to detect presence of existing storage files

Use the new storage driver based "stat" api to detect exiting files just
as we did with local files.

11 years agoqemu: Switch snapshot deletion to the new API functions
Peter Krempa [Fri, 31 Jan 2014 13:26:32 +0000 (14:26 +0100)]
qemu: Switch snapshot deletion to the new API functions

Use the new storage driver APIs to delete snapshot backing files in case
of failure instead of directly relying on "unlink". This will help us in
the future when we will be adding network based storage without local
representation in the host.

11 years agostorage: Add storage file backends for gluster
Peter Krempa [Mon, 3 Feb 2014 16:18:24 +0000 (17:18 +0100)]
storage: Add storage file backends for gluster

Implement storage backend functions to deal with gluster volumes and
implement the "stat" and "unlink" backend APIs.

11 years agostorage: add file functions for local and block files
Peter Krempa [Mon, 3 Feb 2014 15:41:49 +0000 (16:41 +0100)]
storage: add file functions for local and block files

Implement the "stat" and "unlink" function for "file" volumes and "stat"
for "block" volumes using the regular system calls.

11 years agostorage: Add file storage APIs in the default storage driver
Peter Krempa [Mon, 3 Feb 2014 15:12:57 +0000 (16:12 +0100)]
storage: Add file storage APIs in the default storage driver

Add APIs that will allow to use the storage driver to assist in
operations on files even for remote filesystems without native
representation as files in the host.

11 years agoconf: Move qemuSnapshotDiskGetActualType to virDomainSnapshotDiskGetActualType
Peter Krempa [Thu, 13 Feb 2014 09:41:01 +0000 (10:41 +0100)]
conf: Move qemuSnapshotDiskGetActualType to virDomainSnapshotDiskGetActualType

All the data for getting the actual type is present in the snapshot
config. There is no need to have this function private to the qemu
driver and it will be re-used later in other parts of libvirt

11 years agoconf: Move qemuDiskGetActualType to virDomainDiskGetActualType
Peter Krempa [Thu, 13 Feb 2014 09:41:01 +0000 (10:41 +0100)]
conf: Move qemuDiskGetActualType to virDomainDiskGetActualType

All the data for getting the actual type is present in the domain
config. There is no need to have this function private to the qemu
driver and it will be re-used later in other parts of libvirt

11 years agospec: add missing dep of libvirt-daemon-config-nwfilter
Eric Blake [Wed, 12 Feb 2014 21:33:16 +0000 (14:33 -0700)]
spec: add missing dep of libvirt-daemon-config-nwfilter

Similar to cf76c4b, if modules are used, then nwfilter configuration
requires the nwfilter driver module.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoRevert "spec: require libvirt-wireshark from libvirt metapackage"
Eric Blake [Thu, 13 Feb 2014 13:34:14 +0000 (06:34 -0700)]
Revert "spec: require libvirt-wireshark from libvirt metapackage"

This reverts commit 8d6c3659b8c9b861b00a19b26079d11d56dce680.

After further list discussion, it was decided that pulling in
wireshark as a dependency is a bit too much for the base 'libvirt'
package.  Remember also that 'libvirt-devel' is also not pulled in
by the base 'libvirt' - the metapackage exists for full
functionality of libvirtd, rather than to pull in all subpackages.

11 years agolxc from native: removed now remaining useless line
Cédric Bosdonnat [Thu, 13 Feb 2014 12:45:44 +0000 (13:45 +0100)]
lxc from native: removed now remaining useless line

11 years agoFix stream related spelling mistakes
Philipp Hahn [Thu, 13 Feb 2014 08:41:54 +0000 (09:41 +0100)]
Fix stream related spelling mistakes

Remove double "is".
Consistent spelling of all-uppercase I/O.

Signed-off-by: Philipp Hahn <hahn@univention.de>
11 years agospec: require libvirt-wireshark from libvirt metapackage
Eric Blake [Wed, 12 Feb 2014 20:27:38 +0000 (13:27 -0700)]
spec: require libvirt-wireshark from libvirt metapackage

In general, the 'libvirt' metapackage should pull in all subpackages.
Fix this for the wireshark subpackage created in commit f9ada9f.

* libvirt.spec.in (Requires): Add dependency.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agospec: add missing dep of libvirt-daemon-config-network
Thierry Parmentelat [Tue, 11 Feb 2014 10:35:20 +0000 (11:35 +0100)]
spec: add missing dep of libvirt-daemon-config-network

When building modules, libvirt-daemon-config-network requires
libvirt-daemon-driver-network to ensure the 'default' network
is setup properly

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agospec: require libvirt-daemon-driver-interface only when built
Thierry Parmentelat [Mon, 10 Feb 2014 09:54:30 +0000 (10:54 +0100)]
spec: require libvirt-daemon-driver-interface only when built

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoLXC from native: convert blkio throttle config
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:17 +0000 (15:10 +0100)]
LXC from native: convert blkio throttle config

11 years agoLXC: added some doc on domxml-from-native with mention of limitations
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:16 +0000 (15:10 +0100)]
LXC: added some doc on domxml-from-native with mention of limitations

11 years agoLXC from native: map vlan network type
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:15 +0000 (15:10 +0100)]
LXC from native: map vlan network type

The problem with VLAN is that the user still has to manually create the
vlan interface on the host. Then the generated configuration will use
it as a nerwork hostdev device. So the generated configurations of the
following two fragments are equivalent (see rhbz#1059637).

lxc.network.type = phys
lxc.network.link = eth0.5

lxc.network.type = vlan
lxc.network.link = eth0
lxc.network.vlan.id = 5

11 years agoLXC from native: map block filesystems
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:14 +0000 (15:10 +0100)]
LXC from native: map block filesystems

11 years agoLXC from native: map lxc.arch to /domain/os/type@arch
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:13 +0000 (15:10 +0100)]
LXC from native: map lxc.arch to /domain/os/type@arch

11 years agoLXC from native: add lxc.cgroup.blkio.* mapping
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:12 +0000 (15:10 +0100)]
LXC from native: add lxc.cgroup.blkio.* mapping

11 years agoLXC from native: map lxc.cgroup.cpuset.*
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:11 +0000 (15:10 +0100)]
LXC from native: map lxc.cgroup.cpuset.*

11 years agoLXC from native: map lxc.cgroup.cpu.*
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:10 +0000 (15:10 +0100)]
LXC from native: map lxc.cgroup.cpu.*

11 years agoLXC from native: migrate memory tuning
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:09 +0000 (15:10 +0100)]
LXC from native: migrate memory tuning

11 years agoLXC from native: convert lxc.id_map into <idmap>
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:08 +0000 (15:10 +0100)]
LXC from native: convert lxc.id_map into <idmap>

11 years agoLXC from native: convert macvlan network configuration
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:07 +0000 (15:10 +0100)]
LXC from native: convert macvlan network configuration

11 years agoLXC from native: convert lxc.tty to console devices
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:06 +0000 (15:10 +0100)]
LXC from native: convert lxc.tty to console devices

11 years agoLXC from native: convert phys network types to net hostdev devices
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:05 +0000 (15:10 +0100)]
LXC from native: convert phys network types to net hostdev devices

11 years agoLXC from native: migrate veth network configuration
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:04 +0000 (15:10 +0100)]
LXC from native: migrate veth network configuration

Some of the LXC configuration properties aren't migrated since they
would only cause problems in libvirt-lxc:
  * lxc.network.ipv[46]: LXC driver doesn't setup IP address of guests,
    see rhbz#1059624
  * lxc.network.name, see rhbz#1059630

11 years agoLXC from native: implement no network conversion
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:03 +0000 (15:10 +0100)]
LXC from native: implement no network conversion

If no network configuration is provided, LXC only provides the loopback
interface. To match this, we need to use the privnet feature. LXC will
also define a 'none' network type in its 1.0.0 version that fits
libvirt LXC driver's default.

11 years agoLXC from native: migrate fstab and lxc.mount.entry
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:02 +0000 (15:10 +0100)]
LXC from native: migrate fstab and lxc.mount.entry

Tmpfs relative size and default 50% size values aren't supported as
we have no idea of the available memory at the conversion time.

11 years agoLXC from native: import rootfs
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:01 +0000 (15:10 +0100)]
LXC from native: import rootfs

LXC rootfs can be either a directory or a block device or an image
file. The first two types have been implemented, but the image file is
still to be done since LXC auto-guesses the file format at mount time
and the LXC driver doesn't support the 'auto' format.

11 years agoLXC driver: started implementing connectDomainXMLFromNative
Cédric Bosdonnat [Wed, 5 Feb 2014 14:10:00 +0000 (15:10 +0100)]
LXC driver: started implementing connectDomainXMLFromNative

This function aims at converting LXC configuration into a libvirt
domain XML description to help users migrate from LXC to libvirt.

Here is an example of how the lxc configuration works:
virsh -c lxc:/// domxml-from-native lxc-tools /var/lib/lxc/migrate_test/config

It is possible that some parts couldn't be properly mapped into a
domain XML fragment, so users should carefully review the result
before creating the domain.

fstab files in lxc.mount lines will need to be merged into the
configuration file as lxc.mount.entry.

As we can't know the amount of memory of the host, we have to set a
default value for max_balloon that users will probably want to adjust.

11 years agoImprove virConf parse to handle LXC config format
Cédric Bosdonnat [Wed, 5 Feb 2014 14:09:59 +0000 (15:09 +0100)]
Improve virConf parse to handle LXC config format

virConf now honours a VIR_CONF_FLAG_LXC_FORMAT flag to handle LXC
configuration files. The differences are that property names can
contain '.' character and values are all strings without any bounding
quotes.

Provide a new virConfWalk function calling a handler on all non-comment
values. This function will be used by the LXC conversion code to loop
over LXC configuration lines.

11 years agoevent: pass reason for PM events
Eric Blake [Wed, 29 Jan 2014 00:41:34 +0000 (17:41 -0700)]
event: pass reason for PM events

Commit 57ddcc23 (v0.9.11) introduced the pmwakeup event, with
an optional 'reason' field reserved for possible future expansion.
But it failed to wire the field through RPC, so even if we do
add a reason in the future, we will be unable to get it back
to the user.

Worse, commit 7ba5defb (v1.0.0) repeated the same mistake with
the pmsuspend_disk event.

As long as we are adding new RPC calls, we might as well fix
the events to actually match the signature so that we don't have
to add yet another RPC in the future if we do decide to start
using the reason field.

* src/remote/remote_protocol.x
(remote_domain_event_callback_pmwakeup_msg)
(remote_domain_event_callback_pmsuspend_msg)
(remote_domain_event_callback_pmsuspend_disk_msg): Add reason
field.
* daemon/remote.c (remoteRelayDomainEventPMWakeup)
(remoteRelayDomainEventPMSuspend)
(remoteRelayDomainEventPMSuspendDisk): Pass reason to client.
* src/conf/domain_event.h (virDomainEventPMWakeupNewFromDom)
(virDomainEventPMSuspendNewFromDom)
(virDomainEventPMSuspendDiskNewFromDom): Require additional
parameter.
* src/conf/domain_event.c (virDomainEventPMClass): New class.
(virDomainEventPMDispose): New function.
(virDomainEventPMWakeupNew*, virDomainEventPMSuspendNew*)
(virDomainEventPMSuspendDiskNew*)
(virDomainEventDispatchDefaultFunc): Use new class.
* src/remote/remote_driver.c (remoteDomainBuildEvent*PM*): Pass
reason through.
* src/remote_protocol-structs: Regenerate.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoevent: convert remaining domain events to new style
Eric Blake [Thu, 9 Jan 2014 18:22:53 +0000 (11:22 -0700)]
event: convert remaining domain events to new style

Following the patterns established by lifecycle events, this
creates all the new RPC calls needed to pass callback IDs
for every domain event, and changes the limits in client and
server codes to use modern style when possible.

I've tested all combinations: both 'old client and new server'
and 'new client and old server' continue to work with the old
RPCs, and 'new client and new server' benefit from server-side
filtering with the new RPCs.

* src/remote/remote_protocol.x (REMOTE_PROC_DOMAIN_EVENT_*): Add
REMOTE_PROC_DOMAIN_EVENT_CALLBACK_* counterparts.
* daemon/remote.c (remoteRelayDomainEvent*): Send callbackID via
newer RPC when used with new-style registration.
(remoteDispatchConnectDomainEventCallbackRegisterAny): Extend to
cover all domain events.
* src/remote/remote_driver.c (remoteDomainBuildEvent*): Add new
Callback and Helper functions.
(remoteEvents): Match order of RPC numbers, register new handlers.
(remoteConnectDomainEventRegisterAny)
(remoteConnectDomainEventDeregisterAny): Extend to cover all
domain events.
* src/remote_protocol-structs: Regenerate.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoevent: client RPC protocol tweaks for domain lifecycle events
Eric Blake [Wed, 8 Jan 2014 14:57:25 +0000 (07:57 -0700)]
event: client RPC protocol tweaks for domain lifecycle events

The counterpart to the server RPC additions; here, a single
function can serve both old and new calls, while incoming
events must be serviced by two different functions.  Again,
some wise choices in our XDR made it easier to share code
managing similar events.

While this only supports lifecycle events, it covers the
harder part of how Register and RegisterAny interact; the
remaining 15 events will be a mechanical change in a later
patch.  For Register, we now have a callbackID locally for
more efficient cleanup if the RPC fails; we also prefer to
use the newer RPC where we know it is supported (the older
RPC must be used if we don't know if RegisterAny is
supported).

* src/remote/remote_driver.c (remoteEvents): Register new RPC
event handler.
(remoteDomainBuildEventLifecycle): Move guts...
(remoteDomainBuildEventLifecycleHelper): ...here.
(remoteDomainBuildEventCallbackLifecycle): New function.
(remoteConnectDomainEventRegister)
(remoteConnectDomainEventDeregister)
(remoteConnectDomainEventRegisterAny)
(remoteConnectDomainEventDeregisterAny): Use new RPC when supported.

11 years agoevent: prepare client to track domain callbackID
Eric Blake [Wed, 8 Jan 2014 04:00:54 +0000 (21:00 -0700)]
event: prepare client to track domain callbackID

We want to convert over to server-side events, even for older
APIs.  To do that, the client side of the remote driver wants
to distinguish between legacy virConnectDomainEventRegister and
normal virConnectDomainEventRegisterAny, while knowing the
client callbackID and the server's serverID for both types of
registration.  The client also needs to probe whether the
server supports server-side filtering.  However, for ease of
review, we don't actually use the new RPCs until a later patch.

* src/conf/object_event_private.h (virObjectEventStateCallbackID):
Add parameter.
* src/conf/object_event.c (virObjectEventCallbackListAddID)
(virObjectEventStateRegisterID): Separate legacy from callbackID.
(virObjectEventStateCallbackID): Pass through parameter.
(virObjectEventCallbackLookup): Let legacy and global domain
lifecycle events share a common remoteID.
* src/conf/network_event.c (virNetworkEventStateRegisterID):
Update caller.
* src/conf/domain_event.c (virDomainEventStateRegister)
(virDomainEventStateRegisterID, virDomainEventStateDeregister):
Likewise.
(virDomainEventStateRegisterClient)
(virDomainEventStateCallbackID): Implement new functions.
* src/conf/domain_event.h (virDomainEventStateRegisterClient)
(virDomainEventStateCallbackID): New prototypes.
* src/remote/remote_driver.c (private_data): Add field.
(doRemoteOpen): Probe server feature.
(remoteConnectDomainEventRegister)
(remoteConnectDomainEventRegisterAny): Use new function.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoevent: server RPC protocol tweaks for domain lifecycle events
Eric Blake [Wed, 8 Jan 2014 20:59:35 +0000 (13:59 -0700)]
event: server RPC protocol tweaks for domain lifecycle events

This patch adds some new RPC call numbers, but for ease of review,
they sit idle until a later patch adds the client counterpart to
drive the new RPCs.  Also for ease of review, I limited this patch
to just the lifecycle event; although converting the remaining
15 domain events will be quite mechanical.  On the server side,
we have to have a function per RPC call, largely with duplicated
bodies (the key difference being that we store in our callback
opaque pointer whether events should be fired with old or new
style); meanwhile, a single function can drive multiple RPC
messages.  With a strategic choice of XDR struct layout, we can
make the event generation code for both styles fairly compact.

I debated about adding a tri-state witness variable per
connection (values 'unknown', 'legacy', 'modern').  It would start
as 'unknown', move to 'legacy' if any RPC call is made to a legacy
event call, and move to 'modern' if the feature probe is made;
then the event code could issue an error if the witness state is
incorrect (a legacy RPC call while in 'modern', a modern RPC call
while in 'unknown' or 'legacy', and a feature probe while in
'legacy' or 'modern').  But while it might prevent odd behavior
caused by protocol fuzzing, I don't see that it would prevent
any security holes, so I considered it bloat.

Note that sticking @acl markers on the new RPCs generates unused
functions in access/viraccessapicheck.c, because there is no new
API call that needs to use the new checks; however, having a
consistent .x file is worth the dead code.

* src/libvirt_internal.h (VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK):
New feature.
* src/remote/remote_protocol.x
(REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_REGISTER_ANY)
(REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_DEREGISTER_ANY)
(REMOTE_PROC_DOMAIN_EVENT_CALLBACK_LIFECYCLE): New RPCs.
* daemon/remote.c (daemonClientCallback): Add field.
(remoteDispatchConnectDomainEventCallbackRegisterAny)
(remoteDispatchConnectDomainEventCallbackDeregisterAny): New
functions.
(remoteDispatchConnectDomainEventRegisterAny)
(remoteDispatchConnectDomainEventDeregisterAny): Mark legacy use.
(remoteRelayDomainEventLifecycle): Change message based on legacy
or new use.
(remoteDispatchConnectSupportsFeature): Advertise new feature.
* src/remote_protocol-structs: Regenerate.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoevent: dynamically manage server-side RPC domain events
Eric Blake [Mon, 6 Jan 2014 00:23:55 +0000 (17:23 -0700)]
event: dynamically manage server-side RPC domain events

This patch continues the earlier conversion made for network
events, with a goal of introducing server-side event filtering
in a later patch.  Actual behavior is unchanged without
further RPC changes.

* daemon/libvirtd.h (daemonClientPrivate): Alter the tracking of
domain events.
* daemon/remote.c (remoteClientInitHook, remoteClientFreeFunc)
(remoteRelayDomainEvent*)
(remoteDispatchConnectDomainEventRegister)
(remoteDispatchConnectDomainEventRegisterAny): Track domain
callbacks dynamically.

11 years agostorage: handle NULL return from virGetStorageVol
Michael Chapman [Wed, 12 Feb 2014 11:05:51 +0000 (22:05 +1100)]
storage: handle NULL return from virGetStorageVol

virGetStorageVol can return NULL on out-of-memory. If it does, cleanly
abort the volume clone operation.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
11 years agoRevert "storage: disk: Separate creating of the volume from building"
Ján Tomko [Wed, 12 Feb 2014 13:54:05 +0000 (14:54 +0100)]
Revert "storage: disk: Separate creating of the volume from building"

This reverts commit 67ccf91bf29488783bd1fda46b362450f71a2078.
We only generate the volume key after we've built it, but the storage
driver expects it to be filled after createVol finishes.
Squash the volume building back with creating to fulfill this
expectation.

11 years agoRevert "storage: lvm: Separate creating of the volume from building"
Ján Tomko [Wed, 12 Feb 2014 13:23:30 +0000 (14:23 +0100)]
Revert "storage: lvm: Separate creating of the volume from building"

This reverts commit af1fb38f55d4fb87e0fcaee1e973fa9c6713b1e6.
With it, creating new logical volumes fails:
https://www.redhat.com/archives/libvir-list/2014-February/msg00658.html

In the storage driver, we expect CreateVol to fill out the volume key,
but the LVM backend fills the key with the uuid reported by lvs after the
logical volume is created.

11 years agoFix leaks in vircapstest
Ján Tomko [Wed, 12 Feb 2014 09:29:18 +0000 (10:29 +0100)]
Fix leaks in vircapstest

Coverity complains about cell_cpus being leaked on error
and valgrind shows 'caps' is leaked on success.

Introduced in eb64e87.

11 years agoFixed build with clang.
Cédric Bosdonnat [Wed, 12 Feb 2014 10:36:06 +0000 (11:36 +0100)]
Fixed build with clang.

Two unused global variables, and DBUS_TYPE_INVALID used as a const
char*.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoAppArmor: Fix the place where the template should be installed
Cédric Bosdonnat [Wed, 12 Feb 2014 09:41:17 +0000 (10:41 +0100)]
AppArmor: Fix the place where the template should be installed

The security driver expects /etc/apparmor.d/libvirt/TEMPLATE but we
installed it to /etc/apparmor.d/libvirtd/TEMPLATE. Move the template to
the expected place since that code was here long before.

11 years agoqemu: Implement a stub cpuArchDriver.baseline() handler for aarch64
Oleg Strikov [Tue, 11 Feb 2014 15:51:41 +0000 (19:51 +0400)]
qemu: Implement a stub cpuArchDriver.baseline() handler for aarch64

Openstack Nova calls virConnectBaselineCPU() during initialization
of the instance to get a full list of CPU features.
This patch adds a stub to aarch64-specific code to handle
this request (no actual work is done). That's enough to have
this stub with limited functionality because qemu/kvm backend
supports only 'host-passthrough' cpu mode on aarch64.

Signed-off-by: Oleg Strikov <oleg.strikov@canonical.com>
11 years agolibxl: fix libxlDoDomainSave documentation
Jim Fehlig [Fri, 7 Feb 2014 01:02:06 +0000 (18:02 -0700)]
libxl: fix libxlDoDomainSave documentation

Update the function's comment, which was missed when removing use of
the driver lock everywhere.

11 years agolibxl: register for domain events immediately after creation
Jim Fehlig [Thu, 6 Feb 2014 21:36:49 +0000 (14:36 -0700)]
libxl: register for domain events immediately after creation

A small fix for the possiblitiy of jumping to an error path before
registering for domain events, preventing receiving important ones
like shutdown and death.

11 years agolibxl: rename libxlCreateDomEvents to libxlDomEventsRegister
Jim Fehlig [Thu, 6 Feb 2014 21:29:19 +0000 (14:29 -0700)]
libxl: rename libxlCreateDomEvents to libxlDomEventsRegister

libxlDomEventsRegister better reflects its purpose: register for
domain events from libxl.

11 years agoRename 'index' in virCapabilitiesGetCpusForNode
Ján Tomko [Tue, 11 Feb 2014 15:35:33 +0000 (16:35 +0100)]
Rename 'index' in virCapabilitiesGetCpusForNode

This shadows the index function on some systems (RHEL-6.4, FreeBSD 9):
../../src/conf/capabilities.c: In function 'virCapabilitiesGetCpusForNode':
../../src/conf/capabilities.c:1005: warning: declaration of'index'
      shadows a global declaration [-Wshadow]
/usr/include/strings.h:57: warning: shadowed declaration is here [-Wshadow]

11 years agovircapstest: Introduce virCapabilitiesGetCpusForNodemask test
Pradipta Kr. Banerjee [Tue, 11 Feb 2014 14:36:21 +0000 (14:36 +0000)]
vircapstest: Introduce virCapabilitiesGetCpusForNodemask test

This test creates a Fake NUMA topology with non-sequential cell ids
to check if libvirt properly handles the same

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
Signed-off-by: Pradipta Kr. Banerjee <bpradip@in.ibm.com>
11 years agoHandle non-sequential NUMA node numbers
Pradipta Kr. Banerjee [Tue, 11 Feb 2014 14:32:50 +0000 (14:32 +0000)]
Handle non-sequential NUMA node numbers

On some platforms like IBM PowerNV the NUMA node numbers can be
non-sequential. For eg. numactl --hardware o/p from such a machine looks
as given below

node distances:
   node   0   1  16  17
     0:  10  40  40  40
     1:  40  10  40  40
    16:  40  40  10  40
    17:  40  40  40  10

The NUMA nodes are 0,1,16,17

Libvirt uses sequential index as NUMA node numbers and this can
result in crash or incorrect results.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
Signed-off-by: Pradipta Kr. Banerjee <bpradip@in.ibm.com>
11 years agostorage: gluster: Set volume metadata in a separate function
Peter Krempa [Wed, 29 Jan 2014 12:17:12 +0000 (13:17 +0100)]
storage: gluster: Set volume metadata in a separate function

Extract the metadata setting code into a separate function for future
use.