]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agoqemu: add usb-net caps flag
Guannan Ren [Thu, 3 Jan 2013 07:13:05 +0000 (15:13 +0800)]
qemu: add usb-net caps flag

QEMU_CAPS_DEVICE_USB_NET /* -device usb-net */

12 years agonetwork: fix typos and docs
Guannan Ren [Thu, 3 Jan 2013 07:13:04 +0000 (15:13 +0800)]
network: fix typos and docs

12 years agoqemu: add usb-serial support
Guannan Ren [Sat, 5 Jan 2013 05:25:36 +0000 (13:25 +0800)]
qemu: add usb-serial support

Add an optional 'type' attribute to <target> element of serial port
device. There are two choices for its value, 'isa-serial' and
'usb-serial'. For backward compatibility, when attribute 'type' is
missing the 'isa-serial' will be chosen as before.

Libvirt XML sample

    <serial type='pty'>
      <target type='usb-serial' port='0'/>
      <address type='usb' bus='0' port='1'/>
    </serial>

qemu commandline:

qemu ${other_vm_args}              \
    -chardev pty,id=charserial0    \
    -device usb-serial,chardev=charserial0,id=serial0,bus=usb.0,port=1

12 years agoqemu: add usb-serial caps flag
Guannan Ren [Thu, 3 Jan 2013 06:57:25 +0000 (14:57 +0800)]
qemu: add usb-serial caps flag

QEMU_CAPS_DEVICE_USB_SERIAL /* -device usb-serial */

12 years agolibvirt.h.in: Fix indentation
Michal Privoznik [Thu, 10 Jan 2013 12:49:09 +0000 (13:49 +0100)]
libvirt.h.in: Fix indentation

With the most recent patch from Claudio, I realized how many
indentation flaws we have in the libvirt.h.in file. Even though
they are harmless, it's still worth fixing them.

12 years agoFix wrong indentation for virDomainState
Claudio Bley [Thu, 10 Jan 2013 11:44:23 +0000 (12:44 +0100)]
Fix wrong indentation for virDomainState

12 years agoqemu_agent: Remove agent reference only when disposing it
Michal Privoznik [Wed, 9 Jan 2013 11:33:45 +0000 (12:33 +0100)]
qemu_agent: Remove agent reference only when disposing it

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

With current code, if user calls virDomainPMSuspendForDuration()
followed by virDomainDestroy(), the former API checks for qemu agent
presence, which will evaluate as true (if agent is configured). While
talking to qemu agent, the qemu driver is unlocked, so the latter API
starts executing.  However, if machine dies meanwhile, libvirtd gets
EOF on the agent socket and qemuProcessHandleAgentEOF() is called. The
handler clears reference to qemu agent while the destroy API already
holding a reference to it. This leads to NULL dereferencing later in
the code. Therefore, the agent pointer should be set to NULL only if
we are the exclusive owner of it.

12 years agobuild: move file deleting action from %files list to %install
Yufang Zhang [Wed, 9 Jan 2013 12:18:35 +0000 (20:18 +0800)]
build: move file deleting action from %files list to %install

When building libvirt rpms on rhel5, I got the following error:

    File must begin with "/": rm
    File must begin with "/": -f
    File must begin with "/": $RPM_BUILD_ROOT/etc/sysctl.d/libvirtd
    Installed (but unpackaged) file(s) found:
   /etc/sysctl.d/libvirtd

It is triggerd by the %files list of libvirt daemon:

    %if 0%{?fedora} >= 14 || 0%{?rhel} >= 6
    %config(noreplace) %{_prefix}/lib/sysctl.d/libvirtd.conf
    %else
    rm -f $RPM_BUILD_ROOT%{_prefix}/lib/sysctl.d/libvirtd.conf
    %endif

After checking document of rpm spec file, I think it would be better
to move the file deleting line from %files list to %install script.

Bug introduced in commit a1fd56c.

12 years agomaint: fix comment typo
Eric Blake [Wed, 9 Jan 2013 23:39:18 +0000 (16:39 -0700)]
maint: fix comment typo

While OOM can have knock-on effects that trash a system, generally
the first symptom is one of memory thrashing.

* src/qemu/qemu_cgroup.c (qemuSetupCgroup): Reword slightly.

12 years agomaint: distribute libvirtd.service.in
Eric Blake [Wed, 9 Jan 2013 21:36:25 +0000 (14:36 -0700)]
maint: distribute libvirtd.service.in

I did a build --without-libvirtd, then ran 'make dist'.  The
resulting tarball was broken, with a complaint that make did not
know how to create libvirtd.service.in.  I traced it to a use
of EXTRA_DIST inside a conditional.

* daemon/Makefile.am (EXTRA_DIST): Hoist libvirtd.service.in
outside of WITH_LIBVIRTD conditional.

12 years agolibvirt: lxc: fix incorrect parameter of lxcContainerMountProcFuse
Gao feng [Wed, 9 Jan 2013 11:01:11 +0000 (19:01 +0800)]
libvirt: lxc: fix incorrect parameter of lxcContainerMountProcFuse

when we has no host's src mapped to container.
there is no .oldroot dir,so libvirt lxc will fail
to start when mouting meminfo.

in this case,the parameter srcprefix of function
lxcContainerMountProcFuse should be NULL.and make
this method handle NULL correctly.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
12 years agoAdd RESUME event listener to qemu monitor.
Andres Lagar-Cavilla [Mon, 7 Jan 2013 21:25:01 +0000 (16:25 -0500)]
Add RESUME event listener to qemu monitor.

Perform all the appropriate plumbing.

When qemu/KVM VMs are paused manually through a monitor not-owned by libvirt,
libvirt will think of them as "paused" event after they are resumed and
effectively running. With this patch the discrepancy goes away.

This is meant to address bug 892791.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
12 years agodocs: break longer text into paragraphs in HTML
Claudio Bley [Tue, 8 Jan 2013 13:55:12 +0000 (14:55 +0100)]
docs: break longer text into paragraphs in HTML

Libvirt's HTML documentation is not as easy to the eyes as it could
be since long text has no visual breaks.

Take advantage of the formatting in documentation comments and wrap
each part separated by two consecutive \n into a HTML <p> element.

12 years agotests: Remove remnants of removing the fake emulator output
John Ferlan [Tue, 8 Jan 2013 21:21:51 +0000 (16:21 -0500)]
tests: Remove remnants of removing the fake emulator output

Coverity determined that 'emulator' could no longer be set and determined the
code was dead.  Looking through the history, I discovered commit-id ed769e18
removed code originally added by commit-id 9237e955 and further modified by
commit-id 6a7e7c4f.

12 years agonwfilter: Remove unprivileged code path to set base
John Ferlan [Tue, 8 Jan 2013 21:21:50 +0000 (16:21 -0500)]
nwfilter: Remove unprivileged code path to set base

Commit id f8ab364c removed ability to run this driver unprivileged. Coverity
detected the check and flagged it.

12 years agophyp: Remove deadcode referencing exit_status
John Ferlan [Tue, 8 Jan 2013 21:21:49 +0000 (16:21 -0500)]
phyp: Remove deadcode referencing exit_status

Remove remnants from commit id '89144534'

12 years agoMake TLS support conditional
Daniel P. Berrange [Mon, 7 Jan 2013 14:54:18 +0000 (14:54 +0000)]
Make TLS support conditional

Add checks for existence of GNUTLS and automatically disable
it if not found.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agobuild: libvirt-guests files misplaced in specfile
Viktor Mihajlovski [Tue, 8 Jan 2013 16:18:13 +0000 (17:18 +0100)]
build: libvirt-guests files misplaced in specfile

In a non-systemd environment the post and preun scripts of libvirt-client
fail, since the required files are in libvirt-daemon. Moved them to client.
Doing that I noticed %{_unitdir}/libvirt-guests.service was contained in
both libvirt-client and libvirt-daemon, which I don't think was intended.
Removed the extra copy from daemon.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoutil: Check for NULL 'dev' on input to usbFreeDevice
John Ferlan [Tue, 8 Jan 2013 12:42:26 +0000 (07:42 -0500)]
util: Check for NULL 'dev' on input to usbFreeDevice

Added 'usbFreeDevice' to the useless_free_options list in cfg.mk

12 years agobuild: avoid compiler warning
Eric Blake [Tue, 8 Jan 2013 15:23:35 +0000 (08:23 -0700)]
build: avoid compiler warning

gcc 4.1.2 on RHEL 5 warned:
conf/network_conf.c:3136: warning: 'foundIdx' may be used uninitialized in this function

The warning is spurious, but initializing the variable doesn't hurt.

* src/conf/network_conf.c (virNetworkDefUpdateDNSHost): Silence
unused variable warning.

12 years agomaint: avoid potential promotion issues with [ug]id_t
Eric Blake [Mon, 7 Jan 2013 22:50:41 +0000 (15:50 -0700)]
maint: avoid potential promotion issues with [ug]id_t

POSIX does not guarantee whether uid_t and gid_t are signed or
unsigned, nor does it guarantee whether they are smaller, same
size, or larger than int (or even the same size as one another).
Therefore, it is possible to have platforms where '(uid_t)-1==-1'
is false or where 'uid = gid = -1' sets uid to the wrong value,
thanks to integer promotion rules.  The only portable way to use
the placeholder value of these two types is to always use a cast.
Thankfully, the issue is mostly theoretical - sanlock only
compiles on Linux for now, and on Linux, these types do not
suffer from strange promotion problems.

* src/locking/lock_driver_sanlock.c
(virLockManagerSanlockSetupLockspace, virLockManagerSanlockInit)
(virLockManagerSanlockCreateLease): Cast -1 to proper type before
comparing with uid_t or gid_t.

12 years agoAdd Claudio Bley to the committers list
Claudio Bley [Tue, 8 Jan 2013 13:45:26 +0000 (14:45 +0100)]
Add Claudio Bley to the committers list

12 years agoqemu: Relax hard RSS limit
Michal Privoznik [Tue, 8 Jan 2013 09:15:49 +0000 (10:15 +0100)]
qemu: Relax hard RSS limit

Currently, if there's no hard memory limit defined for a domain,
libvirt tries to calculate one, based on domain definition and magic
equation and set it upon the domain startup. The rationale behind was,
if there's a memory leak or exploit in qemu, we should prevent the
host system trashing. However, the equation was too tightening, as it
didn't reflect what the kernel counts into the memory used by a
process. Since many hosts do have a swap, nobody hasn't noticed
anything, because if hard memory limit is reached, process can
continue allocating memory on a swap. However, if there is no swap on
the host, the process gets killed by OOM killer. In our case, the qemu
process it is.

To prevent this, we need to relax the hard RSS limit. Moreover, we
should reflect more precisely the kernel way of accounting the memory
for process. That is, even the kernel caches are counted within the
memory used by a process (within cgroups at least). Hence the magic
equation has to be changed:

  limit = 1.5 * (domain memory + total video memory) + (32MB for cache
          per each disk) + 200MB

12 years agoResolve COPY_PASTE error found by Coverity
John Ferlan [Tue, 8 Jan 2013 15:10:10 +0000 (10:10 -0500)]
Resolve COPY_PASTE error found by Coverity

Fix copy-paste error doing handshake.

The clientShake was not set to true, thus we'd potentially never leave
the handshake while loop.

12 years agostorage: fix leak in virStorageBackendLogicalMakeVol
Ján Tomko [Mon, 7 Jan 2013 11:52:43 +0000 (12:52 +0100)]
storage: fix leak in virStorageBackendLogicalMakeVol

Use regfree instead of VIR_FREE.

12 years agodocs: remove duplicate check in index.add
Claudio Bley [Mon, 7 Jan 2013 10:03:39 +0000 (11:03 +0100)]
docs: remove duplicate check in index.add

12 years agoS390: Enable SCLP Console in QEMU driver
J.B. Joret [Mon, 7 Jan 2013 17:17:15 +0000 (18:17 +0100)]
S390: Enable SCLP Console in QEMU driver

This is the QEMU backend code for the SCLP console support.
It includes SCLP capability detection, QEMU command line generation
and a test case.

Signed-off-by: J.B. Joret <jb@linux.vnet.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: Add SCLP console front end support
J.B. Joret [Mon, 7 Jan 2013 17:17:14 +0000 (18:17 +0100)]
S390: Add SCLP console front end support

The SCLP console is the native console type for s390 and is preferred
over the virtio console as it doesn't require special drivers and
is more efficient. Recent versions of QEMU come with SCLP support
which is hereby enabled.

The new target types 'sclp' and 'sclplm' can be used to specify a
SCLP console. Adding documentation, domain schema and XML processing
support.

Signed-off-by: J.B. Joret <jb@linux.vnet.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoRename lxc_protocol.x to lxc_monitor_protocol.x
Daniel P. Berrange [Fri, 21 Dec 2012 13:19:54 +0000 (13:19 +0000)]
Rename lxc_protocol.x to lxc_monitor_protocol.x

To avoid confusion between the LXC driver <-> controller
monitor RPC protocol and the libvirt-lxc.so <-> libvirtd public
RPC protocol, rename the former to lxc_monitor_protocol.x

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd internal APIs for dealing with namespaces
Daniel P. Berrange [Fri, 21 Dec 2012 16:50:18 +0000 (16:50 +0000)]
Add internal APIs for dealing with namespaces

Add some APIs for acquiring namespace file descriptors and
switching namespaces

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd a way to return FDs to the RPC caller
Daniel P. Berrange [Fri, 21 Dec 2012 14:18:28 +0000 (14:18 +0000)]
Add a way to return FDs to the RPC caller

Currently the libvirt client can pass FDs to the server, but the
dispatch mechanism provides no way to return FDs back from the
server to the client. Tweak the dispatch code, such that if a
dispatcher returns '1', this indicates that it populated the
virNetMessagePtr with FDs to return

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix receiving of file descriptors from server
Daniel P. Berrange [Fri, 21 Dec 2012 16:49:12 +0000 (16:49 +0000)]
Fix receiving of file descriptors from server

A number of bugs handling file descriptors received from the
server caused the FDs to be lost and leaked.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove qemu-XXX commands from virsh-host.c to virsh-domain.c
Daniel P. Berrange [Fri, 21 Dec 2012 14:26:27 +0000 (14:26 +0000)]
Move qemu-XXX commands from virsh-host.c to virsh-domain.c

The QEMU specific APIs all operate on domains, not the host,
so should be in the virsh-domain.c file / group

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd missing flags to migrate documentation
Guido Günther [Mon, 7 Jan 2013 12:23:43 +0000 (13:23 +0100)]
Add missing flags to migrate documentation

12 years agocpu: Avoid NULL dereference
John Ferlan [Mon, 7 Jan 2013 17:09:34 +0000 (12:09 -0500)]
cpu: Avoid NULL dereference

Don't dereference 'model' in PowerPCBaseline when there's no outputModel

12 years agolxc: Avoid possible NULL dereference on *root prior to opendir().
John Ferlan [Mon, 7 Jan 2013 17:09:33 +0000 (12:09 -0500)]
lxc: Avoid possible NULL dereference on *root prior to opendir().

If running on older Linux without mounted cgroups then its possible that
*root would be NULL.

12 years agoremote: Avoid calling virAuthConfigLookup() if 'credname' is NULL.
John Ferlan [Mon, 7 Jan 2013 17:09:31 +0000 (12:09 -0500)]
remote: Avoid calling virAuthConfigLookup() if 'credname' is NULL.

12 years agovmware: Avoid NULL dereference for 'caps'
John Ferlan [Mon, 7 Jan 2013 17:09:30 +0000 (12:09 -0500)]
vmware: Avoid NULL dereference for 'caps'

When virCapabilitiesNew() fails, caps will be NULL resulting in possible
core when deref'd in cpuDataFree() call.

12 years agoxen: Avoid possible NULL dereference
John Ferlan [Mon, 7 Jan 2013 17:09:29 +0000 (12:09 -0500)]
xen: Avoid possible NULL dereference

Change calling sequence to only call xenUnifiedDomainSetVcpusFlags() when
'dom' is not NULL. Use the GET_PRIVATE() macro to reference privateData.
Just return -1 if dom is NULL.

12 years agoFix virLXCPrepareHostDevices method
Daniel P. Berrange [Mon, 7 Jan 2013 18:16:54 +0000 (18:16 +0000)]
Fix virLXCPrepareHostDevices method

The virLXCPrepareHostDevices method was returning success even
when it reported an error, and failed to handle several host
device types

12 years agoEnsure we always setup a private mount namespace for LXC controller
Daniel P. Berrange [Mon, 7 Jan 2013 18:14:34 +0000 (18:14 +0000)]
Ensure we always setup a private mount namespace for LXC controller

The code for setting up a private /dev/pts for the containers
is also responsible for making the LXC controller have a
private mount namespace. Unfortunately the /dev/pts code is
not run if launching a container without a custom root. This
causes the LXC FUSE mount to leak into the host FS.

12 years agoSpeed up fallback to legacy non-QMP probing
Daniel P. Berrange [Mon, 7 Jan 2013 16:19:36 +0000 (16:19 +0000)]
Speed up fallback to legacy non-QMP probing

Since we daemonized QEMU for capabilities probing there is a long
time if QEMU fails to launch. This is because we're not passing in
any virDomainObjPtr instance and thus the monitor code can not
check to see if the PID is still alive.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoOnly initialize capabilities after setting dir permissions
Daniel P. Berrange [Mon, 7 Jan 2013 16:18:33 +0000 (16:18 +0000)]
Only initialize capabilities after setting dir permissions

The current code is initializing capabilities before setting
directory permissions. Thus the QEMU binaries being run may
not have the ability to create the UNIX monitor socket on
the first run of libvirtd.

12 years agobuild: Add libxenctrl to LIBXL_LIBS
Jim Fehlig [Mon, 7 Jan 2013 17:15:56 +0000 (10:15 -0700)]
build: Add libxenctrl to LIBXL_LIBS

Commit dfa1e1dd removed libxenctrl from LIBXL_LIBS, but the libxl
driver uses a symbol from this library.  Explicitly link with
libxenctrl instead of relying on the build system to support
implicit DSO linking.

12 years agobuild: install libvirt sysctl file correctly
Eric Blake [Fri, 4 Jan 2013 21:21:59 +0000 (14:21 -0700)]
build: install libvirt sysctl file correctly

https://bugzilla.redhat.com/show_bug.cgi?id=887017 reports that
even though libvirt attempts to set fs.aio-max-nr via sysctl,
the file was installed with the wrong name and gets ignored by
sysctl.  Furthermore, 'man systcl.d' recommends that packages
install into hard-coded /usr/lib/sysctl.d (even when libdir is
/usr/lib64), so that sysadmins can use /etc/sysctl.d for overrides.

* daemon/Makefile.am (install-sysctl, uninstall-sysctl): Use
correct location.
* libvirt.spec.in (network_files): Reflect this.

12 years agobuild: .service files don't need to be executable
Eric Blake [Fri, 4 Jan 2013 20:50:39 +0000 (13:50 -0700)]
build: .service files don't need to be executable

See also commit 66ff2dd, where we avoided installing these files
as executables.

* daemon/Makefile.am (libvirtd.service): Drop chmod.
* tools/Makefile.am (libvirt-guests.service): Likewise.
* src/Makefile.am (virtlockd.service, virtlockd.socket):
Likewise.

12 years agobuild: properly substitute virtlockd.socket
Eric Blake [Fri, 4 Jan 2013 20:48:30 +0000 (13:48 -0700)]
build: properly substitute virtlockd.socket

virtlockd.service could be installed to a configurable root,
but virtlockd.socket was hardcoded to installation into a
distro.

* src/Makefile.am (virtlockd.service, virtlockd.socket): Drop
unused substitutions.
* src/locking/virtlockd.socket.in (ListenStream): Don't hard-code
/var.

12 years agobuild: use common .in replacement mechanism
Eric Blake [Fri, 4 Jan 2013 20:35:04 +0000 (13:35 -0700)]
build: use common .in replacement mechanism

We had several different styles of .in conversion in our Makefiles:
ALLCAPS, @ALLCAPS@, @lower@, ::lower::
Canonicalize on one form, to make it easier to copy and paste
between .in files.

Also, we were using some non-portable sed constructs: \@ is an
undefined escape sequence (it happens to be @ itself in GNU sed,
but POSIX allows it to mean something else), as well as risky
behavior (failure to consistently quote things means a space
in $(sysconfdir) could throw things off; also, Autoconf recommends
using | rather than , or ! in the s||| operator, because | has to
be quoted in shell and is therefore less likely to appear in file
names than , or !).

Fix all of these uses to follow the same syntax.

* daemon/libvirtd.8.in: Switch to @var@.
* tools/virt-xml-validate.in: Likewise.
* tools/virt-pki-validate.in: Likewise.
* src/locking/virtlockd.init.in: Likewise.
* daemon/Makefile.am: Prefer | over ! in sed.
(libvirtd.8): Prefer consistent substitution.
(libvirtd.init, libvirtd.service): Avoid non-portable sed.
* tools/Makefile.am (libvirt-guests.sh, libvirt-guests.init)
(libvirt-guests.service): Likewise.
(virt-xml-validate, virt-pki-validate, virt-sanlock-cleanup):
Prefer consistent capitalization.
* src/Makefile.am (virtlockd.init, virtlockd.service)
(virtlockd.socket): Prefer consistent substitution.

12 years agoqemu: Check if the shared disk's cdbfilter conflicts with others
Osier Yang [Wed, 2 Jan 2013 14:37:11 +0000 (22:37 +0800)]
qemu: Check if the shared disk's cdbfilter conflicts with others

This prevents domain starting and disk attaching if the shared disk's
setting conflicts with other active domain(s), E.g. A domain with
"sgio" set as "filtered", however, another active domain is using
it set as "unfiltered".

12 years agoqemu: set unpriv_sgio when starting domain and attaching disk
Osier Yang [Wed, 2 Jan 2013 14:37:10 +0000 (22:37 +0800)]
qemu: set unpriv_sgio when starting domain and attaching disk

This ignores the default "filtered" if unpriv_sgio is not supported
by kernel, but for explicit request "filtered", it error out for
domain starting.

12 years agoconf: Parse and format the new XML
Osier Yang [Wed, 2 Jan 2013 14:37:09 +0000 (22:37 +0800)]
conf: Parse and format the new XML

Like "rawio", "sgio" is only allowed for block disk of device
type "lun".

It doesn't default disk->sgio to "filtered" when parsing, as
it won't be able to distinguish explicitly requested "filtered"
and a default "filtered" in driver then. We have to error out for
explicit request when the kernel doesn't support the new sysfs
knob "unpriv_sgio", however, for defaulted "filtered", we can
just ignore it if the kernel doesn't support "unpriv_sgio".

12 years agodocs: Add docs and rng schema for new XML tag sgio
Osier Yang [Wed, 2 Jan 2013 14:37:08 +0000 (22:37 +0800)]
docs: Add docs and rng schema for new XML tag sgio

This introduces new XML tag "sgio" for disk, its valid values
are "filtered" and "unfiltered", setting it as "filtered" will
set the disk's unpriv_sgio to 0, and "unfiltered" to set it
as 1, which allows the unprivileged SG_IO commands.

12 years agoqemu: Add a hash table for the shared disks
Osier Yang [Wed, 2 Jan 2013 14:37:07 +0000 (22:37 +0800)]
qemu: Add a hash table for the shared disks

This introduces a hash table for qemu driver, to store the shared
disk's info as (@major:minor, @ref_count). @ref_count is the number
of domains which shares the disk.

Since we only care about if the disk support unprivileged SG_IO
commands, and the SG_IO commands only make sense for block disk,
this patch only manages (add/remove hash entry) the shared disk for
block disk.

* src/qemu/qemu_conf.h: (Add member 'sharedDisks' of type
                         virHashTablePtr; Declare helpers
                         qemuGetSharedDiskKey, qemuAddSharedDisk
                         and qemuRemoveSharedDisk)
* src/qemu/qemu_conf.c (Implement the 3 helpers)
* src/qemu/qemu_process.c (Update 'sharedDisks' when domain
                           starting and shutdown)
* src/qemu/qemu_driver.c (Update 'sharedDisks' when attaching
                          or detaching disk).

12 years agoutil: Prepare helpers for unpriv_sgio setting
Osier Yang [Wed, 2 Jan 2013 14:37:06 +0000 (22:37 +0800)]
util: Prepare helpers for unpriv_sgio setting

"virGetDeviceID" could be used across the sources, but it doesn't
relate with this series, and could be done later.

* src/util/virutil.h: (Declare virGetDeviceID, and
                       vir{Get,Set}DeviceUnprivSGIO)
* src/util/virutil.c: (Implement virGetDeviceID and
                       vir{Get,Set}DeviceUnprivSGIO)
* src/libvirt_private.syms: Export private symbols of upper helpers

12 years agosnapshot: qemu: Allow redefinition of external snapshots
Peter Krempa [Thu, 3 Jan 2013 13:30:07 +0000 (14:30 +0100)]
snapshot: qemu: Allow redefinition of external snapshots

A redefinition of an external inactive snapshot/checkpoint wasn't
possible without this change.

12 years agosnapshot: qemu: Fix segfault and vanishing snapshots when redefining
Peter Krempa [Thu, 3 Jan 2013 13:20:09 +0000 (14:20 +0100)]
snapshot: qemu: Fix segfault and vanishing snapshots when redefining

When the disk alignment check done while redefining an existing snapshot
failed, the qemu driver attempted to free the existing snapshot. As in
the cleanup path the definition of the snapshot wasn't assigned, the
cleanup code dereferenced a NULL pointer.

This patch changes the behavior on error paths while redefining snapshot
in two ways:

1) On failure, modifications done on the snapshot definition object are
rolled back.

2) The previous definition of the data isn't freed until it's certain it
won't be needed any more.

This change avoids the segfault and additionally the snapshot doesn't
vanish if redefinition fails for some reason.

12 years agosnapshot: qemu: Separate logic blocks with newlines
Peter Krempa [Thu, 3 Jan 2013 13:13:05 +0000 (14:13 +0100)]
snapshot: qemu: Separate logic blocks with newlines

12 years agosnapshot: conf: Make virDomainSnapshotIsExternal more reusable
Peter Krempa [Thu, 3 Jan 2013 13:10:39 +0000 (14:10 +0100)]
snapshot: conf: Make virDomainSnapshotIsExternal more reusable

Allow to use definition objects with this predicate function.

12 years agoqemu: Implement virDomainOpenChannel API
John Eckersberg [Wed, 2 Jan 2013 15:38:54 +0000 (10:38 -0500)]
qemu: Implement virDomainOpenChannel API

12 years agoconf: Add unix socket support to virChrdevOpen
John Eckersberg [Wed, 2 Jan 2013 15:38:53 +0000 (10:38 -0500)]
conf: Add unix socket support to virChrdevOpen

This also changes the function signature to take a
virDomainChrSourceDefPtr instead of just a path, since it needs to
differentiate behavior based on source->type.

12 years agoconf: Rename console-specific identifiers to be more generic
John Eckersberg [Wed, 2 Jan 2013 15:38:52 +0000 (10:38 -0500)]
conf: Rename console-specific identifiers to be more generic

The functionality provided in virchrdev.c (previously virconsole.c) is
applicable to other types of character devices besides consoles, such
as channels.  This patch is just code motion, renaming things such as
"console" or "pty", instead using more general terms such as
"character device" or "device path".

12 years agoconf: Rename virconsole.* to virchrdev.*
John Eckersberg [Wed, 2 Jan 2013 15:38:51 +0000 (10:38 -0500)]
conf: Rename virconsole.* to virchrdev.*

This is just code motion, in preparation to rename identifiers to be
less console-specific.

12 years agoapi: Add API to tunnel a guest channel via stream
John Eckersberg [Thu, 13 Dec 2012 16:24:16 +0000 (11:24 -0500)]
api: Add API to tunnel a guest channel via stream

This patch adds a new API, virDomainOpenChannel, that uses streams to
connect to a virtio channel on a guest.  This creates a secure
communication channel between a guest and a libvirt client.

This behaves the same as virDomainOpenConsole, except on channels
instead of console/serial/parallel devices.

12 years agobuild: fix mingw rpm build
Eric Blake [Fri, 4 Jan 2013 23:36:57 +0000 (16:36 -0700)]
build: fix mingw rpm build

Commit d13155c changed which files get installed for the
libvirt-guests service, but did not touch up the mingw spec
file.  As a result, rpmbuild complained:

RPM build errors:
    Installed (but unpackaged) file(s) found:
   /usr/i686-w64-mingw32/sys-root/mingw/libexec/libvirt-guests.sh
   /usr/x86_64-w64-mingw32/sys-root/mingw/libexec/libvirt-guests.sh

which in turn breaks ./autobuild.sh when cross-compilers are present.

* mingw-libvirt.spec.in: Remove files not relevant to mingw.

12 years agonetwork: fix check for ambiguous lookup
Eric Blake [Fri, 4 Jan 2013 22:02:42 +0000 (15:02 -0700)]
network: fix check for ambiguous lookup

gcc -O2 complained:
../../src/conf/network_conf.c: In function 'virNetworkDefUpdateDNSSrv':
../../src/conf/network_conf.c:3232: error: 'foundIdx' may be used uninitialized in this function [-Wuninitialized]

It turned out to be a spurious warning (we didn't use foundIdx
unless foundCt was non-zero).  But in investigating that, I noticed
a worse problem: we were using 'if (foundCt > 1)', but since foundCt
was bool, it could never be > 1.

* src/conf/network_conf.c (virNetworkDefUpdateDNSHost): Use
correct type.
(virNetworkDefUpdateDNSSrv): Likewise, and silence compiler
warning.

12 years agoCheck and handle select() errors from waitsocket().
John Ferlan [Thu, 3 Jan 2013 19:16:22 +0000 (14:16 -0500)]
Check and handle select() errors from waitsocket().

12 years agotests: check and handle error for virAsprintf() calls
John Ferlan [Thu, 3 Jan 2013 19:16:19 +0000 (14:16 -0500)]
tests: check and handle error for virAsprintf() calls

12 years agoCheck return on mkdir for LOCKSPACE_DIR
John Ferlan [Thu, 3 Jan 2013 19:16:18 +0000 (14:16 -0500)]
Check return on mkdir for LOCKSPACE_DIR

12 years agovmware: silence Coverity warning
John Ferlan [Thu, 3 Jan 2013 19:16:16 +0000 (14:16 -0500)]
vmware: silence Coverity warning

Ignore the return status check for vmwareUpdateVMStatus in convenience
routine vmwareDomainObjListUpdateDomain

12 years agoqemu: Detect VGA_QXL capability correctly
Michal Privoznik [Fri, 4 Jan 2013 08:47:55 +0000 (09:47 +0100)]
qemu: Detect VGA_QXL capability correctly

Since 4c993d8a we failed to set this important capability, which
allows starting a domain with QXL video card. We set DEVICE_QXL
capability bit instead, which is not necessary wrong. Anyway, if
qemu supports the new '-device qxl' it supports older '-vga qxl'
as well. The latter is used for the primary (the first) qxl video
card, the former for other video cards.

12 years agoInstall virtlockd.{socket,service} non executable
Guido Günther [Thu, 3 Jan 2013 21:39:14 +0000 (22:39 +0100)]
Install virtlockd.{socket,service} non executable

since they're not scripts but systemd service files.

12 years agoqemu: fix a segfault in qemuProcessWaitForMonitor
Ján Tomko [Thu, 3 Jan 2013 18:07:55 +0000 (19:07 +0100)]
qemu: fix a segfault in qemuProcessWaitForMonitor

Commit b3f2b4ca5cfe98b08ffdb96f0455e3e333e5ace6 left buf unallocated in
the case of QMP capability probing being used, leading to a segfault in
strlen in the cleanup path.

This patch opens the log and allocates the buffer if QMP probing was
used, so we can display the helpful error message.

12 years agoparallels: check and handle error for virAsprintf() calls
John Ferlan [Thu, 3 Jan 2013 19:16:14 +0000 (14:16 -0500)]
parallels: check and handle error for virAsprintf() calls

Ignore the return in parallelsMakePoolName() since subsequent check
validates name was allocated.

12 years agoudev: check and handle error for virAsprintf() calls
John Ferlan [Thu, 3 Jan 2013 19:16:13 +0000 (14:16 -0500)]
udev: check and handle error for virAsprintf() calls

12 years agobuild: fix build with optimization enabled
Eric Blake [Thu, 3 Jan 2013 17:12:47 +0000 (10:12 -0700)]
build: fix build with optimization enabled

Build failure detected by Jenkins autobuilder:
http://honk.sigxcpu.org:8001/job/libvirt-build/472/changes

* .gnulib: Update to latest, for stdio.h rpl_fwrite fix.

12 years agoqemu: Don't parse log output when starting up a domain
Michal Privoznik [Wed, 2 Jan 2013 14:36:33 +0000 (15:36 +0100)]
qemu: Don't parse log output when starting up a domain

Despite our great effort we still parsed qemu log output.
We wouldn't notice unless upcoming qemu 1.4 changed the
format of the logs slightly. Anyway, now we should gather
all interesting knobs like pty paths from monitor. Moreover,
since for historical reasons the first console can be just
an alias to the first serial port, we need to check this and
copy the pty path if that's the case to the first console.

12 years agobuild: use autobuild module to make build logs nicer
Eric Blake [Wed, 2 Jan 2013 18:10:42 +0000 (11:10 -0700)]
build: use autobuild module to make build logs nicer

A recent build failure made me realize that we could usefully add
a bit more information to configure output, for aid in analysis of
failed builds.  Pulling in the autobuild module merely adds these
four lines to configure output:

configure: autobuild project... libvirt
configure: autobuild revision... v1.0.1-113-g7a74eea
configure: autobuild hostname... myhost
configure: autobuild timestamp... 20130102T233543Z

which can be useful even if not using the Autobuild project to parse
build logs.

* bootstrap.conf (gnulib_modules): Add autobuild.
* configure.ac: Favor git version over release version, when available.

12 years agomaint: update to latest gnulib
Eric Blake [Wed, 2 Jan 2013 15:38:33 +0000 (08:38 -0700)]
maint: update to latest gnulib

'make syntax-check' warned that gnulib's copyright is now out of date.

* .gnulib: Update to latest, for copyright year bump.
* gnulib/local/m4/ssize_t.m4.diff: Regenerate.
* bootstrap: Synchronize from upstream.

12 years agoFix the comment grammar
Osier Yang [Wed, 2 Jan 2013 15:29:20 +0000 (23:29 +0800)]
Fix the comment grammar

12 years agoRemove the inexistent function in comments
Osier Yang [Wed, 2 Jan 2013 09:27:07 +0000 (17:27 +0800)]
Remove the inexistent function in comments

virNodeDeviceLookupByKey is inexistent.

12 years agoRevert "qemu: Adapt to new log format"
Michal Privoznik [Wed, 2 Jan 2013 10:52:18 +0000 (11:52 +0100)]
Revert "qemu: Adapt to new log format"

This reverts commit 28224c4d2a2d623b9a0a714bc0454d47de5d7a35
which shouldn't be needed at all because with current qemu
we obtain all paths from 'query-chardev' output. We ought
not parse log output at all anymore.

12 years agoqemu: Adapt to new log format
Michal Privoznik [Sat, 29 Dec 2012 08:44:33 +0000 (09:44 +0100)]
qemu: Adapt to new log format

Since 586502189edf9fd0f89a83de96717a2ea826fdb0 qemu commit, the log
lines reporting chardev's path has changed from:

$ ./x86_64-softmmu/qemu-system-x86_64 -serial pty -serial pty -monitor pty
char device redirected to /dev/pts/5
char device redirected to /dev/pts/6
char device redirected to /dev/pts/7

to:

$ ./x86_64-softmmu/qemu-system-x86_64 -serial pty -serial pty -monitor pty
char device compat_monitor0 redirected to /dev/pts/5
char device serial0 redirected to /dev/pts/6
char device serial1 redirected to /dev/pts/7

However, with current code we are not prepared for such change, which
results in us being unable to start any domain.

12 years agosanlock: Chown lease files as well
Michal Privoznik [Fri, 21 Dec 2012 11:35:21 +0000 (12:35 +0100)]
sanlock: Chown lease files as well

Since sanlock doesn't run under root:root, we have chown()'ed the
__LIBVIRT__DISKS__ lease file to the user:group defined in the
sanlock config. However, when writing the patch I've forgot about
lease files for each disk (this is the
/var/lib/libvirt/sanlock/<md5>) file.

12 years agopython: Adapt to virevent rename
Michal Privoznik [Fri, 28 Dec 2012 15:22:09 +0000 (16:22 +0100)]
python: Adapt to virevent rename

With our recent renames under src/util/* we forgot to adapt
python wrapper code generator. This results in some methods being
not exposed:

$ python examples/domain-events/events-python/event-test.py
Using uri:qemu:///system
Traceback (most recent call last):
  File "examples/domain-events/events-python/event-test.py", line 585, in <module>
    main()
  File "examples/domain-events/events-python/event-test.py", line 543, in main
    virEventLoopPureStart()
  File "examples/domain-events/events-python/event-test.py", line 416, in virEventLoopPureStart
    virEventLoopPureRegister()
  File "examples/domain-events/events-python/event-test.py", line 397, in virEventLoopPureRegister
    libvirt.virEventRegisterImpl(virEventAddHandleImpl,
AttributeError: 'module' object has no attribute 'virEventRegisterImpl'

12 years agoqemu: Convert some APIs to use qemuDomObjFromDomain
Michal Privoznik [Thu, 13 Dec 2012 11:19:58 +0000 (12:19 +0100)]
qemu: Convert some APIs to use qemuDomObjFromDomain

Many internal qemu APIs must find domain object from passed
virDomainPtr. And with function Peter's introduced, we can use it
instead of copying multiple lines among code.

12 years agoqemu: Relax locking in DomainHasManagedSaveImage and DomainMonitorCommand
Michal Privoznik [Thu, 13 Dec 2012 11:33:06 +0000 (12:33 +0100)]
qemu: Relax locking in DomainHasManagedSaveImage and DomainMonitorCommand

There is no need to hold qemu lock during the whole execution
of these two APIs.

12 years agoS390: Re-enable capability probing for virtio devices.
Viktor Mihajlovski [Fri, 21 Dec 2012 09:16:12 +0000 (10:16 +0100)]
S390: Re-enable capability probing for virtio devices.

Since we switched to QMP probing, the object types are spelled out
explicitly, i.e. virtio-net-pci. This has effectively disabled
the capability detection of s390 virtio devices. The trivial fix
is to add the s390 virtio types explicitly to qemuCapsObjectProps.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoutil: fix botched check for new netlink request filters
Laine Stump [Fri, 21 Dec 2012 20:09:33 +0000 (15:09 -0500)]
util: fix botched check for new netlink request filters

This is an adjustment to the fix for

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

to account for two bonehead mistakes I made.

commit ac2797cf2af2fd0e64c58a48409a8175d24d6f86 attempted to fix a
problem with netlink in newer kernels requiring an extra attribute
with a filter flag set in order to receive an IFLA_VFINFO_LIST from
netlink. Unfortunately, the #ifdef that protected against compiling it
in on systems without the new flag went a bit too far, assuring that
the new code would *never* be compiled, and even if it had, the code
was incorrect.

The first problem was that, while some IFLA_* enum values are also
their existence at compile time, IFLA_EXT_MASK *isn't* #defined, so
checking to see if it's #defined is not a valid method of determining
whether or not to add the attribute. Fortunately, the flag that is
being set (RTEXT_FILTER_VF) *is* #defined, and it is never present if
IFLA_EXT_MASK isn't, so it's sufficient to just check for that flag.

And to top it off, due to the code not actually compiling when I
thought it did, I didn't realize that I'd been given the wrong arglist
to nla_put() - you can't just send a const value to nla_put, you have
to send it a pointer to memory containing what you want to add to the
message, along with the length of that memory.

This time I've actually sent the patch over to the other machine
that's experiencing the problem, applied it to the branch being used
(0.10.2) and verified that it works properly, i.e. it does fix the
problem it's supposed to fix. :-/

12 years agoblockjob: fix memleak that prevented block pivot
Eric Blake [Fri, 21 Dec 2012 00:13:50 +0000 (17:13 -0700)]
blockjob: fix memleak that prevented block pivot

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

The code for doing a block-copy was supposed to track the destination
file in drive->mirror, but was set up to do all mallocs prior to
starting the copy so that OOM wouldn't leave things partially started.
However, the wrong variable was being written; later in the code we
silently did 'disk->mirror = mirror' which was still NULL, and thus
leaking memory and leaving libvirt to think that the mirror job was
never started, which prevented a pivot operation after a copy.
Problem introduced in commit 35c7701c6.

* src/qemu/qemu_driver.c (qemuDomainBlockCopy): Initialize correct
variable.

12 years agoSort util files in Makefile.am alphabetically
Daniel P. Berrange [Thu, 13 Dec 2012 18:26:46 +0000 (18:26 +0000)]
Sort util files in Makefile.am alphabetically

12 years agoRename virterror.c virterror_internal.h to virerror.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 18:21:53 +0000 (18:21 +0000)]
Rename virterror.c virterror_internal.h to virerror.{c,h}

12 years agoRename xml.{c,h} to virxml.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 18:13:21 +0000 (18:13 +0000)]
Rename xml.{c,h} to virxml.{c,h}

12 years agoRename uuid.{c,h} to viruuid.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 18:01:25 +0000 (18:01 +0000)]
Rename uuid.{c,h} to viruuid.{c,h}

12 years agoRename util.{c,h} to virutil.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 17:44:57 +0000 (17:44 +0000)]
Rename util.{c,h} to virutil.{c,h}

12 years agoRename threads.{c,h} to virthread.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 15:49:48 +0000 (15:49 +0000)]
Rename threads.{c,h} to virthread.{c,h}

12 years agoRename threadpool.{c,h} to virthreadpool.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 15:39:07 +0000 (15:39 +0000)]
Rename threadpool.{c,h} to virthreadpool.{c,h}

12 years agoRename sysinfo.{c,h} to virsysinfo.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 15:31:53 +0000 (15:31 +0000)]
Rename sysinfo.{c,h} to virsysinfo.{c,h}

12 years agoRename storage_file.{c,h} to virstoragefile.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 15:25:48 +0000 (15:25 +0000)]
Rename storage_file.{c,h} to virstoragefile.{c,h}

12 years agoRename stats_linux.{c,h} to virstatslinux.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 15:14:15 +0000 (15:14 +0000)]
Rename stats_linux.{c,h} to virstatslinux.{c,h}

12 years agoRename sexpr.{c,h} to virsexpr.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 15:07:43 +0000 (15:07 +0000)]
Rename sexpr.{c,h} to virsexpr.{c,h}