Commit Graph

17749 Commits

Author SHA1 Message Date
John Ferlan
b7890a8c28 qemu: Remove possible NULL deref in debug output
Check for !dev->info.alias was done after a VIR_DEBUG() statement
that already tried to print - just flip sequence
2014-10-06 10:35:26 -04:00
John Ferlan
99186c4103 qemu: Remove need for virConnectPtr in hotunplug detach host, net
Prior patch removed the need for the virConnectPtr in the unplug
detach host path which caused ripple effect to remove in multiple
callers.  The previous patch just left things as ATTRIBUTE_UNUSED -
this patch will remove the variable.
2014-10-06 10:35:26 -04:00
John Ferlan
d2774e54cd qemu: Fix hot unplug of SCSI_HOST device
https://bugzilla.redhat.com/show_bug.cgi?id=1141732

Introduced by commit id '8f76ad99' the logic to detach a scsi_host
device (SCSI or iSCSI) fails when attempting to remove the 'drive'
because as I found in my investigation - the DelDevice takes care of
that for us.

The investigation turned up commits to adjust the logic for the
qemuMonitorDelDevice and qemuMonitorDriveDel processing for interfaces
(commit id '81f76598'), disk bus=VIRTIO,SCSI,USB (commit id '0635785b'),
and chr devices (commit id '55b21f9b'), but nothing with the host devices.

This commit uses the model for the previous set of changes and applies
it to the hostdev path. The call to qemuDomainDetachHostSCSIDevice will
return to qemuDomainDetachThisHostDevice handling either the audit of
the failure or the wait for the removal and then call into
qemuDomainRemoveHostDevice for the event, removal from the domain hostdev
list, and audit of the removal similar to other paths.

NOTE: For now the 'conn' param to +qemuDomainDetachHostSCSIDevice is left
as ATTRIBUTE_UNUSED.  Removing requires a cascade of other changes to be
left for a future patch.
2014-10-06 10:35:25 -04:00
Eric Blake
9d31c0487c maint: update .mailmap
Consolidate several commits made by James:
https://www.redhat.com/archives/libvir-list/2014-September/msg01156.html

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-10-06 08:23:47 -06:00
Ján Tomko
16ca322630 Include .libs in libdir in source tree pkg-config files
This lets me build against an uninstalled source tree without
libtool.
2014-10-06 14:46:14 +02:00
Chen Hanxiao
906eefb2e9 docs: fix a typo in drvlxc
s/the/The

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2014-10-06 13:15:31 +02:00
Martin Kletzander
34f514778b minor shmem clean-ups
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-10-04 10:46:22 +02:00
Martin Kletzander
8f17d0eaae util: Prepare URI formatting for libxml2 >= 2.9.2
Since commit 8eb55d782a2b9afacc7938694891cc6fad7b42a5 libxml2 removes
two slashes from the URI when there is no server part.  This is fixed
with beb7281055dbf0ed4d041022a67c6c5cfd126f25, but only if the calling
application calls xmlSaveUri() on URI that xmlURIParse() parsed.  And
that is not the case in virURIFormat().  virURIFormat() accepts
virURIPtr that can be created without parsing it and we do that when we
format network storage paths for gluster for example.  Even though
virStorageSourceParseBackingURI() uses virURIParse(), it throws that data
structure right away.

Since we want to format URIs as URIs and not absolute URIs or opaque
URIs (see RFC 3986), we can specify that with a special hack thanks to
commit beb7281055dbf0ed4d041022a67c6c5cfd126f25, by setting port to -1.

This fixes qemuxml2argvtest test where the disk-drive-network-gluster
case was failing.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-10-03 22:43:09 +02:00
Martin Kletzander
0186885dac vbox: remove unused code that causes build failures
Since 87dea4fcff vboxGetDrivers() is not
used for getting the vbox network driver.  The only call the code does
is using NULL as the @networkDriver_ret param , but the code still used
vbox[0-9][0-9]NetworkDriver that didn't exist anymore.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-10-03 22:43:09 +02:00
Martin Kletzander
b90a9a6374 qemu: Build command line for ivshmem device
This patch implements support for the ivshmem device in QEMU.

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-10-03 22:43:09 +02:00
Maxime Leroy
e3d478eb51 qemu: add capability probing for ivshmem device
Ivshmem is supported by QEMU since 0.13 release.

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
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