Commit Graph

10332 Commits

Author SHA1 Message Date
Eric Blake
0fbafe9c50 maint: add mailmap entry for Dan Walsh
As confirmed with Dan on IRC.

* .mailmap: List Dan's preferred 'shortlog' name.
2012-07-18 15:34:53 -06:00
Matthias Bolte
675aef9ef6 esx: Extend esxVI_CURL_Download for partial downloads
Also ensure that the virBuffer used to store the downloaded data
does not overflow.
2012-07-18 22:47:11 +02:00
Daniel P. Berrange
4423f3bece Replace use of interfaceReportError with virReportError
Update the netcf driver to use virReportError instead of the
interfaceReportError custom macro
2012-07-18 21:27:30 +01:00
Daniel P. Berrange
fa7ebc174f Replace use of virNWFilterReportError with virReportError
Update the network filter driver to use virReportError instead
of the virNWFilterReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 21:16:25 +01:00
Daniel P. Berrange
6d964bcf66 Add missing "%s" with constant string error message in nwfilter_dhcpsnoop.c
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 21:15:43 +01:00
Dan Walsh
9f5ef4d9b3 lxcContainerMountCGroups also mounts a tmpfs that needs to be labeled.
This patch passes down the sec_mount_options to the
lxcContainerMountCGroups function and then mounts the tmpfs with
the correct label.
2012-07-18 20:52:18 +01:00
Sebastian Wiedenroth
29bc4fe646 Add a sheepdog backend for the storage driver
This patch brings support to manage sheepdog pools and volumes to libvirt.
It uses the "collie" command-line utility that comes with sheepdog for that.

A sheepdog pool in libvirt maps to a sheepdog cluster.
It needs a host and port to connect to, which in most cases
is just going to be the default of localhost on port 7000.

A sheepdog volume in libvirt maps to a sheepdog vdi.
To create one specify the pool, a name and the capacity.
Volumes can also be resized later.

In the volume XML the vdi name has to be put into the <target><path>.
To use the volume as a disk source for virtual machines specify
the vdi name as "name" attribute of the <source>.
The host and port information from the pool are specified inside the host tag.

  <disk type='network'>
    ...
    <source protocol="sheepdog" name="vdi_name">
      <host name="localhost" port="7000"/>
    </source>
  </disk>

To work right this patch parses the output of collie,
so it relies on the raw output option. There recently was a bug which caused
size information to be reported wrong. This is fixed upstream already and
will be in the next release.

Signed-off-by: Sebastian Wiedenroth <wiedi@frubar.net>
2012-07-18 20:08:27 +01:00
Daniel J Walsh
e00184291e Mount all tmpfs filesystems with correct SELinux label
Basically within a Secure Linux Container (virt-sandbox) we want all content
that the process within the container can write to be labeled the same.  We
are labeling the physical disk correctly but when we create "RAM" based file
systems
libvirt is not labeling them, and they are defaulting to tmpfs_t, which will
will not allow the processes to write.  This patch labels the RAM based file
systems correctly.
2012-07-18 19:49:22 +01:00
Daniel P. Berrange
df5232f554 Replace use of virNodeDeviceReportError with virReportError
Update the node device driver to use virReportError instead of
the virNodeDeviceReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 19:34:26 +01:00
Daniel P. Berrange
54e520d3aa Replace use of virSecretReportError with virReportError
Update the secret driver to use virReportError instead of the
virSecretReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 19:34:21 +01:00
Daniel P. Berrange
d8a1c4c49f Replace use of virStorageReportError with virReportError
Update the storage driver to use virReportError instead of
the virStorageReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 19:34:16 +01:00
Daniel P. Berrange
89e23562c9 Add missing "%s" format to const error message in RBD storage driver
When passing a const message string to the error reporting APIs
RBD forgot to use "%s" to avoid GCC format string warnings

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 19:33:03 +01:00
Daniel P. Berrange
1e0bb184a7 Convert all files in src/conf/ to use virReportError()
This removes all the per-file error reporting macros
from the code in src/conf/

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 19:01:50 +01:00
Daniel P. Berrange
7c7d01e15f Add missing _(...) around 2 error messages in test driver
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 16:38:54 +01:00
Daniel P. Berrange
db582fa25f Fix parameter passed with VIR_ERR_INVALID_ARG in sanlock driver
The VIR_ERR_INVALID_ARG is typically given the function name
via __FUNCTION__

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 16:37:48 +01:00
Daniel P. Berrange
7c45ad4ba2 Convert all files in src/rpc/ to use virReportError()
This rmoves all the per-file error reporting macros
from the code in src/rpc/

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 16:31:40 +01:00
Daniel P. Berrange
f6d4405e3c Convert (nearly) all files in src/util/ to use virReportError()
This removes nearly all the per-file error reporting macros
from the code in src/util/. A few custom macros remain for the
case, where the file needs to report errors with a variety of
different codes or parameters

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 16:31:35 +01:00
Daniel P. Berrange
8a89c08069 Fix bogus cast to (int) in virNetServerMDNSTimeoutNew
The virNetServerMDNSTimeoutNew method was casting a long long
to an int when reporting errors. This should just be using
%lld instead of %d, avoiding the need to cast

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 16:31:31 +01:00
Daniel P. Berrange
605df4f4d9 Add missing "%s" with constant string error message in stats_linux.c
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 16:31:23 +01:00
Daniel P. Berrange
c4897029c9 Remove newline from end of error message in virnodesuspend.c
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 14:01:23 +01:00
Daniel P. Berrange
7b5031b952 Add _(...) around two error messages in src/util/
The virnetdevtap.c and viruri.c files had two error report
messages which were not annotated with _(...)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 14:01:17 +01:00
Daniel P. Berrange
7e94acd4fc Introduce virReportError macro for general error reporting
Nearly every source file does something like

  #define VIR_FROM_THIS VIR_FROM_FOO
  #define virFooReportErorr(code, ...) \
     virReportErrorHelper(VIR_FROM_THIS, code,  __FILE__,    \
                          __FUNCTION__, __LINE__, \
                          __VA_ARGS__)

This creates needless duplication and inconsistent error
reporting function names in each file. It is trivial to
just have virterror_internal.h provide a virReportError
macro that is equivalent

* src/util/virterror_internal.h: Define virReportError(code, ...)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 14:01:10 +01:00
Jiri Denemark
17f3be079c remote: Fix locking in stream APIs
Remote driver needs to make sure the driver lock is released before
entering client IO loop as that may block indefinitely in poll(). As a
direct consequence of not following this in stream APIs, tunneled
migration to a destination host which becomes non-responding may block
qemu driver. Luckily, if keepalive is turned for p2p migrations, both
remote and qemu drivers will get automagically unblocked after keepalive
timeout.
2012-07-17 19:31:45 +02:00
Jiri Denemark
c7d5cdb15b xenapi: Convert to virMacAddr 2012-07-17 17:55:52 +02:00
Michal Privoznik
9d1938896c nwfilter: Convert to virMacAddrPtr not virMacAddrPtr*
My previous patch wasn't complete as it converted from
(unsigned char *) to (virMacAddrPtr *). It should be
(virMacAddrPtr) only.
2012-07-17 16:29:43 +02:00
Michal Privoznik
14197c7472 nwfilter: Convert to virMacAddrPtr completely
The previous commit (387117ad92) was incomplete leaving those
who does not use libpcap with uncompilable sources beacuse
of incomplete conversion of virNWFilterDHCPSnoopReq function.
2012-07-17 16:05:30 +02:00
Cole Robinson
2d98ee5b35 configure: rbd doesn't need -lcrypto
See https://www.redhat.com/archives/libvir-list/2012-July/msg00493.html

Basically building against librbd doesn't seem to actually require -lcrypto.

Also report the rbd linker flags in configure output
2012-07-17 09:49:53 -04:00
Stefan Berger
387117ad92 Convert 'raw MAC address' usages to use virMacAddr
Introduce new members in the virMacAddr 'class'
- virMacAddrSet: set virMacAddr from a virMacAddr
- virMacAddrSetRaw: setting virMacAddr from raw 6 byte MAC address buffer
- virMacAddrGetRaw: writing virMacAddr into raw 6 byte MAC address buffer
- virMacAddrCmp: comparing two virMacAddr
- virMacAddrCmpRaw: comparing a virMacAddr with a raw 6 byte MAC address buffer

then replace raw MAC addresses by replacing

- 'unsigned char *' with virMacAddrPtr
- 'unsigned char ... [VIR_MAC_BUFLEN]' with virMacAddr

and introduce usage of above functions where necessary.
2012-07-17 08:07:59 -04:00
Jiri Denemark
87c8623161 qemu: Do not fail virConnectCompareCPU if host CPU is not known
When host CPU could not be properly detected, virConnectCompareCPU will
just report that any CPU is incompatible with host CPU instead of
failing.
2012-07-16 13:21:38 +02:00
Jiri Denemark
8e6fb68f1f qemu: Fix probing for guest capabilities
Even though qemu-kvm binaries can be used in TCG mode, libvirt would
only detect them if /dev/kvm was available. Thus, one would need to make
a /usr/bin/qemu symlink to be able to use TCG mode with qemu-kvm in an
environment without KVM support.

And even though QEMU is able to make use of KVM, libvirt would not
advertise KVM support unless there was a qemu-kvm symlink available.

This patch fixes both issues.
2012-07-16 11:45:37 +02:00
Michal Privoznik
a8d63a485e docs: Improve patch submission guidelines
We should really advise (new) developers to send rebased patches
that apply cleanly and use git-send-email rather than all other
obscure ways.
2012-07-16 11:05:12 +02:00
Daniel P. Berrange
1d9d5103b4 Wire up handling for QMP's BALLOON_EVENT
If QEMU supports the BALLOON_EVENT QMP event, then we can
avoid invoking 'query-balloon' when returning XML or the
domain info.

* src/qemu/qemu_capabilities.c, src/qemu/qemu_capabilities.h:
  Add QEMU_CAPS_BALLOON_EVENT
* src/qemu/qemu_driver.c: Skip query-balloon in
  qemudDomainGetInfo and qemuDomainGetXMLDesc if we have
  QEMU_CAPS_BALLOON_EVENT set
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Check
  for BALLOON_EVENT at connect to monitor. Add callback
  for balloon change notifications
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h:
  Add handling of BALLOON_EVENT and impl 'query-events'
  check

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-14 16:02:34 +08:00
Daniel P. Berrange
7ed6d7dda7 Define public API for receiving guest memory balloon events
When the guest changes its memory balloon applications may want
to know what the new value is, without having to periodically
poll on XML / domain info. Introduce a "balloon change" event
to let apps see this

* include/libvirt/libvirt.h.in: Define the
  virConnectDomainEventBalloonChangeCallback callback
  and VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE constant
* python/libvirt-override-virConnect.py,
  python/libvirt-override.c: Wire up helpers for new event
* daemon/remote.c: Helper for serializing balloon event
* examples/domain-events/events-c/event-test.c,
  examples/domain-events/events-python/event-test.py: Add
  example of balloon event usage
* src/conf/domain_event.c, src/conf/domain_event.h: Handling
  of balloon events
* src/remote/remote_driver.c: Add handler of balloon events
* src/remote/remote_protocol.x: Define wire protocol for
  balloon events
* src/remote_protocol-structs: Likewise.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-14 16:02:26 +08:00
Chuck Short
db4eba91a7 ARMHF: CPU Support for armhf.
Adding CPU encoder/decoder for armhf to avoid runtime error messages.

Signed-off-by: Chuck Short <chuck.short@canonical.com>
2012-07-13 10:03:22 -06:00
Hu Tao
102c69414c fix failure when building with --disable-debug
When building with --disable-debug, VIR_DEBUG expands to a nop.
But parameters to VIR_DEBUG can be variables that are passed only
to VIR_DEBUG. In the case the building system complains about unused
variables.
2012-07-13 06:38:18 -06:00
Viktor Mihajlovski
ece765959a virsh: remove unnecessary sleep for nodecpustats --percent
Fix for a minor issue:
the sleep(1) statement was called twice,
effectively doubling the elapsed time
execution "virsh nodecpustats --percent".

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2012-07-13 11:32:07 +02:00
Jiri Denemark
3189dfb163 Clarify direct migration
When --direct is used when migrating a domain running on a hypervisor
that does not support direct migration (such as QEMU), the caller would
get the following error message:

    this function is not supported by the connection driver:
    virDomainMigrateToURI2

which is a complete nonsense since qemu driver implements
virDomainMigrateToURI2. This patch would emit a more sensible error in
this case:

    Requested operation is not valid: direct migration is not supported
    by the connection driver
2012-07-13 09:15:18 +02:00
Christophe Fergeau
efe6c80211 Fix daemon auto-spawning
Commit 32a9aac switched libvirt to use the XDG base directories
to locate most of its data/config. In particular, the per-user socket
for qemu:///session is now stored in the XDG runtime directory.
This directory is located by looking at the XDG_RUNTIME_DIR environment
variable, with a fallback to ~/.cache/libvirt if this variable is not
set.

When the daemon is autospawned because a client application wants
to use qemu:///session, the daemon is ran in a clean environment
which does not contain XDG_RUNTIME_DIR. It will create its socket
in ~/.cache/libvirt. If the client application has XDG_RUNTIME_DIR
set, it will not look for the socket in the fallback place, and will
fail to connect to the autospawned daemon.

This patch adds XDG_RUNTIME_DIR to the daemon environment before
auto-starting it. I've done this in virNetSocketForkDaemon rather
than in virCommandAddEnvPassCommon as I wasn't sure we want to pass
these variables to other commands libvirt spawns. XDG_CACHE_HOME
and XDG_CONFIG_HOME are also added to the daemon env as it makes use
of those as well.
2012-07-12 13:52:36 +02:00
Daniel P. Berrange
1ffc78b54b Support creation of sparse LVM volumes
When calling 'lvcreate' if specifying both the '-L' and
'--virtualsize' options, the latter will be treated as
the capacity and the former as the allocation. This can
be used to support sparse volume creation. In addition,
when listing volumes it is necessary to include the 'size'
field in lvs output, so that we can detect sparse volume
allocation correctly.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-12 11:02:26 +01:00
Daniel P. Berrange
258e06c85b Remove all use of virRun in storage code
To make it easier to dynamically change the command line ARGV,
switch all storage code over to use virCommandPtr APIs for
running programs

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-12 11:02:09 +01:00
Guido Günther
0f9ad736cb virsh: remove extra space between function name and opening brace
to match our CodingStyle.
2012-07-11 20:50:14 +02:00
Sascha Peilicke
5079a7b3e2 Fix directory removal in filesystem storage driver
Fix the virStorageBackendFileSystemVolDelete method to not use
unlink() unconditionally. It must use rmdir() for volumes which
are directories. It should also raise an error if given a volume
which has the network/block type.
2012-07-11 16:42:06 +01:00
Osier Yang
8a544719aa storage: Default pool permission mode to 0755
Per the typical use of libvirt is to fork the qemu process with
qemu:qemu. Setting the pool permission mode as 0700 by default
will prevent the guest start with permission reason.

Define macro for the default pool and vol permission modes
incidentally.
2012-07-11 22:40:48 +08:00
Daniel P. Berrange
97d7f02dcc Fix shutdown of LXC controller
Since we are not yet using the virNetServerPtr object for running
the event loop, we can't use virNetServerQuit(). Instead set the
global 'quit' flag in libvirt_lxc
2012-07-11 14:46:24 +01:00
Peter Krempa
7ea1dd93aa test: Add test case for nodeinfotest if host machine doesn't have NUMA
Test filling of nodeinfo structure if /sys/devices/system/node does not
exist. (Based on dump from a real machine)
2012-07-11 15:40:37 +02:00
Peter Krempa
1aa1a45b0a test: Add new test case for nodeinfotest
This patch adds test data that describe a machine that has two physical
processors that don't share same core id's on their cores. On this data
the "virsh nodeinfo" reported that the machine had 10 cores per socket
while the processor had only 8. (Before fixing nodeinfo gathering code).
2012-07-11 15:36:26 +02:00
Peter Krempa
80533ca25d nodeinfo: Fix gathering of nodeinfo data structure
This patch changes the way data to fill the nodeinfo structure are
gathered. We've gathere the test data by iterating processors an sockets
separately from nodes. The reported data was based solely on information
about core id. Problems arise when eg cores in mulit-processor machines
don't have same id's on both processors or maybe one physical processor
contains more NUMA nodes.

This patch changes the approach how we detect processors and nodes. Now
we start at enumerating nodes and for each node processors, sockets and
threads are enumerated separately. This approach provides acurate data
that comply to docs about the nodeinfo structure. This also enables to
get rid of hacks: see commits 10d9038b74,
ac9dd4a676. (Those changes in nodeinfo.c
are efectively reverted by this patch).

This patch also changes output of one of the tests, as the processor
topology is now acquired more precisely.
2012-07-11 15:32:19 +02:00
Peter Krempa
6dcf98c822 nodeinfo_test: Enhance test data before changing nodeinfo gathering
This patch adds test data needed by the new way node information will be
gathered. This patch adds symlinks to cpu cores to their corresponding
node directory.
2012-07-11 15:16:36 +02:00
Viktor Mihajlovski
028ba4f375 S390: Adding testcases for s390
Add minimal s390-virtio domain testcase and testcases for virtio serial,
net, disk for the virtio-s390 bus.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2012-07-11 11:19:05 +02:00
Viktor Mihajlovski
1af7e319ed S390: Domain Schema for s390-virtio machines.
Added s390-virtio machine type to the XML schema for domains in order
to not fail the domain schema tests.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2012-07-11 11:19:05 +02:00