Commit Graph

15786 Commits

Author SHA1 Message Date
Daniel P. Berrange
d24e6b8b1e 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>
2014-02-17 15:39:55 +00:00
Daniel P. Berrange
2c2bec94d2 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>
2014-02-17 15:39:55 +00:00
Daniel P. Berrange
a537827d15 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>
2014-02-17 15:39:37 +00:00
Daniel P. Berrange
c364897222 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>
2014-02-17 15:11:06 +00:00
Daniel P. Berrange
7a44af963e 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>
2014-02-17 15:11:06 +00:00
Michal Privoznik
3b2c279449 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>
2014-02-17 11:38:15 +01:00
Michal Privoznik
287d30a816 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>
2014-02-17 11:38:15 +01:00
Peter Krempa
98bbc8d59a 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 362da8209d.
2014-02-14 17:39:37 +01:00
Ján Tomko
665344da01 Add tests for secret XML parsing
also validate it against the RNG schema.
2014-02-14 16:47:14 +01:00
Ján Tomko
032f0d5b3d docs: remove <auth> from secret XML format
This belongs to the pool definition.
2014-02-14 16:47:14 +01:00
Cédric Bosdonnat
18fb3df463 Forgot to add lxcconf2xmldata to dist. 2014-02-14 16:13:54 +01:00
Peter Krempa
0a584b1fcd lxc: Don't shadow global symbol "link"
Yet another variable name frowned upon by older compilers. Introduced in
commit b73c029d.
2014-02-14 14:01:45 +01:00
Ján Tomko
0ee9081215 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
2014-02-14 13:18:35 +01:00
Ján Tomko
531bc0bbd0 Split out bind() from virPortAllocatorAcquire 2014-02-14 13:18:35 +01:00
Peter Krempa
ad95fa5957 storage: gluster: Don't leak private data when storage file init fails
In a44b7b87bc 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.
2014-02-14 13:08:39 +01:00
Peter Krempa
8d8b32b0da storage: Fix build with older compilers afeter gluster snapshot series
In commit e32268184b 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.
2014-02-14 11:46:37 +01:00
Peter Krempa
3cf074ee40 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.
2014-02-14 11:07:29 +01:00
Peter Krempa
7183d7d2e8 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.
2014-02-14 11:07:29 +01:00
Peter Krempa
8f4091d677 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.
2014-02-14 11:07:29 +01:00
Peter Krempa
a44b7b87bc storage: Add storage file backends for gluster
Implement storage backend functions to deal with gluster volumes and
implement the "stat" and "unlink" backend APIs.
2014-02-14 11:07:23 +01:00
Peter Krempa
e62d09b155 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.
2014-02-14 10:47:57 +01:00
Peter Krempa
e32268184b 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.
2014-02-14 10:47:56 +01:00
Peter Krempa
6fb5a397bf 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
2014-02-14 10:47:56 +01:00
Peter Krempa
f8f020da0a 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
2014-02-14 10:47:56 +01:00
Eric Blake
dca5ce4c65 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>
2014-02-13 06:39:51 -07:00
Eric Blake
d181452132 Revert "spec: require libvirt-wireshark from libvirt metapackage"
This reverts commit 8d6c3659b8.

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.
2014-02-13 06:39:19 -07:00
Cédric Bosdonnat
7554a85be2 lxc from native: removed now remaining useless line 2014-02-13 07:55:05 -05:00
Philipp Hahn
760498fdc7 Fix stream related spelling mistakes
Remove double "is".
Consistent spelling of all-uppercase I/O.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2014-02-13 11:12:02 +01:00
Eric Blake
8d6c3659b8 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>
2014-02-12 13:27:38 -07:00
Thierry Parmentelat
cf76c4b3dd 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>
2014-02-12 13:24:01 -07:00
Thierry Parmentelat
902f6148de spec: require libvirt-daemon-driver-interface only when built
Signed-off-by: Eric Blake <eblake@redhat.com>
2014-02-12 13:14:11 -07:00
Cédric Bosdonnat
3d58fa3f85 LXC from native: convert blkio throttle config 2014-02-12 17:52:47 +00:00
Cédric Bosdonnat
f4b28d5c8a LXC: added some doc on domxml-from-native with mention of limitations 2014-02-12 17:52:47 +00:00
Cédric Bosdonnat
a09bbc024d 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
2014-02-12 17:52:47 +00:00
Cédric Bosdonnat
d1520c5c9a LXC from native: map block filesystems 2014-02-12 17:52:47 +00:00
Cédric Bosdonnat
0f13a525d2 LXC from native: map lxc.arch to /domain/os/type@arch 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
5b8bfb0276 LXC from native: add lxc.cgroup.blkio.* mapping 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
281e2990ee LXC from native: map lxc.cgroup.cpuset.* 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
4f3f7aea6c LXC from native: map lxc.cgroup.cpu.* 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
13b9946eb5 LXC from native: migrate memory tuning 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
99d8cddfbe LXC from native: convert lxc.id_map into <idmap> 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
8e45b88772 LXC from native: convert macvlan network configuration 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
f01fe54e75 LXC from native: convert lxc.tty to console devices 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
69fc236243 LXC from native: convert phys network types to net hostdev devices 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
b73c029d83 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
2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
7bfd6e97ec 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.
2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
a41680f8c5 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.
2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
197b13e5d9 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.
2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
7195c807b2 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.
2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
3daa14834a 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.
2014-02-12 17:52:46 +00:00