Commit Graph

8588 Commits

Author SHA1 Message Date
John Ferlan
751bb8ce99 xend: Address some Coverity false positives
The various _for_i loops with both u.s.car and u.s.cdr were being reported
as COPY_PASTE errors by Coverity.  This just quiets those messages.
2013-01-22 16:59:45 +01:00
John Ferlan
05cc035189 selinux: Resolve resource leak using the default disk label
Commit id a994ef2d1 changed the mechanism to store/update the default
security label from using disk->seclabels[0] to allocating one on the
fly. That change allocated the label, but never saved it.  This patch
will save the label. The new virDomainDiskDefAddSecurityLabelDef() is
a copy of the virDomainDefAddSecurityLabelDef().
2013-01-22 14:34:12 +01:00
John Ferlan
e786b57889 util: Need to check child JSON allocation before use 2013-01-22 14:34:12 +01:00
John Ferlan
1130fa3188 parallels: Need to handle virJSONValueObjectGetString error 2013-01-22 14:34:12 +01:00
John Ferlan
8d3aa09283 rpc: Remove unnecessary calls
The code is not reachable as of commit id: bb85f229. Removed
virKeepAliveStop() and virObjectUnref() because 'ka' cannot be
anything but NULL at the cleanup label.
2013-01-22 14:34:11 +01:00
John Ferlan
7479026b5c security: Use virStrcpy to move the label 2013-01-22 14:34:11 +01:00
Peter Krempa
f4ece17665 qemu: Forbid snapshot names starting with '.'
Forbid the names to match the loading procedure of snapshots.
2013-01-22 11:54:52 +01:00
Michal Privoznik
074b6d45b0 safe{read,write}: Document usage with nonblocking FD
Currently, whenever somebody calls saferead() on nonblocking FD
(safewrite() is totally interchangeable for purpose of this message)
he might get wrong return value. For instance, in the first iteration
some data is read. The number of bytes read is stored into local
variable 'nread'. However, in next iterations we can get -1 from
read() with errno == EAGAIN, in which case the -1 is returned despite
fact some data has already been read. So the caller gets confused.
Bare read() should be used for nonblocking FD.
2013-01-21 20:18:28 +01:00
Peter Krempa
790f912b46 qemu: Reject attempts to create snapshots with names containig '/'
The snapshot name is used to create path to the definition save file.
When the name contains slashes the creation of the file fails. Reject
such names.
2013-01-21 11:48:45 +01:00
Peter Krempa
27054e1217 qemu: Don't return success if creation of snapshot save file fails
When the snapshot definition can't be saved, the
qemuDomainSnapshotCreate function succeeded without filling some of the
fields in the internal definition.

This patch removes the snapshot and returns failure if the XML file
cannot be written.
2013-01-21 11:48:45 +01:00
Michal Privoznik
31bee8572f Log flags passed to qemuMigrationPrepare{Tunnel,Direct} APIs
We are already logging other arguments passed, however, @flags
were missing there.
2013-01-18 18:14:00 +01:00
Daniel P. Berrange
81621f3e6e Fix race condition when destroying guests
When running virDomainDestroy, we need to make sure that no other
background thread cleans up the domain while we're doing our work.
This can happen if we release the domain object while in the
middle of work, because the monitor might detect EOF in this window.
For this reason we have a 'beingDestroyed' flag to stop the monitor
from doing its normal cleanup. Unfortunately this flag was only
being used to protect qemuDomainBeginJob, and not qemuProcessKill

This left open a race condition where either libvirtd could crash,
or alternatively report bogus error messages about the domain already
having been destroyed to the caller

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-18 15:45:38 +00:00
Jiri Denemark
de78bf604c Introduce virTypedParamsClear public API
The function is just a renamed public version of former
virTypedParameterArrayClear.
2013-01-18 15:04:00 +01:00
Jiri Denemark
54dd75fd97 Add virTypedParams* APIs
Working with virTypedParameters in clients written in C is ugly and
requires all clients to duplicate the same code. This set of APIs makes
this code for manipulating with virTypedParameters integral part of
libvirt so that all clients may benefit from it.
2013-01-18 15:03:58 +01:00
Peter Krempa
5c13ed4f02 qemu: Simplify condition with already extracted flag 2013-01-18 13:19:52 +01:00
Atsushi Kumagai
ffee627a4a storage: Fix lvcreate parameter for backingStore.
When virStorageBackendLogicalCreateVol() creates a snapshot for a
logical volume with backingStore element, it fails with the message
below:

  2013-01-17 03:10:18.869+0000: 1967: error : virCommandWait:2345 :
  internal error Child process (/sbin/lvcreate --name lvm-snapshot -L 51200K
  -s=/dev/lvm-pool/lvm-volume) unexpected exit status 3: /sbin/lvcreate:
  invalid option -- '='  Error during parsing of command line.

This is because virCommandAddArgPair() uses '=' to connect the two
parameters, it's unsuitable for -s option of the lvcreate.

Signed-off-by: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
2013-01-18 08:06:01 +01:00
Eric Blake
f403bdc189 build: fix build on BSD
A build on FreeBSD failed with:
util/virportallocator.c:108: error: storage size of 'addr' isn't known
util/virportallocator.c:123: error: 'INADDR_ANY' undeclared (first use in this function)

It turns out that while POSIX allows sockaddr_in to leak in through
<arpa/inet.h> (the way Linux does it), it is not mandatory, and
conforming applications are required to get it through <netinet/in.h>.

* src/util/virportallocator.c: Include header for struct
sockaddr_in.
* tests/virportallocatortest.c: Likewise.
2013-01-17 16:39:10 -07:00
John Ferlan
7d31dd6494 network: Remove dead code getting, but not using ipdef
The fetch of 'ipdef' in networkRefreshDhcpDaemon() when the loop to fill
in ipv4def fails to find an ipv4 address with dhcp defined. The filled in
ipdef value was not used.  Code was made unnecessary with commit it 2d5cd1.
2013-01-17 23:46:36 +01:00
John Ferlan
0cff3554f3 virobject: Remove the bogus ! from call to virObjectInitialize() 2013-01-17 23:46:36 +01:00
John Ferlan
ea79a49f31 esx: No need to check for objectSpec
Coverity complains that the objectSpec != NULL check was unnecessary because
there was no way to get to the label with objectSpec = NULL.
2013-01-17 23:46:35 +01:00
John Ferlan
e44d240092 qemu: Check valid activeDev before calling pciDeviceSetUsedBy 2013-01-17 23:46:35 +01:00
Daniel P. Berrange
55599102b4 Followup fix for integer wraparound in port allocator
Change iterator variable datatype to int
2013-01-17 19:15:57 +00:00
Viktor Mihajlovski
56fd513458 qemu: Double mutex unlock in qemuDomainModifyDeviceFlags
The driver mutex was unlocked in qemuDomainModifyDeviceFlags before
entering qemuDomainObjBeginJobWithDriver where it will be unlocked once
more leaving it in an undefined state. The result was that two
threads were simultaneously looking up the domain hash table during
multiple parallel device attach/detach operations.
Luckily this triggered a virHashIterationError.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2013-01-17 11:57:00 -07:00
Reinier Schoof
65fb9d49cc fixed xt_physdev warning when defining ip(6)tables rules
When starting a VM, /var/log/messages was spammed with the following message:
 xt_physdev: using --physdev-out in the OUTPUT, FORWARD and POSTROUTING chains for non-bridged traffic is not supported anymore.

With each extra VM I start, the messages get amplified
exponentially. This results in longer starting times every new VM,
relative the the previously started VM. When I ran a test with
starting 100 equal VM's, the first VM started in about 2 seconds, the
100th VM took 48 seconds to start. I'm running a vanilla 3.7.1 kernel,
but I have the same issue on VM hosts with kernel 3.2.28 or 3.2.0,
running libvirt 0.9.12 and 0.9.8 respectively.

Looking into the warning, it seemed that iptables need an extra argument,
--physdev-is-bridged, in commands like:
 iptables -A libvirt-out -m physdev --physdev-is-bridged --physdev-out vnet99 -g FP-vnet99

With that, the warnings in /var/log/messages are gone and running the
test again proved the 100th VM started in 3.8 seconds.
2013-01-17 11:32:26 -07:00
Laine Stump
877dab6ccf conf: don't fail to parse <boot> when parsing a single device
This resolves:

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

The symptom was that attempts to modify a network device using
virDomainUpdateDeviceFlags() would fail if the original device had a
<boot> element (e.g. "<boot order='1'/>"), even if the updated device
had the same <boot> element. Instead, the following error would be logged:

  cannot modify network device boot index setting

It's true that it's not possible to change boot order (internally
known as bootIndex) of a live device; qemuDomainChangeNet checks for
that, but the problem was that the information it was checking was
incorrect.

Explanation:

When a complete domain is parsed, a global (to the domain) "bootMap"
is passed down to the parse for each device; the bootMap is used to
make sure that devices don't have conflicting settings for their boot
orders.

When a single device is parsed by itself (as in the case of
virDomainUpdateDeviceFlags), there is no global bootMap that would be
appropriate to send, so NULL is sent instead. However, although the
lowest level function that parses just the boot order *does* simply
skip the sanity check in that case, the next higher level
"virDomainDeviceInfoParseXML" function refuses to call down to the
lower "virDomainDeviceBootParseXML" if bootMap is NULL. So, the boot
order is never set in the "new" device object, and when it is compared
to the original (which does have a boot order), they don't match.

The fix is to patch virDomainDeviceInfoParseXML to not care about
bootMap, and just always call virDomainDeviceInfoBootParseXML whenever
there is a <boot> element. When we are only parsing a single device,
we don't care whether or not any specified boot order is consistent
with the rest of the domain; we will always do this check later (in
the current case, we do it by verifying that the net bootIndex exactly
matches the old bootIndex).
2013-01-17 12:38:51 -05:00
Laine Stump
7d480a4650 network: use bandwidth from portgroup when appropriate
The bandwidth plug and unplug functions were assuming that an
interface's bandwidth setting was always specified directly in the
domain's <interface> definition, but that's not necessarily true - it
could have been obtained from a <portgroup> definition in the network
definition. This patch fixes those functions to use
virDomainNetGetActualBandwidth(), which gets the bandwidth pointer
from iface->data.network.actual if it exists, otherwise returns
iface->bandwidth.
2013-01-17 12:38:51 -05:00
John Ferlan
35ed25bde9 network: Resolve some issues around vlan copying
Remove extraneous check for 'netdef' when dereferencing for vlan.nTags.
Prior code would already check if netdef was NULL.

Coverity complained about a path where the 'vlan' was potentially valid,
but a prior checks may not have allocated 'iface->data.network.actual',
so like other paths it needs to be allocated on the fly.

Move the copying of vlan up earlier in networkAllocateActualDevice, so
that actual.type gets properly set.

Since the first assignment to vlan is redundant except in the case of
jumping immediately to validate from the start of the function,
eliminate its initial setting at the top of the function in favor of
calling the helper function virDomainNetGetActualVlan() (which doesn't
depend on the local vlan pointer being initialized) down at validate:

Signed-off-by: Laine Stump <laine@redhat.com>
2013-01-17 12:38:51 -05:00
Daniel P. Berrange
757e3d3af6 Fix inheritance of virNetClient
When creating the virClass object for virNetClient, we specified
virObject as the parent instead of virObjectLockable

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-17 17:28:47 +00:00
Peter Krempa
0e620e6669 lock_daemon: Simplify error handling
No need to check the run_dir variable twice for NULL.
2013-01-17 16:39:29 +01:00
Daniel P. Berrange
da5a8aee2b Avoid integer wrap on remotePortMax in QEMU driver
The QEMU driver default max port is 65535, but it then increments
this by 1 to 65536. This maps to 0 in an unsigned short :-( This
was apparently done so that for() loops could use "< max" instead
of "<= max". Remove this insanity and just make the loop do the
right thing.
2013-01-17 13:52:33 +00:00
Claudio Bley
5d9815b657 libvirt.c: fix typo in comment 2013-01-17 13:38:29 +01:00
Hu Tao
ad9e110cae include virterror_internal.h in threads.h
required by VIR_ONCE_GLOBAL_INIT using virSetError.
2013-01-16 17:30:22 -07:00
Hu Tao
dfa88e6455 include util.h in cgroup.h
required by VIR_ENUM_DECL.
2013-01-16 17:23:58 -07:00
Guido Günther
5c1a825167 Fix typo in variable name
that broke the build like:

  CC     libvirt_conf_la-domain_conf.lo
  conf/domain_conf.c: In function 'virDomainVcpuPinAdd':
  conf/domain_conf.c:11920:29: error: 'vpcupin' undeclared (first use in this function)
  conf/domain_conf.c:11920:29: note: each undeclared identifier is reported only once for each function it appears in
  make[3]: *** [libvirt_conf_la-domain_conf.lo] Error 1
2013-01-16 20:55:42 +01:00
Jim Fehlig
c1eda06478 libxl: Fix cleanup on domain start error
If building the libxl domain config fails, cleanup before returning
failure.
2013-01-16 10:13:26 -07:00
Jim Fehlig
52947fe3ae libxl: Check for libxl_ctx_alloc failure 2013-01-16 10:13:26 -07:00
Jim Fehlig
7459cae9b0 libxl: Don't free domain death event
Callers should not free death events provided by libxl_evdisable_FOO().
2013-01-16 10:13:26 -07:00
Jim Fehlig
f426ab08fb libxl: Use consistent parameter naming scheme
Use consistent parameter names throughout the libxl timeout and fd
event functions.
2013-01-16 10:13:26 -07:00
Jim Fehlig
130cbf193a libxl: Use consistent style for function definitions
Commit dfa1e1dd added functions whose definitions do not conform
to the style used in the libxl driver.  Change these functions to
be consistent throughout the driver.
2013-01-16 10:13:26 -07:00
John Ferlan
687554cd50 locking: Resolve resource leaks on non error path
Both 'dir' and 'path' were not free'd on successful return
2013-01-16 17:51:30 +01:00
Ján Tomko
65aa3e3414 conf: fix leak in virDomainVcpuPinAdd
Fix the leak of vcpupin on failure to allocate cpumask and the leak of
cpumask if we fail to expand vcpupin_list.
2013-01-16 17:51:14 +01:00
Ján Tomko
a69d7a00c4 conf: fix class_id bitmap leak in virNetworkObj
Commit '07d1b6b' added class_id bitmap to virNetworkObj but never freed
it.
2013-01-16 17:51:14 +01:00
Ján Tomko
31494974c4 qemu: fix QEMU_CAPS_NO_ACPI detection
In commit c4bbaaf8, caps->arch was checked uninitialized, rendering the
whole check useless.

This patch moves the conditional setting of QEMU_CAPS_NO_ACPI to
qemuCapsInitQMP, and removes the no longer needed exception for S390.

It also clears the flag for all non-x86 archs instead of just S390 in
qemuCapsInitHelp.
2013-01-16 17:37:04 +01:00
Daniel P. Berrange
0995b00084 Convert libxl driver over to use virPortAllocator APIs
Replace the current libxl driver code for managing port
reservations with the new virPortAllocator APIs.
2013-01-16 11:02:58 +00:00
Daniel P. Berrange
dfb1022c72 Convert QEMU driver over to use virPortAllocator APIs
Replace the current QEMU driver code for managing port
reservations with the new virPortAllocator APIs.
2013-01-16 11:02:58 +00:00
Daniel P. Berrange
9c9d4d32d3 Add a port allocator class
Introduce a virPortAllocator for managing TCP port allocations.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-16 11:02:58 +00:00
Daniel P. Berrange
bba93d40da Convert all rpc classes over to virObjectLockable 2013-01-16 11:02:58 +00:00
Daniel P. Berrange
325b02b5a3 Convert virDomainObj, qemuAgent, qemuMonitor, lxcMonitor to virObjectLockable
The  virDomainObj, qemuAgent, qemuMonitor, lxcMonitor classes
all require a mutex, so can be switched to use virObjectLockable

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-16 11:02:58 +00:00
John Ferlan
79611c5968 util: Check for negative indent in virBufferAdd
Since virBufferGetIndent() will check and fail on buf->error, I
removed that check from virBufferAdd() and used the -1 return as the
way to exit.
2013-01-16 10:52:39 +01:00
John Ferlan
d514d7773c rpc: Check and message setsockopt()
Check status when attempting to set SO_REUSEADDR flag on outgoing connection
On failure, VIR_WARN(), but continue to connect. This code path is on the
sender side where the setting is just a hint and would only take effect if
the sender is overflowed with TCP connections.  Inability to set doesn't mean
failure to establish a connection.
2013-01-16 10:43:13 +01:00
John Ferlan
4d4a8aa9ad parallels: Remove unused JSON fetch of "OS"
Commit id ac1c77f0 removed the "os" field in "parallelsDomObj" that
commit id aa296e6c had added and the data is not used by the function.
2013-01-15 23:43:10 +01:00
John Ferlan
39078bd4e0 util: Remove the unused setting of 'res' for virHashLookup return 2013-01-15 23:43:10 +01:00
John Ferlan
e8cd571b2c locking: Remove unnecessary setting of lockspace
In virLockSpaceProtocolDispatchNew() the returned value of lockspace from
virLockDaemonFindLockSpace() is overwritten by the virLockSpaceNew() return.
Coverity complains that it's unused.

In virLockSpaceProtocolDispatchCreateLockSpace() lockspace is also overwritten
in a similar manner resulting in the same Coverity message.
2013-01-15 23:43:10 +01:00
John Ferlan
a75d762fcd openvz: Need to check 'vm' first before dereferencing 'def' 2013-01-15 23:43:10 +01:00
John Ferlan
3f9d6c3566 interface: Need to check ifacedef->mac not just ifacedef after strdup() 2013-01-15 23:43:10 +01:00
Peter Krempa
761fc48136 qemu: Don't update count of vCPUs if hot-unplug has failed
After live change of cpu counts, the number of processor threads is
verified. This patch makes use of this approach to check if qemu ignored
the request for cpu hot-unplug and report an appropriate message.
2013-01-15 23:43:10 +01:00
John Ferlan
dc350eabb3 xen: Ignore return status for TCP_NODELAY 2013-01-15 15:21:30 -07:00
Daniel P. Berrange
b545f65d16 Add a virObjectLockable class holding a mutex
A great many virObject instances require a mutex, so introduce
a convenient class for this which provides a mutex. This avoids
repeating the tedious init/destroy code

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-15 19:21:33 +00:00
Daniel P. Berrange
69218922e8 Allow for multi-level inheritance of virObject classes
Currently all classes must directly inherit from virObject.
This allows for arbitrarily deep hierarchy. There's not much
to this aside from chaining up the 'dispose' handlers from
each class & providing APIs to check types.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-15 19:21:31 +00:00
Gao feng
8d63af22de libvirt: lxc: don't mkdir when selinux is disabled
libvirt lxc will fail to start when selinux is disabled.
error: Failed to start domain noroot
error: internal error guest failed to start: PATH=/bin:/sbin TERM=linux container=lxc-libvirt container_uuid=b9873916-3516-c199-8112-1592ff694a9e LIBVIRT_LXC_UUID=b9873916-3516-c199-8112-1592ff694a9e LIBVIRT_LXC_NAME=noroot /bin/sh
2013-01-09 11:04:05.384+0000: 1: info : libvirt version: 1.0.1
2013-01-09 11:04:05.384+0000: 1: error : lxcContainerMountBasicFS:546 : Failed to mkdir /sys/fs/selinux: No such file or directory
2013-01-09 11:04:05.384+0000: 7536: info : libvirt version: 1.0.1
2013-01-09 11:04:05.384+0000: 7536: error : virLXCControllerRun:1466 : error receiving signal from container: Input/output error
2013-01-09 11:04:05.404+0000: 7536: error : virCommandWait:2287 : internal error Child process (ip link del veth1) unexpected exit status 1: Cannot find device "veth1"

fix this problem by checking if selinuxfs is mounted
in host before we try to create dir /sys/fs/selinux.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
2013-01-15 12:01:22 -07:00
Eric Blake
0899322d61 build: add new file, for lxc_protocol checking
Commit 509eb51 added lxc_protocol.x; but without the initial
checkin of src/lxc_protocol-structs, 'make check' would fail for
anyone with pdwtags installed:
make[3]: *** No rule to make target `lxc_protocol-structs', needed by `check-protocol'.  Stop.

* src/lxc_protocol-structs: New file.
2013-01-15 12:01:22 -07:00
Daniel P. Berrange
2b1cd1f148 Add implementation of virDomainLxcOpenNamespace to LXC driver
The virDomainLxcOpenNamespace method needs to open every file
in /proc/$INITPID/ns and return the open file descriptor to the
client application.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-15 18:16:54 +00:00
Daniel P. Berrange
509eb51e7c Implement the RPC protocol for the libvirt-lxc.la library
Add the infrastructure for the libvirt-lxc.la library to
the remote protocol client and daemon

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-15 18:16:53 +00:00
John Ferlan
8bc18eaac6 xen: Resolve resource leak with 'cpuset'
Make cpuset local to the while loop and free it once done with it each
time through the loop.  Add a sa_assert() to virBitmapParse() to keep Coverity
from believing there could be a negative return and possible resource leak.
2013-01-15 14:50:35 +01:00
John Ferlan
c6248f0484 interface: Resolve resource leak wth 'tmp_iface_objs' 2013-01-15 14:50:27 +01:00
John Ferlan
0f45d8a263 storage: Resource resource leak using 'tmp_vols' 2013-01-15 14:50:21 +01:00
John Ferlan
159f59f34a test: Resource resource leak with 'tmp_vols' 2013-01-15 14:50:15 +01:00
John Ferlan
af3262e26f rpc: Avoid resource leak of 'socks' if any object append fails 2013-01-15 14:50:02 +01:00
John Ferlan
4f85cfdfad util: Resolve resource leak for 'res' in virSetInherit error path. 2013-01-15 14:49:54 +01:00
John Ferlan
5d5c6ccc01 interface: Need to initialize 'add_to_list' 2013-01-15 12:12:19 +01:00
John Ferlan
0b79971b84 lxc: Initialize dst due to potential cleanup usage before setting 2013-01-15 12:12:10 +01:00
John Ferlan
2581270527 openvz: Need to initialize 'ret' for kb_per_pages error path 2013-01-15 12:12:00 +01:00
John Ferlan
bbf1806f31 parallels: Resolve issues with uninitialized 'ret' value
Added some messaging to indicate possible failure from virXPathULongLong()
as well
2013-01-15 12:11:34 +01:00
John Ferlan
71da3b66a8 storage: Need to also VIR_FREE(reg)
Commit-id 'afc4631b' added the regfree(reg) to free resources alloc'd
during regcomp; however, reg still needed to be VIR_FREE()'d. The call
to regfree() also didn't account for possible NULL value.  Reformatted
the call to be closer to usage.
2013-01-15 12:05:34 +01:00
Eric Blake
1bf661caf4 build: further fixes for broken if_bridge.h
Commit c308a9ae was incomplete; it resolved the configure failure,
but not a later build failure.

* src/util/virnetdevbridge.c: Include pre-req header.
* configure.ac (AC_CHECK_HEADERS): Prefer standard in.h over
non-standard ip6.h.
2013-01-14 21:08:23 -07:00
Daniel P. Berrange
688b3ecfe9 Fix typo LIBCURL_{CFLAGS,LIBS} to CURL_{CFLAGS,LIBS}
Some places missed the conversion from LIBCURL_{CFLAGS,LIBS} to
CURL_{CFLAGS,LIBS}, and a part of curl check was left in
configure.ac instead of m4/virt-curl.m4 by mistake
2013-01-14 17:22:31 +00:00
Daniel P. Berrange
2ec48f7aa9 Fix build due to previous LXC patch
Mark virDomainLxcEnterNamespace as skipped in python binding
and remove reference to lxcDomainOpenNamespace which doesn't
arrive until a later patch
2013-01-14 16:35:40 +00:00
Daniel P. Berrange
3d1596b048 Introduce an LXC specific public API & library
This patch introduces support for LXC specific public APIs. In
common with what was done for QEMU, this creates a libvirt_lxc.so
library and libvirt/libvirt-lxc.h header file.

The actual APIs are

  int virDomainLxcOpenNamespace(virDomainPtr domain,
                                int **fdlist,
                                unsigned int flags);

  int virDomainLxcEnterNamespace(virDomainPtr domain,
                                 unsigned int nfdlist,
                                 int *fdlist,
                                 unsigned int *noldfdlist,
                                 int **oldfdlist,
                                 unsigned int flags);

which provide a way to use the setns() system call to move the
calling process into the container's namespace. It is not
practical to write in a generically applicable manner. The
nearest that we could get to such an API would be an API which
allows to pass a command + argv to be executed inside a
container. Even if we had such a generic API, this LXC specific
API is still useful, because it allows the caller to maintain
the current process context, in particular any I/O streams they
have open.

NB the virDomainLxcEnterNamespace() API is special in that it
runs client side, so does not involve the internal driver API.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-14 13:58:34 +00:00
Daniel P. Berrange
cf7ac00ebd Rename HAVE_POLKIT to WITH_POLKIT 2013-01-14 13:29:55 +00:00
Daniel P. Berrange
0eec69729d Convert ssh2 check to use LIBVIRT_CHECK_PKG
This converts the libssh2 configure check to use LIBVIRT_CHECK_PKG.
Previously it would check version 1.0 and 1.3, but this simplifies
things to just require version 1.3
2013-01-14 13:29:44 +00:00
Daniel P. Berrange
e1e94f2ed9 Rename HAVE_LIBSSH2 to WITH_SSH2 2013-01-14 13:29:35 +00:00
Daniel P. Berrange
d9a2a993dd Rename HAVE_LIBCURL to WITH_CURL 2013-01-14 13:29:19 +00:00
Daniel P. Berrange
8c1e9be48f Rename HAVE_FUSE to WITH_FUSE 2013-01-14 13:26:47 +00:00
Daniel P. Berrange
bccd4a8cbc Rename HAVE_GNUTLS to WITH_GNUTLS 2013-01-14 13:26:47 +00:00
Daniel P. Berrange
7db9ac8260 Convert HAVE_LIBBLKID to WITH_BLKID
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-14 13:26:47 +00:00
Daniel P. Berrange
24120066a4 Convert HAVE_HAL to WITH_HAL
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-14 13:26:47 +00:00
Daniel P. Berrange
d3b05abfa9 Convert HAVE_UDEV to WITH_UDEV
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-14 13:26:47 +00:00
Daniel P. Berrange
2de152d20d Convert HAVE_AVAHI to WITH_AVAHI
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-14 13:26:34 +00:00
Daniel P. Berrange
da77f04ed5 Convert HAVE_DBUS to WITH_DBUS
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-14 13:25:47 +00:00
Daniel P. Berrange
ef38965c30 Convert HAVE_CAPNG to WITH_CAPNG
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-14 13:25:06 +00:00
Daniel P. Berrange
6f736c83e5 Convert HAVE_NUMACTL to WITH_NUMACTL
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-14 13:25:06 +00:00
Daniel P. Berrange
63f18f3786 Convert HAVE_SELINUX to WITH_SELINUX
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-14 13:24:49 +00:00
Eric Blake
a18d9012a2 build: fix incomplete WITH_SASL conversion
Commit 321a7d53 missed a spot.

* src/rpc/virnetsocket.c (virNetSocketPreExecRestart): Use right
conditional.
2013-01-11 10:30:18 -07:00
Peter Krempa
6e1e26e9a7 qemu: Fix grouping of capabilities strings
Commit f8d478b6df broke the grouping by
five items.
2013-01-11 17:43:49 +01:00
Peter Krempa
e6d74d8db5 network: Report real error if addition of firewall rules fails
If addition of rules in networkAddIptablesRules() failed the real error
was masked by error reported when trying to clean up the remaining
rules.

With this patch the original error message is saved and set back after
the removal is complete.
2013-01-11 14:05:52 +01:00
Peter Krempa
bb19491cf5 network: bridge: Fix regression when defining persistent networks
Commit 0211fd6e04 introduced regression
where newly defined networks were not made persistent.

This patch makes the network persistent on each successful definition.
2013-01-11 14:05:51 +01:00
Daniel P. Berrange
e424220a0e Convert HAVE_AUDIT to WITH_AUDIT
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-11 11:03:23 +00:00
Daniel P. Berrange
321a7d53f3 Convert HAVE_SASL to WITH_SASL
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-11 11:03:23 +00:00
Daniel P. Berrange
4da3000c66 Convert HAVE_SANLOCK to WITH_SANLOCK
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-11 11:03:23 +00:00
Daniel P. Berrange
654c709baa Convert yajl check to use LIBVIRT_CHECK_LIB_ALT
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-11 11:03:23 +00:00