Commit Graph

17738 Commits

Author SHA1 Message Date
Martin Kletzander
540a84ec89 docs, conf, schema: add support for shmem device
This patch adds parsing/formatting code as well as documentation for
shared memory devices.  This will currently be only accessible in QEMU
using it's ivshmem device, but is designed as generic as possible to
allow future expansion for other hypervisors.

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

- For shmem device using a server:

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

- For ivshmem device not using an ivshmem server:

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

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

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

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-10-03 22:43:08 +02:00
Eric Blake
e9392e48d4 qemu: support nospace reason in io error event
Aeons ago (commit 34dcbbb4, v0.8.2), we added a new libvirt event
(VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON) in order to tell the user WHY
the guest halted.  This is because at least VDSM wants to react
differently to ENOSPC events (resize the lvm partition to be larger,
and resume the guest as if nothing had happened) from all other events
(I/O is hosed, throw up our hands and flag things as broken).  At the
time this was done, downstream RHEL qemu added a vendor extension
'__com.redhat_reason', which would be exactly one of these strings:
"enospc", "eperm", "eio", and "eother".  In our stupidity, we exposed
those exact strings to clients, rather than an enum, and we also
return "" if we did not have access to a reason (which was the case
for upstream qemu).

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

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

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

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-10-03 12:43:53 -06:00
Cole Robinson
445a09bdc9 qemu: Don't compare CPU against host for TCG
Right now when building the qemu command line, we try to do various
unconditional validations of the guest CPU against the host CPU. However
this checks are overly applied. The only time we should use the checks
are:

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

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

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

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

Amend some aarch64 XML tests with a CPU model, to ensure things work
correctly.
2014-10-03 11:30:29 -04:00
Cole Robinson
3bc6dda6c5 qemu_command: Split qemuBuildCpuArgStr
Move the CPU mode/model handling to its own function. This is just
code movement and re-indentation.
2014-10-03 11:30:29 -04:00
Shanzhi Yu
9cf6dd00ce configure: improve misleading libnl3-devel missing error message
When building libvirt from source with netcf-devel installed, the
configure script reports error "libnl-devel >=3.0 is required for
macvtap support", while actually libnl3-devel is required.

Signed-off-by: Shanzhi Yu <shyu@redhat.com>
2014-10-03 16:08:44 +02:00
Shanzhi Yu
a4771c5860 qemu: Improve domainSetTime error info report
check domain's status before call virQEMUCapsGet to report a accurate
error when domain is shut off

Resolve: https://bugzilla.redhat.com/show_bug.cgi?id=1147847
Signed-off-by: Shanzhi Yu <shyu@redhat.com>
2014-10-03 15:48:07 +02:00
Michal Privoznik
b4022de33a Makefile: Fix build without driver modules
After 87dea4fcf one can observe a build failure:

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

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

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

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-10-03 13:59:12 +02:00
Taowei
87dea4fcff vbox: New network driver
This patch seperate the domain driver and the network driver.

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

The vboxGetNetworkDriver provides a simple interface to get vbox
network driver.
2014-10-03 10:43:04 +02:00
Taowei
bde0cb511d vbox: Rewrite vboxNetworkGetXMLDesc 2014-10-03 10:43:04 +02:00
Taowei
3b12eca667 vbox: Rewrite vboxNetworkCreate 2014-10-03 10:43:04 +02:00
Taowei
1f8b9882f1 vbox: Rewrite vboxNetworkUndefineDestroy
This patch rewrites two public APIs. They are vboxNetworkUndefine
and vboxNetworkDestroy. They use the same core function
vboxNetworkUndefineDestroy. I merged it in one patch.
2014-10-03 10:43:04 +02:00
Taowei
e8d999ada9 vbox: Rewrite vboxNetworkDefineCreateXML
This patch actually contains two public API, virNetworkDefineXML
and virNetworkCreateXML. They use the same core function
vboxNetworkDefineCreateXML. So I merged it together.
2014-10-03 10:43:04 +02:00
Taowei
ee951b9fe7 vbox: Rewrite vboxNetworkLookupByName 2014-10-03 10:43:04 +02:00
Taowei
e4f24f892f vbox: Rewrite vboxNetworkLookupByUUID 2014-10-03 10:43:04 +02:00
Taowei
85a3cd993a vbox: Rewrite vboxConnectListDefinedNetworks 2014-10-03 10:43:04 +02:00
Taowei
638afcf5c9 vbox: Rewrite vboxConnectNumOfDefinedNetworks 2014-10-03 10:43:03 +02:00
Taowei
ce1cef1c57 vbox: Rewrite vboxConnectListNetworks 2014-10-03 10:43:03 +02:00
Taowei
a8b1b043bf vbox: Rewrite vboxConnectNumOfNetworks 2014-10-03 10:43:03 +02:00
Taowei
9e0637997f vbox: Rewrite vboxNetworkClose 2014-10-03 10:43:03 +02:00
Taowei
cd7a5d8994 vbox: Rewrite vboxNetworkOpen 2014-10-03 10:43:03 +02:00
Taowei
fac5d061ed vbox: Interfaces for register per parties
The patch dbb4cbf532 by Michal has splited the vbox driver into
three parties. This modification brings a more suitable interface
to the previous patch.

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

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

This patch, by the way, fixed the align problem for vbox in
Makefile.am
2014-10-03 10:43:03 +02:00
Erik Skultety
e3a7b8740f qemu: Fix updating balloon period in live XML
Up until now, we set memballoon period in monitor successfully, however
we did not update domain definition structure, thus dumpxml was omitting
period attribute in memballoon element

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1140960
2014-10-02 16:10:53 -04:00
Erik Skultety
f4ba3385ba qemu: Fix updating bandwidth limits in live XML
When trying to update bandwidth limits on a running domain, limits get
updated in our internal structures, however XML parser reads
bandwidth limits from network 'actual' definition. Committing this patch
it is now available to update bandwidth 'actual' definition as well,
thus updating domain runtime XML.
2014-10-02 16:10:53 -04:00
Ján Tomko
99b2b4571d Add virCgroupTerminateMachine stub
Fix the build on FreeBSD, broken by commit 4882618.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2014-10-02 11:11:10 +02:00
Eric Blake
4acc03ae8b build: fix build on non-Linux
A cygwin build of 1.2.9 fails with:

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

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

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

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-10-01 21:23:09 -06:00
Guido Günther
adac88c347 Make editor used for 'virsh edit' configurable
Debian wants to use 'sensible-editor' instead of vi other distros might
want to use other defaults. This avoids distro specific patches.
2014-10-01 20:17:48 +02:00
Guido Günther
4882618ed1 qemu: use systemd's TerminateMachine to kill all processes
If we don't properly clean up all processes in the
machine-<vmname>.scope systemd won't remove the cgroup and subsequent vm
starts fail with

  'CreateMachine: File exists'

Additional processes can e.g. be added via

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

but there are other cases like

  http://bugs.debian.org/761521

Invoke TerminateMachine to be on the safe side since systemd tracks the
cgroup anyway. This is a noop if all processes have terminated already.
2014-10-01 20:17:46 +02:00
Peter Krempa
92427948b3 maint: Prohibit "devname" by a syntax check rules
and tweak the code to avoid using it.
2014-10-01 16:39:01 +02:00
Peter Krempa
72945c0629 qemu: monitor: Avoid shadowing variable "devname" on FreeBSD. Again.
FreeBSD's compiler complains that we shadow the symbol. Sigh.

s/devname/dev_name/
2014-10-01 14:39:23 +02:00
Peter Krempa
58699b77ee qemu: json: Fix missing break in error reporting function
Otherwise we'd report a different error.

Reported by John Ferlan's coverity run.
2014-10-01 14:33:09 +02:00
Francesco Romani
7557ddf8be qemu: bulk stats: add block allocation information
Management software wants to be able to allocate disk space on demand.
To support this they need keep track of the space occupation of the
block device.  This information is reported by qemu as part of block
stats.

This patch extend the block information in the bulk stats with the
allocation information.

To keep the same behaviour a helper is extracted from
qemuMonitorJSONGetBlockExtent in order to get per-device allocation
information.

Signed-off-by: Francesco Romani <fromani@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2014-10-01 10:58:33 +02:00
Peter Krempa
8caded6b8e qemu: monitor: Add helper function to fill physical/virtual image size
While our code gathers block stats via "query-blockstats" some
information need to be gathered via "query-block". Add a helper function
that will update the blockstats structure if requested.
2014-10-01 10:58:33 +02:00
Peter Krempa
5809fec90b Bump version to 1.2.10 for new dev cycle 2014-10-01 10:58:32 +02:00
Daniel Veillard
8a24579f3e Release of libvirt-1.2.9
* docs/news.html.in libvirt.spec.in: update for release
* po/*.po*: updated localizations and regenerated
2014-10-01 16:45:32 +08:00
Pavel Hrdina
fc22b2e748 domain_conf: fix domain deadlock
If you use public api virConnectListAllDomains() with second parameter
set to NULL to get only the number of domains you will lock out all
other operations with domains.

Introduced by commit 2c680804.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2014-10-01 16:22:02 +08:00
Chris St. Pierre
fe808d95bf Allow setting migration max downtime any time
This removes the artificial and unnecessary restriction that
virDomainSetMaxDowntime() only be called while a migration is in
progress.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2014-09-30 13:35:20 +02:00
Peter Krempa
bd2b0968c1 qemu: monitor: Avoid shadowing variable "devname" on FreeBSD
FreeBSD's compiler complains that we shadow the symbol. Sigh.

s/devname/dev_name/
2014-09-30 11:41:43 +02:00
Peter Krempa
96c0f57a82 qemu: monitor: return block stats data as a hash to avoid disk mixup
The current block stats code matched up the disk name with the actual
stats by the order in the data returned from qemu. This unfortunately
isn't right as qemu may return the disks in any order. Fix this by
returning a hash of stats and index them by the disk alias.
2014-09-30 11:01:55 +02:00
Ján Tomko
f53bb1af90 Also filter out non-migratable features out of host-passthrough
Commit de0aeaf filtered them out from the host-model features,
to allow host-model to be migratable by default.

Even though they are not passed to QEMU for host-passthrough,
(and not enabled by default) filter them out too
so the user does not think the domain has them.

https://bugzilla.redhat.com/show_bug.cgi?id=1147584
2014-09-30 10:51:08 +02:00
Ján Tomko
ec5f817f2e Don't verify CPU features with host-passthrough
Commit fba6bc4 introduced the non-migratable invtsc feature,
breaking save/migration with host-model and host-passthrough.

On hosts with this feature present it was automatically included
in the CPU definition, regardless of QEMU support.

Commit de0aeaf stopped including it by default for host-model,
but failed to fix host-passthrough.

This commit ignores checking of CPU features with host-passthrough,
since we don't pass them to QEMU (only -cpu host is passed),
allowing domains using host-passthrough that were saved with
the broken version of libvirtd to be restored.

https://bugzilla.redhat.com/show_bug.cgi?id=1147584
2014-09-30 10:47:02 +02:00
Ján Tomko
e26bbf49cc Fix crash cpu_shares change event crash on domain startup
Introduced by commit 0dce260.

qemuDomainEventQueue was called with qemuDomainObjPrivatePtr instead
of virQEMUDriverPtr.

https://bugzilla.redhat.com/show_bug.cgi?id=1147494
2014-09-29 13:58:43 +02:00
Erik Skultety
1be67cd31b storage: Fix logical pool fmt type
According to our documentation logical pool supports formats 'auto' and
'lvm2'. However, in storage_conf.c we previously defined storage pool
formats: unknown, lvm2. Due to backward compatibility reasons
we must continue refer to pool format type 'unknown' instead of 'auto'.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1123767
2014-09-29 05:59:09 -04:00
Tomoki Sekiyama
cd439dce7c virsh: Fix help message of allocpages
Fix info in the command definition of allocpages, which is currently
pointing info for 'capabilities'.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
2014-09-29 08:21:48 +02:00
Guido Günther
9e159b521d qemu: remove capabilities.monitor.sock when done
Prompted by

   http://bugs.debian.org/761131
2014-09-26 19:01:16 +02:00
Jincheng Miao
e029088802 conf: report error in virCPUDefParseXML
When detected invalid 'memAccess', virCPUDefParseXML should report error.

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

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
2014-09-26 16:03:14 +02:00
Ján Tomko
b987c4c3f4 Check for NULL in qemu monitor event filter
When virConnectDomainQemuMonitorEventRegister is called with the
VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX flag,
ignore the flag instead of crashing.

https://bugzilla.redhat.com/show_bug.cgi?id=1144920
2014-09-26 13:35:51 +02:00
Daniel P. Berrange
42571dfa86 Fix typo s/EMULATORIN/EMULATORPIN/
Fix the typo in VIR_DOMAIN_TUNABLE_CPU_EMULATORIN

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-09-26 11:20:56 +01:00
Daniel P. Berrange
0778c0be8d Rename tunable event constants
For the new VIR_DOMAIN_EVENT_ID_TUNABLE event we have a bunch of
constants added

   VIR_DOMAIN_EVENT_CPUTUNE_<blah>
   VIR_DOMAIN_EVENT_BLKDEVIOTUNE_<blah>

This naming convention is bad for two reasons

  - There is no common prefix unique for the events to both
    relate them, and distinguish them from other event
    constants

  - The values associated with the constants were chosen
    to match the names used with virConnectGetAllDomainStats
    so having EVENT in the constant name is not applicable in
    that respect

This patch proposes renaming the constants to

    VIR_DOMAIN_TUNABLE_CPU_<blah>
    VIR_DOMAIN_TUNABLE_BLKDEV_<blah>

ie, given them a common VIR_DOMAIN_TUNABLE prefix.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-09-26 10:58:15 +01:00
Michal Privoznik
c99f66ac4c lxc_monitor_protocol: Redefine xdr_uint64_t if needed
https://bugzilla.redhat.com/show_bug.cgi?id=993411

On some systems (using libtirpc instead of glibc's
implementation), xdr_uint64_t exists rather under different name:
xdr_u_int64_t. This makes compilation fail then:

libvirt_lxc-lxc_monitor_protocol.o: In function `xdr_virLXCMonitorInitEventMsg':
/usr/local/src/libvirt/libvirt-1.1.1/src/./lxc/lxc_monitor_protocol.c:31: undefined reference to `xdr_uint64_t'

Therefore we rather mirror the d707c866 commit and redefine
xdr_uint64_t if needed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-09-26 10:15:03 +02:00
Michal Privoznik
3a3c3780b4 qemuPrepareNVRAM: Save domain after NVRAM path generation
On a domain startup, the variable store path is generated if needed.
The path is intended to be generated only once. However, the updated
domain definition is not saved into config dir rather than state XML
only. So later, whenever the domain is destroyed and the daemon is
restarted, the generated path is forgotten and the file may be left
behind on virDomainUndefine() call.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-09-26 10:14:34 +02:00