]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agobuild: fix build without HAVE_CAPNG
Eric Blake [Mon, 30 Jul 2012 17:59:25 +0000 (11:59 -0600)]
build: fix build without HAVE_CAPNG

Otherwise, a build may fail with:

lxc/lxc_conatiner.c: In function 'lxcContainerDropCapabilities':
lxc/lxc_container.c:1662:46: error: unused parameter 'keepReboot' [-Werror=unused-parameter]

* src/lxc/lxc_container.c (lxcContainerDropCapabilities): Mark
parameter unused.

12 years agodaemon: Fix crash in virTypedParameterArrayClear
Jiri Denemark [Mon, 30 Jul 2012 10:14:54 +0000 (12:14 +0200)]
daemon: Fix crash in virTypedParameterArrayClear

Daemon uses the following pattern when dispatching APIs with typed
parameters:

    VIR_ALLOC_N(params, nparams);
    virDomain*(dom, params, &nparams, flags);
    virTypedParameterArrayClear(params, nparams);

In case nparams was originally set to 0, virDomain* API would fill it
with the number of typed parameters it can provide and we would use this
number (rather than zero) to clear params. Because VIR_ALLOC* returns
non-NULL pointer even if size is 0, the code would end up walking
through random memory. If we were lucky enough and the memory contained
7 (VIR_TYPED_PARAM_STRING) at the right place, we would try to free a
random pointer and crash.

Let's make sure params stays NULL when nparams is 0.

12 years agoconf: Remove callback from stream when freeing entries in console hash
Peter Krempa [Fri, 27 Jul 2012 12:50:54 +0000 (14:50 +0200)]
conf: Remove callback from stream when freeing entries in console hash

When a domain has a active console connection and is destroyed the
callback is called on private data that no longer exist causing a
segfault.

12 years agoconf: Remove dead code from virConsoleOpen()
Peter Krempa [Fri, 27 Jul 2012 12:48:27 +0000 (14:48 +0200)]
conf: Remove dead code from virConsoleOpen()

12 years agopython: Don't generate bodies for close callback functions
Peter Krempa [Mon, 30 Jul 2012 13:33:09 +0000 (15:33 +0200)]
python: Don't generate bodies for close callback functions

Commit 6ed5a1b9bd6240b8f2736790e48dd1c284c2e0e1 adds close callback
functions to the public API but doesn't add python implementation. This
patch sets the function to be written manually (to fix the build), but
doesn't implement them yet.

12 years agoImprove error message in LXC startup with network is not active
Daniel P. Berrange [Mon, 30 Jul 2012 10:26:51 +0000 (11:26 +0100)]
Improve error message in LXC startup with network is not active

If an LXC container is using a virtual network and that network
is not active, currently the user gets a rather unhelpful
error message about tap device setup failure. Add an explicit
check for whether the network is active, in exactly the same
way as the QEMU driver

12 years agoRemove tabs from all perl files & enforce this
Daniel P. Berrange [Fri, 27 Jul 2012 12:51:28 +0000 (13:51 +0100)]
Remove tabs from all perl files & enforce this

The cfg.mk file rule to check for tab characters was not
applied to perl files. Much of our Perl code is full of
tabs as a result. Kill them, kill them all !

12 years agoAdd handling for reboots of LXC containers
Daniel P. Berrange [Mon, 23 Jul 2012 11:25:37 +0000 (12:25 +0100)]
Add handling for reboots of LXC containers

The reboot() syscall is allowed by new kernels for LXC containers.
The LXC controller can detect whether a reboot was requested
(instead of a normal shutdown) by looking at the "init" process
exit status. If a reboot was triggered, the exit status will
record SIGHUP as the kill reason.

The LXC controller has cleared all its capabilities, and the
veth network devices will no longer exist at this time. Thus
it cannot restart the container init process itself. Instead
it emits an event which is picked up by the LXC driver in
libvirtd. This will then re-create the container, using the
same configuration as it was previously running with (ie it
will not activate 'newDef').

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAllow CAP_SYS_REBOOT on new enough kernels
Daniel P. Berrange [Fri, 20 Jul 2012 21:16:19 +0000 (22:16 +0100)]
Allow CAP_SYS_REBOOT on new enough kernels

Check whether the reboot() system call is virtualized, and if
it is, then allow the container to keep CAP_SYS_REBOOT.

Based on an original patch by Serge Hallyn

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRun an RPC protocol over the LXC controller monitor
Daniel P. Berrange [Tue, 17 Jul 2012 14:54:08 +0000 (15:54 +0100)]
Run an RPC protocol over the LXC controller monitor

This defines a new RPC protocol to be used between the LXC
controller and the libvirtd LXC driver. There is only a
single RPC message defined thus far, an asynchronous "EXIT"
event that is emitted just before the LXC controller process
exits. This provides the LXC driver with details about how
the container shutdown - normally, or abnormally (crashed),
thus allowing the driver to emit better libvirt events.

Emitting the event in the LXC controller requires a few
little tricks with the RPC service. Simply calling the
virNetServiceClientSendMessage does not work, since this
merely queues the message for asynchronous processing.
In addition the main event loop is no longer running at
the point the event is emitted, so no I/O is processed.

Thus after invoking virNetServiceClientSendMessage it is
necessary to mark the client as being in "delayed close"
mode. Then the event loop is run again, until the client
completes its close - this happens only after the queued
message has been fully transmitted. The final complexity
is that it is not safe to run virNetServerQuit() from the
client close callback, since that is invoked from a
context where the server is locked. Thus a zero-second
timer is used to trigger shutdown of the event loop,
causing the controller to finally exit.

* src/Makefile.am: Add rules for generating RPC protocol
  files and dispatch methods
* src/lxc/lxc_controller.c: Emit an RPC event immediately
  before exiting
* src/lxc/lxc_domain.h: Record the shutdown reason
  given by the controller
* src/lxc/lxc_monitor.c, src/lxc/lxc_monitor.h: Register
  RPC program and event handler. Add callback to let
  driver receive EXIT event.
* src/lxc/lxc_process.c: Use monitor exit event to decide
  what kind of domain event to emit
* src/lxc/lxc_protocol.x: Define wire protocol for LXC
  controller monitor.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMake RPC code generator a little more flexible
Daniel P. Berrange [Fri, 20 Jul 2012 14:31:46 +0000 (15:31 +0100)]
Make RPC code generator a little more flexible

Update the gendispatch.pl script to get a little closer to
being able to generate code for the LXC monitor, by passing
in the struct prefix separately from the procedure prefix.
Also allow method names using virCapitalLetters instead
of vir_underscore_separator

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove LXC monitor code out into separate file
Daniel P. Berrange [Tue, 17 Jul 2012 11:14:35 +0000 (12:14 +0100)]
Move LXC monitor code out into separate file

Move the code that handles the LXC monitor out of the
lxc_process.c file and into lxc_monitor.{c,h}

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert the LXC driver to use virNetClient
Daniel P. Berrange [Tue, 17 Jul 2012 10:55:38 +0000 (11:55 +0100)]
Convert the LXC driver to use virNetClient

Update the LXC driver to use the virNetClient APIs for
connecting to the libvirt_lxc monitor, instead of the
low-level socket APIs. This is a step towards running
a full RPC protocol with libvirt_lxc

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of lxcError with virReportError
Daniel P. Berrange [Fri, 13 Jul 2012 12:59:51 +0000 (13:59 +0100)]
Replace use of lxcError with virReportError

Update all LXC code to use virReportError instead of the custom
lxcError macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRename lxc_driver_t to virLXCDriver
Daniel P. Berrange [Fri, 13 Jul 2012 11:56:29 +0000 (12:56 +0100)]
Rename lxc_driver_t to virLXCDriver

Rename the lxc_driver_t struct typedef to virLXCDriver to more
closely follow normal libvirt naming conventions

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRename all APIs in lxc_domain.c to have a virLXCDomain prefix
Daniel P. Berrange [Wed, 18 Jul 2012 16:20:46 +0000 (17:20 +0100)]
Rename all APIs in lxc_domain.c to have a virLXCDomain prefix

For consistency all the APIs in the lxc_domain.c file should
have a virLXCDomain prefix in their name

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRename all APIs in lxc_process.c to have a virLXCProcess prefix
Daniel P. Berrange [Fri, 13 Jul 2012 11:49:24 +0000 (12:49 +0100)]
Rename all APIs in lxc_process.c to have a virLXCProcess prefix

For consistency all the APIs in the lxc_process.c file should
have a virLXCProcess prefix in their name

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoProcess all pending I/O for a RPC client before checking EOF
Daniel P. Berrange [Wed, 18 Jul 2012 15:50:02 +0000 (16:50 +0100)]
Process all pending I/O for a RPC client before checking EOF

In the socket event handler for the RPC client we must deal
with read/write events, before checking for EOF, otherwise
we might close the socket before we've read & acted upon the
last RPC messages

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoExtend events demo to show close callbacks in use
Daniel P. Berrange [Thu, 19 Jul 2012 14:59:59 +0000 (15:59 +0100)]
Extend events demo to show close callbacks in use

Use a driver close callback to trigger shutdown of the
events demo program

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoUpdate remote driver to support the connection close callbacks
Daniel P. Berrange [Thu, 19 Jul 2012 14:58:38 +0000 (15:58 +0100)]
Update remote driver to support the connection close callbacks

Update the remote driver to use the virNetClient close callback
to trigger the virConnectPtr close callbacks

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd callback to virNetClient to be invoked on connection close
Daniel P. Berrange [Wed, 18 Jul 2012 16:10:22 +0000 (17:10 +0100)]
Add callback to virNetClient to be invoked on connection close

Allow detection of socket close in virNetClient via a callback
function, triggered on any condition that causes the socket to
be closed.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoEnsure client is marked for close in all error paths
Daniel P. Berrange [Thu, 19 Jul 2012 10:21:54 +0000 (11:21 +0100)]
Ensure client is marked for close in all error paths

Currently if the keepalive timer triggers, the 'markClose'
flag is set on the virNetClient. A controlled shutdown will
then be performed. If an I/O error occurs during read or
write of the connection an error is raised back to the
caller, but the connection isn't marked for close. This
patch ensures that all I/O error scenarios always result
in the connection being marked for close.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd public API to register a callback to be invoked on connection close
Daniel P. Berrange [Thu, 19 Jul 2012 10:01:07 +0000 (11:01 +0100)]
Add public API to register a callback to be invoked on connection close

Define new virConnect{Register,Unregister}CloseCallback() public APIs
which allows registering/unregistering a callback to be invoked when
the connection to a hypervisor is closed. The callback is provided
with the reason for the close, which may be 'error', 'eof', 'client'
or 'keepalive'.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoesx: Improve error reporting for unknown VI types
Matthias Bolte [Sat, 21 Jul 2012 20:50:24 +0000 (22:50 +0200)]
esx: Improve error reporting for unknown VI types

Print the actual unknown type name instead of <other> for AnyType objects.

12 years agosecurity: Skip labeling resources when seclabel defaults to none
Jiri Denemark [Wed, 25 Jul 2012 12:38:27 +0000 (14:38 +0200)]
security: Skip labeling resources when seclabel defaults to none

If a domain is explicitly configured with <seclabel type="none"/> we
correctly ensure that no labeling will be done by setting
norelabel=true. However, if no seclabel element is present in domain XML
and hypervisor is configured not to confine domains by default, we only
set type to "none" without turning off relabeling. Thus if such a domain
is being started, security driver wants to relabel resources with
default label, which doesn't make any sense.

Moreover, with SELinux security driver, the generated image label lacks
"s0" sensitivity, which causes setfilecon() fail with EINVAL in
enforcing mode.

12 years agomaint: regenerate bootstrap
Eric Blake [Fri, 27 Jul 2012 15:34:04 +0000 (09:34 -0600)]
maint: regenerate bootstrap

Commit 3ad13c92a7 blindly touched all files to have a 3-line
hint for getting LGPL, but bootstrap is synced from gnulib where
it has a 2-line hint.

* bootstrap: Resync from gnulib.

12 years agolibvirt-guests: systemd host shutdown does not work
Gerd v. Egidy [Fri, 27 Jul 2012 15:01:04 +0000 (17:01 +0200)]
libvirt-guests: systemd host shutdown does not work

I originally postet this into the Fedora bugzilla
https://bugzilla.redhat.com/show_bug.cgi?id=843836

Currently gracefully shutting down guest vms on host shutdown does not work on
Fedora 17, the guests are killed hard on system shutdown.

The reason is systemd considers libvirt-guests.service to be stopped when the
system is running:

$ systemctl status libvirt-guests.service
libvirt-guests.service - Suspend Active Libvirt Guests
          Loaded: loaded (/usr/lib/systemd/system/libvirt-guests.service;
enabled)
          Active: deactivating (stop) since Fri, 27 Jul 2012 15:47:31 +0200;
2min 48s ago
         Process: 1085 ExecStart=/etc/init.d/libvirt-guests start
(code=exited, status=0/SUCCESS)
         Control: 1150 (libvirt-guests)
          CGroup: name=systemd:/system/libvirt-guests.service
                  └ control
                    ├ 1150 /bin/sh /etc/init.d/libvirt-guests stop
                    └ 2257 sleep 1

libvirt-guests.service is defined as type "simple" in systemd (the default).
That means systemd will shut down the service when the start executable is
terminated after starting is done. Systemd will not call stop again on system
shutdown because it thinks it is already stopped.

The solution is to define it as type "oneshot" and set the flag
"RemainAfterExit". Then systemd will consider the service as active after
startup and will call the stop function on host shutdown.

12 years agolib: Revert removing of Summary and Description fields in headers
Peter Krempa [Fri, 27 Jul 2012 13:17:45 +0000 (15:17 +0200)]
lib: Revert removing of Summary and Description fields in headers

Those fields are used by the apibuild script to create documentation.
This commit partialy reverts a4bcefbcff01c9cdc257127df376929cd80304b1.

12 years agodocs: Add method to print warnings in docBuilder class
Peter Krempa [Fri, 27 Jul 2012 13:03:03 +0000 (15:03 +0200)]
docs: Add method to print warnings in docBuilder class

The method was not existing and did not allow to diagnose problems.

12 years agomaint: avoid regression on copyright listings
Eric Blake [Thu, 26 Jul 2012 22:58:02 +0000 (16:58 -0600)]
maint: avoid regression on copyright listings

Commit f9ce7dad6 tried to kill uses of a raw street address, but
missed a few instances.  Automate things so we don't introduce
new problems in the future.

* cfg.mk (sc_copyright_address): New rule.
(exclude_file_name_regexp--sc_copyright_address): Add exemption.
* bootstrap.conf: Adjust offenders.
* build-aux/augeas-gentest.pl: Likewise.
* examples/systemtap/events.stp: Likewise.
* examples/systemtap/qemu-monitor.stp: Likewise.
* examples/systemtap/rpc-monitor.stp: Likewise.
* src/dtrace2systemtap.pl: Likewise.
* src/esx/esx_vi_generator.py: Likewise.
* src/hyperv/hyperv_wmi_generator.py: Likewise.
* src/remote/qemu_protocol.x: Likewise.
* src/remote/remote_protocol.x: Likewise.
* src/rpc/gensystemtap.pl: Likewise.
* src/rpc/virnetprotocol.x: Likewise.
* tests/object-locking.ml: Likewise.
* tools/virt-xml-validate.in: Likewise.

12 years agomaint: Use consistent copyright.
Osier Yang [Fri, 27 Jul 2012 09:39:53 +0000 (17:39 +0800)]
maint: Use consistent copyright.

This is a follow up patch of commit f9ce7dad6, it modifies all
the files which declare the copyright like "See COPYING.LIB for
the License of this software" to use the detailed/consistent one.

And deserts the outdated comments like:

 * libvirt-qemu.h:
 * Summary: qemu specific interfaces
 * Description: Provides the interfaces of the libvirt library to handle
 *              qemu specific methods
 *
 * Copy:  Copyright (C) 2010, 2012 Red Hat, Inc.

Uses the more compact style like:

 * libvirt-qemu.h: Interfaces specific for QEMU/KVM driver
 *
 * Copyright (C) 2010, 2012 Red Hat, Inc.

12 years agoAdd a test case that checks there are no bogus entries in .syms
Daniel P. Berrange [Tue, 24 Jul 2012 13:37:48 +0000 (14:37 +0100)]
Add a test case that checks there are no bogus entries in .syms

During refactoring of code, it has proved common to forget to
remove old symbols from the .syms file. While the Win32 linker
will complain about this, the Linux ELF linker does not. The
new test case validates that every symbol listed in the .syms
file actually exists in the built ELF libraries.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove accidentally commited virNetClientSetEOFNotify symbol
Daniel P. Berrange [Fri, 27 Jul 2012 09:53:50 +0000 (10:53 +0100)]
Remove accidentally commited virNetClientSetEOFNotify symbol

The virNetClientSetEOFNotify symbol was accidentally added to
the libvirt_private.syms file due to an out-of-order cherry-pick

12 years agoRemove two non-existant NWFilter driver symbols from .syms
Daniel P. Berrange [Tue, 24 Jul 2012 13:39:51 +0000 (14:39 +0100)]
Remove two non-existant NWFilter driver symbols from .syms

virNWFilterGetIpAddrForIfname and virNWFilterDelIpAddrForIfname
do not exist, so remove them from libvirt_nwfilter.syms

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agovirsh: Fix error resetting on fallback paths
Peter Krempa [Thu, 26 Jul 2012 09:24:30 +0000 (11:24 +0200)]
virsh: Fix error resetting on fallback paths

On some fallback paths in virsh, error reported by the previously failed
API is cleared by virResetLastError() that doesn't free error stored by
virsh. This patch changes this to clear it using vshResetLibvirtError().

12 years agovirsh: Refactor error clearing on graceful fallback paths
Peter Krempa [Wed, 25 Jul 2012 11:41:49 +0000 (13:41 +0200)]
virsh: Refactor error clearing on graceful fallback paths

Virsh uses an error handler to save errors from libvirt. On some code
paths it's needed to clear libvirt errors and continue on fallback code
paths without reporting failure.

This patch adds function vshResetLibvirtError() that clears error
returned by libvirt and updates all places where the old two-line method
was used.

12 years agomaint: don't permit format strings without %
Eric Blake [Mon, 23 Jul 2012 20:33:08 +0000 (14:33 -0600)]
maint: don't permit format strings without %

Any time we have a string with no % passed through gettext, a
translator can inject a % to cause a stack overread.  When there
is nothing to format, it's easier to ask for a string that cannot
be used as a formatter, by using a trivial "%s" format instead.

In the past, we have used --disable-nls to catch some of the
offenders, but that doesn't get run very often, and many more
uses have crept in.  Syntax check to the rescue!

The syntax check can catch uses such as
virReportError(code,
               _("split "
                 "string"));
by using a sed script to fold context lines into one pattern
space before checking for a string without %.

This patch is just mechanical insertion of %s; there are probably
several messages touched by this patch where we would be better
off giving the user more information than a fixed string.

* cfg.mk (sc_prohibit_diagnostic_without_format): New rule.
* src/datatypes.c (virUnrefConnect, virGetDomain)
(virUnrefDomain, virGetNetwork, virUnrefNetwork, virGetInterface)
(virUnrefInterface, virGetStoragePool, virUnrefStoragePool)
(virGetStorageVol, virUnrefStorageVol, virGetNodeDevice)
(virGetSecret, virUnrefSecret, virGetNWFilter, virUnrefNWFilter)
(virGetDomainSnapshot, virUnrefDomainSnapshot): Add %s wrapper.
* src/lxc/lxc_driver.c (lxcDomainSetBlkioParameters)
(lxcDomainGetBlkioParameters): Likewise.
* src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML)
(virDomainDiskDefParseXML, virDomainGraphicsDefParseXML):
Likewise.
* src/conf/network_conf.c (virNetworkDNSHostsDefParseXML)
(virNetworkDefParseXML): Likewise.
* src/conf/nwfilter_conf.c (virNWFilterIsValidChainName):
Likewise.
* src/conf/nwfilter_params.c (virNWFilterVarValueCreateSimple)
(virNWFilterVarAccessParse): Likewise.
* src/libvirt.c (virDomainSave, virDomainSaveFlags)
(virDomainRestore, virDomainRestoreFlags)
(virDomainSaveImageGetXMLDesc, virDomainSaveImageDefineXML)
(virDomainCoreDump, virDomainGetXMLDesc)
(virDomainMigrateVersion1, virDomainMigrateVersion2)
(virDomainMigrateVersion3, virDomainMigrate, virDomainMigrate2)
(virStreamSendAll, virStreamRecvAll)
(virDomainSnapshotGetXMLDesc): Likewise.
* src/nwfilter/nwfilter_dhcpsnoop.c (virNWFilterSnoopReqLeaseDel)
(virNWFilterDHCPSnoopReq): Likewise.
* src/openvz/openvz_driver.c (openvzUpdateDevice): Likewise.
* src/openvz/openvz_util.c (openvzKBPerPages): Likewise.
* src/qemu/qemu_cgroup.c (qemuSetupCgroup): Likewise.
* src/qemu/qemu_command.c (qemuBuildHubDevStr, qemuBuildChrChardevStr)
(qemuBuildCommandLine): Likewise.
* src/qemu/qemu_driver.c (qemuDomainGetPercpuStats): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
* src/rpc/virnetsaslcontext.c (virNetSASLSessionGetIdentity):
Likewise.
* src/rpc/virnetsocket.c (virNetSocketNewConnectUNIX)
(virNetSocketSendFD, virNetSocketRecvFD): Likewise.
* src/storage/storage_backend_disk.c
(virStorageBackendDiskBuildPool): Likewise.
* src/storage/storage_backend_fs.c
(virStorageBackendFileSystemProbe)
(virStorageBackendFileSystemBuild): Likewise.
* src/storage/storage_backend_rbd.c
(virStorageBackendRBDOpenRADOSConn): Likewise.
* src/storage/storage_driver.c (storageVolumeResize): Likewise.
* src/test/test_driver.c (testInterfaceChangeBegin)
(testInterfaceChangeCommit, testInterfaceChangeRollback):
Likewise.
* src/vbox/vbox_tmpl.c (vboxListAllDomains): Likewise.
* src/xenxs/xen_sxpr.c (xenFormatSxprDisk, xenFormatSxpr):
Likewise.
* src/xenxs/xen_xm.c (xenXMConfigGetUUID, xenFormatXMDisk)
(xenFormatXM): Likewise.

12 years agomaint: avoid empty regex in syntax checker
Eric Blake [Thu, 26 Jul 2012 14:29:15 +0000 (08:29 -0600)]
maint: avoid empty regex in syntax checker

We were defining 'func_or' as '|VIR_ERROR|...', which when put
inside 'func_re' resulted in a regex that matches everything in
isolation.  Thankfully, we always used func_re with a leading
anchor \<, and since the empty regex does not start a word, we
happened to get the result we wanted; but it's better to define
func_or without a leading space converted into a leading empty
alternation.

* cfg.mk (func_or): Strip leading space.

12 years agovirsh: check if specified debug level is in range
Ján Tomko [Thu, 26 Jul 2012 14:05:51 +0000 (16:05 +0200)]
virsh: check if specified debug level is in range

12 years agobuild: update to latest gnulib, for secure tarball
Eric Blake [Tue, 10 Jul 2012 15:37:07 +0000 (09:37 -0600)]
build: update to latest gnulib, for secure tarball

Pick up some build fixes in the latest gnulib.  In particular,
we want to ensure that official tarballs are secure, but don't
want to penalize people who don't run 'make dist', since fixed
automake still hasn't hit common platforms like Fedora 17.

* .gnulib: Update to latest, for Automake CVE-2012-3386 detection.
* bootstrap: Resync from gnulib.
* bootstrap.conf (gnulib_extra_files): Drop missing, since gnulib
has dropped it in favor of Automake's version.
* cfg.mk (local-checks-to-skip): Conditionally skip the security
check in cases where it doesn't matter.

12 years agovirsh: Check for existence of storage before undefining the domain
Peter Krempa [Fri, 22 Jun 2012 12:16:24 +0000 (14:16 +0200)]
virsh: Check for existence of storage before undefining the domain

When undefining a domain and removing associated storage using "virsh
undefine --storage" the domain was at first undefined and after that the
storage removal proces was started. If the user specified an invalid
disk to remove, the error could not be corrected.

This patch moves enumeration and filtering of volumes that should be
removed before the domain is undefined, but the removal process is still
kept after the domain has been undefined.

12 years agodoc: add more description on libvirtd option timeout
Guannan Ren [Wed, 25 Jul 2012 16:22:53 +0000 (00:22 +0800)]
doc: add more description on libvirtd option timeout

12 years agoutil: set minimum value of nodesuspend duration to 60 seconds
Guannan Ren [Wed, 25 Jul 2012 05:52:49 +0000 (13:52 +0800)]
util: set minimum value of nodesuspend duration to 60 seconds

Change the permissible minimum value of nodesuspend duration time
to 60 seconds. If option is less than the value, reports error.
Update virsh help and manpage the infomation.

12 years agovirsh: Move command group definition into its own file
Osier Yang [Mon, 23 Jul 2012 07:19:04 +0000 (15:19 +0800)]
virsh: Move command group definition into its own file

* virsh-domain-monitor.c: Add domMonitoringCmds
* virsh-domain.c: Add domManagementCmds
* virsh-host.c: Add hostAndHypervisorCmds
* virsh-interface.c: Add ifaceCmds
* virsh-network.c: Add networkCmds
* virsh-nodedev.c: Add nodedevCmds
* virsh-nwfilter.c: Add nwfilterCmds
* virsh-pool.c: Add storagePoolCmds
* virsh-secret.c: Add secretCmds
* virsh-snapshot.c: Add snapshotCmds
* virsh-volume.c: Add storageVolCmds
* virsh.c: Remove all the above *Cmds.

12 years agovirsh: Split cmds in node device group from virsh.c
Osier Yang [Mon, 23 Jul 2012 07:08:39 +0000 (15:08 +0800)]
virsh: Split cmds in node device group from virsh.c

Commands in node device group moved from virsh.c to virsh-nodedev.c,

* virsh.c: Remove commands in node device group.
* virsh-nodedev.c: New file, filled with commands in node device group
* po/POTFILES.in: Add virsh-nodedev.c
* cfg.mk: Skip to check config.h including for virsh-nodedev.c

12 years agovirsh: Split cmds in host group from virsh.c
Osier Yang [Mon, 23 Jul 2012 06:37:50 +0000 (14:37 +0800)]
virsh: Split cmds in host group from virsh.c

Commands in host group moved from virsh.c to virsh-host.c,

* virsh.c: Remove commands in host group.
* virsh-host.c: New file, filled with commands in host group
* po/POTFILES.in: Add virsh-host.c
* cfg.mk: Skip to check config.h including for virsh-host.c

12 years agovirsh: Split cmds to manage domain snapshot from virsh.c
Osier Yang [Mon, 23 Jul 2012 06:23:00 +0000 (14:23 +0800)]
virsh: Split cmds to manage domain snapshot from virsh.c

Commands to manage domain snapshot are moved from virsh.c to
virsh-snapshot.c.

* virsh.c: Remove domain snapshot commands.
* virsh-snapshot.c: New file, filled with domain snapshot commands.
* po/POTFILES.in: Add virsh-snapshot.c
* cfg.mk: Skip strcase and config.h including checking for
          virsh-snapshot.c

12 years agovirsh: Split cmds to manage secret from virsh.c
Osier Yang [Mon, 23 Jul 2012 06:18:51 +0000 (14:18 +0800)]
virsh: Split cmds to manage secret from virsh.c

Commands to manage secret are moved from virsh.c to virsh-secret.c,
with a few helpers for secret command use.

* virsh.c: Remove secret commands and a few helpers.
           (vshCommandOptSecret, and vshCommandOptSecretBy)
* virsh-secret.c: New file, filled with secret commands and its helpers.
* po/POTFILES.in: Add virsh-secret.c
* cfg.mk: Skip to check config.h including for virsh-secret.c

12 years agovirsh: Split cmds to manage network filter from virsh.c
Osier Yang [Mon, 23 Jul 2012 06:15:55 +0000 (14:15 +0800)]
virsh: Split cmds to manage network filter from virsh.c

Commands to manage network filter are moved from virsh.c to virsh-nwfilter.c,
with a few helpers for network filter command use.

* virsh.c: Remove network filter commands and a few helpers.
           (vshCommandOptNWFilter, and vshCommandOptNWFilterBy)
* virsh-nwfilter.c: New file, filled with network filter commands and its helpers.

* po/POTFILES.in: Add virsh-nwfilter.c

* cfg.mk: Skip to check config.h including for virsh-nwfilter.c

12 years agovirsh: Split cmds to manage host interface from virsh.c
Osier Yang [Tue, 24 Jul 2012 08:56:49 +0000 (16:56 +0800)]
virsh: Split cmds to manage host interface from virsh.c

Commands to manage host interface are moved from virsh.c to
virsh-interface.c, with a few helpers for interface command use.

* virsh.c: Remove interface commands and a few helpers.
           (vshCommandOptInterface, vshCommandOptInterfaceBy)
* virsh-interface.c: New file, filled with interface commands and
                     its helpers.
* cfg.mk: Skip to check config.h including for virsh-interface.c
* po/POTFILES.in: Add virsh-interface.c

12 years agovirsh: Split cmds to manage network from virsh.c
Osier Yang [Mon, 23 Jul 2012 06:02:14 +0000 (14:02 +0800)]
virsh: Split cmds to manage network from virsh.c

Commands to manage network are moved from virsh.c to virsh-network.c,
with a few helpers for network command use.

* virsh.c: Remove network commands and a few helpers.
* virsh-network.c: New file, filled with network commands and its
                   helpers.
* po/POTFILES.in: Add virsh-network.c
* cfg.mk: Skip to check config.h including for virsh-network.c

12 years agovirsh: Split cmds of storage pool group from virsh.c
Osier Yang [Tue, 24 Jul 2012 08:49:27 +0000 (16:49 +0800)]
virsh: Split cmds of storage pool group from virsh.c

This splits commands of storage pool group into virsh-pool.c,
The helpers not for common use are moved too. Standard copyright
is added for the new file.

* tools/virsh.c:
  Remove commands for storage storage pool and a few helpers.
  (vshCommandOptVol, vshCommandOptVolBy).

* tools/virsh-pool.c:
  New file, filled with commands of storage pool group and its
  helpers.

* po/POTFILES.in:
  Add virsh-pool.c

* cfg.mk:
  Skip to check config.h including for virsh-pool.c

12 years agovirsh: Split cmds of storage volume group from virsh.c
Osier Yang [Tue, 24 Jul 2012 08:44:49 +0000 (16:44 +0800)]
virsh: Split cmds of storage volume group from virsh.c

This splits commands of storage volume group into virsh-volume.c,
The helpers not for common use are moved too. Standard copyright
is added for the new file.

* tools/virsh.c:
  Remove commands for storage storage volume and a few helpers.
  (vshCommandOptVol, vshCommandOptVolBy).

* tools/virsh-volume.c:
  New file, filled with commands of storage volume group and its
  helpers.

* po/POTFILES.in:
  Add virsh-volume.c

* cfg.mk:
  Skip to check config.h including for virsh-volume.c

12 years agovirsh: Split cmds of domain group from virsh.c
Osier Yang [Wed, 25 Jul 2012 15:37:18 +0000 (23:37 +0800)]
virsh: Split cmds of domain group from virsh.c

This splits commands to manage domain into virsh-domain.c,The helpers
not for common use are moved into them too. Standard copyright is added
for the new file.

* tools/virsh.c:
  - Remove commands for domain group, and one helper
    (vshDomainVcpuStateToString)
  - vshStreamSink is moved before commands's definition for it's
    also used by commands not of domain group, such as volUpload.

* tools/virsh-domain.c:
  - New file, commands for domain group and the one helper are
    moved into it.

* po/POTFILES.in:
  - Add virsh-domain.c

* cfg.mk:
  - Skip to check config.h including for virsh-domain.c

12 years agovirsh: Split cmds for domain monitoring from virsh.c
Osier Yang [Tue, 24 Jul 2012 08:24:50 +0000 (16:24 +0800)]
virsh: Split cmds for domain monitoring from virsh.c

This splits commands commands to monitor domain status into
virsh-domain-monitor.c. The helpers not for common use are moved too.
Standard copyright is added.

* tools/virsh.c:
  - Remove commands for domain monitoring group and a few helpers (
    vshDomainIOErrorToString, vshGetDomainDescription,
    vshDomainControlStateToString, vshDomainStateToString) not for
    common use.
  - Remove (incldue "intprops.h").

* tools/virsh-domain-monitor.c:
  - New file, filled with commands of domain monitor group.
  - Add "intprops.h".

* cfg.mk:
  - Skip strcase checking for virsh-domain-monitor.c
  - Skip to check config.h including for virsh-domain-monitor.c

* po/POTFILES.in
  - Add virsh-domain-monitor.c

12 years agovirsh: Move definition of cmds and cmd groups right at the top of main
Osier Yang [Mon, 23 Jul 2012 03:57:53 +0000 (11:57 +0800)]
virsh: Move definition of cmds and cmd groups right at the top of main

This will avoid many conflicts if moving the codes for each command
group into separate files in later patches.

12 years agovirsh man page - domain-id consistency
Jan Tomko [Wed, 25 Jul 2012 11:17:03 +0000 (13:17 +0200)]
virsh man page - domain-id consistency

Using 'domain' to represent domain name, domain id or uuid all over
the man page, to be consistent with virsh help.

12 years agoFixup manpage names and copyright dates
Laine Stump [Tue, 24 Jul 2012 17:41:03 +0000 (13:41 -0400)]
Fixup manpage names and copyright dates

The copyright dates in the manpages haven't been updated in awhile.

Also, when pod2man converts a pod file into a manpage, it will only
remove the extension from the filename if it is ".pod". Some of the
libvirt pod files are named *.pod.in, and that filename is placed
unchanged into the manpage. This patch uses pod2man's --name option to
fix that.

Believe it or not, there's even a BZ for this:

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

12 years agoconf: Fix typo in virDomainHostdevSubsys comment
Jiri Denemark [Wed, 25 Jul 2012 14:27:06 +0000 (16:27 +0200)]
conf: Fix typo in virDomainHostdevSubsys comment

12 years agomaint: spelling correction in AUTHORS
Eric Blake [Wed, 25 Jul 2012 14:01:24 +0000 (08:01 -0600)]
maint: spelling correction in AUTHORS

Ján Tomko has an accented name.

12 years agoutil: Fix typoes on return value and comments
Guannan Ren [Wed, 25 Jul 2012 09:43:18 +0000 (17:43 +0800)]
util: Fix typoes on return value and comments

virNetDevTapCreateInBridgePort: Fix return value to -1
virNetDevTapCreate: Fix comments

12 years agofixed SegFault in virauth
Martin Kletzander [Tue, 24 Jul 2012 14:08:46 +0000 (16:08 +0200)]
fixed SegFault in virauth

No check for conn->uri being NULL in virAuthGetConfigFilePath (valid
state) made the client segfault. This happens for example with these
settings:
 - no virtualbox driver installed (modifies conn->uri)
 - no default URI set (VIRSH_DEFAULT_CONNECT_URI="",
   LIBVIRT_DEFAULT_URI="", uri_default="")
 - auth_sock_rw="sasl"
 - virsh run as root

That are unfortunately the settings with fresh Fedora 17 installation
with VDSM.

The check ought to be enough as conn->uri being NULL is valid in later
code and is handled properly.

12 years agodaemon: Fix the wrong macro name
Osier Yang [Fri, 20 Jul 2012 14:25:17 +0000 (22:25 +0800)]
daemon: Fix the wrong macro name

WITH_INTERFACE is not defined, it should be WITH_NETCF there to load
the interface driver.

Eric posted patch weeks ago to resolve the problems in the whole
build system, but it's not finalised yet:

https://www.redhat.com/archives/libvir-list/2012-June/msg01299.html

I'm going to simply fix the wrong macro name here so that the
interface driver could loaded, and continue the work on the listing
API for interface driver.

12 years agovirsh: Clarify that memtune parameters may be rounded in the man page
Jan Tomko [Tue, 24 Jul 2012 08:50:29 +0000 (10:50 +0200)]
virsh: Clarify that memtune parameters may be rounded in the man page

12 years agoFix libnl CFLAGS/LIBS inclusion
Doug Goldstein [Sat, 21 Jul 2012 13:02:22 +0000 (08:02 -0500)]
Fix libnl CFLAGS/LIBS inclusion

When using libnl, use the variables pkg-config provides in case there are
additional libraries or CFLAGS required to build it. Specifically if
the libnl headers are not directly in /usr/include.

12 years agovirsh: fixed domdisplay command
Martin Kletzander [Tue, 24 Jul 2012 14:00:14 +0000 (16:00 +0200)]
virsh: fixed domdisplay command

The 'domdisplay' command didn't properly evaluate '--include-password'
option.

12 years agobuilding: fix deps error when some drivers are not built
Wen Congyang [Mon, 23 Jul 2012 09:58:28 +0000 (17:58 +0800)]
building: fix deps error when some drivers are not built

libvirt-daemon-driver-XXX should be a dependency only when with_driver_modules
is 1.
libvirt-daemon-driver-libxl should be a dependency only when with_libxl is 1.
libvirt-daemon-driver-lxc should be a dependency only when with_lxc is 1.
libvirt-daemon-driver-qemu should be a dependency only when with_qemu is 1.
libvirt-daemon-driver-uml should be a dependency only when with_uml is 1.
libvirt-daemon-driver-xen should be a dependency only when with_xen is 1.

12 years agoMore advanced auto-detection of driver module directory
Daniel P. Berrange [Mon, 23 Jul 2012 15:21:13 +0000 (16:21 +0100)]
More advanced auto-detection of driver module directory

When running directly from GIT, libvirtd attempts to locate
the directory containing loadable modules. This currently
only works if executing libvirtd with a CWD inside the libvirt
source tree. Switch to locate based on the path to the current
binary instead

12 years agoadding handling EINTR to poll to make it more robust
Royce Lv [Thu, 19 Jul 2012 01:49:41 +0000 (09:49 +0800)]
adding handling EINTR to poll to make it more robust

some system call and signal will interrupt poll,
making event loop stops and fails to react events and keepalive message
from libvirt.
adding handling EINTR to poll to make it more robust

Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
12 years agobuild: regenerate .png files
Eric Blake [Sat, 21 Jul 2012 03:34:39 +0000 (21:34 -0600)]
build: regenerate .png files

We don't expect people to have tools installed to regenerate .png
from .fig by default.  However, since commit 5eb3df8, several
.fig files were updated without regenerating the .png file, and
as a result, 'make dist' ends up regenerating those five files,
or worse, failing because of missing tools (convert from
ImageMagick).

Additionally, even if the tools are present, the generation of
.png files is nondeterministic (the resulting files contain a
timestamp), which means prior to this patch, running 'make dist'
from two checkouts will end up producing different tarball
contents (two 'make dist' runs will always produce different tar
files, since tarballs also contain timestamps; but unpacking the
tarballs and doing a recursive diff will show if the contents
are unchanged).

After this patch, the timestamps are now up-to-date, and 'make
dist' no longer has anything to do for the .png files.  This gets
us closer to the goal of two checkouts being able to produce the
same tarball.

* docs/libvirt-*.png: Regenerate.

12 years agoMake ESX & Hyper-V code generator safe with parallel builds
Daniel P. Berrange [Mon, 23 Jul 2012 14:45:20 +0000 (15:45 +0100)]
Make ESX & Hyper-V code generator safe with parallel builds

If from a clean GIT checkout 'make -j 8' is run, the ESX
and Hyper-V code will be generated multiple times over.
This is because there are multiple files being generated
from one invocation of the generator script. make does not
realize this and so invokes the generator once per file.
This doesn't matter with serialized builds, but with
parallel builds multiple instances of the generator get
run at once.

make[2]: Entering directory `/home/berrange/src/virt/libvirt/src'
  GEN    util/virkeymaps.h
  GEN    remote/remote_protocol.h
  GEN    remote/remote_client_bodies.h
  GEN    remote/qemu_protocol.h
  GEN    remote/qemu_client_bodies.h
  GEN    esx/esx_vi_methods.generated.c
  GEN    esx/esx_vi_methods.generated.h
  GEN    esx/esx_vi_methods.generated.macro
  GEN    esx/esx_vi_types.generated.c
  GEN    esx/esx_vi_types.generated.h
  GEN    esx/esx_vi_types.generated.typedef
  GEN    esx/esx_vi_types.generated.typedef
  GEN    esx/esx_vi_types.generated.typeenum
  GEN    esx/esx_vi_types.generated.typetostring
  GEN    esx/esx_vi_types.generated.typefromstring
  GEN    esx/esx_vi_types.generated.h
  GEN    esx/esx_vi_types.generated.c
  GEN    esx/esx_vi_methods.generated.h
  GEN    esx/esx_vi_methods.generated.c
  GEN    esx/esx_vi_methods.generated.macro
  GEN    esx/esx_vi.generated.h
  GEN    esx/esx_vi.generated.c
  GEN    esx/esx_vi_types.generated.typeenum
  GEN    esx/esx_vi_types.generated.typedef
  GEN    esx/esx_vi_types.generated.typeenum
  GEN    esx/esx_vi_types.generated.typetostring
  GEN    esx/esx_vi_types.generated.typefromstring
  GEN    esx/esx_vi_types.generated.h
  GEN    esx/esx_vi_types.generated.c
  GEN    esx/esx_vi_methods.generated.h
  ...snip...
  GEN    hyperv/hyperv_wmi.generated.h
  GEN    libvirt_qemu_probes.h
  GEN    locking/qemu-sanlock.conf
  GEN    hyperv/hyperv_wmi.generated.c
  GEN    rpc/virnetprotocol.h
  GEN    hyperv/hyperv_wmi_classes.generated.typedef
  GEN    hyperv/hyperv_wmi_classes.generated.h
  GEN    hyperv/hyperv_wmi_classes.generated.c
  GEN    rpc/virkeepaliveprotocol.h
  GEN    remote/remote_protocol.c
  GEN    remote/qemu_protocol.c
  GEN    rpc/virkeepaliveprotocol.c
  GEN    rpc/virnetprotocol.c
  GEN    libvirt.def

Prevent this using a timestamp file to control generation,
as was previously done for the python bindings in commit
a7868e0131516ef2dece82586edd52dc87fe336c

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agotests: Add support for catching domain XML parsing errors
Peter Krempa [Mon, 9 Jul 2012 16:29:55 +0000 (18:29 +0200)]
tests: Add support for catching domain XML parsing errors

This patch enhances qemuxml2argvtest to deal with semantically incorrect
domain XMLs, that generate errors while parsing.

This patch cleans up macros that invoke the tests and changes boolean
flags to a bit array flag variable.

12 years agomaint: Clean up coding style and fix error message spelling
Peter Krempa [Mon, 2 Jul 2012 15:24:09 +0000 (17:24 +0200)]
maint: Clean up coding style and fix error message spelling

This patch cleans up coding style breaks some long lines and fixes error
message spelling on various places in domain_conf.c and in the qemu
driver.

12 years agodoc: Fix time keeping example for the guest clock
Doug Goldstein [Sat, 21 Jul 2012 13:14:44 +0000 (08:14 -0500)]
doc: Fix time keeping example for the guest clock

The time keeping example was missing quotes which resulted in an error
if you copied and pasted the example into a domain's XML. Additionally
the rest of the examples use single quotes (') instead of double quotes
(") so standardized that.

12 years agoFix test failure when no IPv6 is avail
Doug Goldstein [Sun, 22 Jul 2012 17:04:16 +0000 (12:04 -0500)]
Fix test failure when no IPv6 is avail

When the system doesn't have IPv6 available (e.g. not built into the
kernel or the module isn't loaded), you can not create an IPv6 socket.
The test determines earlier on that IPv6 isn't available then goes and
creates a socket. This makes socket creation conditional on IPv6
availability.

12 years agoDesert the FSF address in copyright
Osier Yang [Sat, 21 Jul 2012 10:06:23 +0000 (18:06 +0800)]
Desert the FSF address in copyright

Per the FSF address could be changed from time to time, and GNU
recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)

  You should have received a copy of the GNU General Public License
  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.

This patch removes the explicit FSF address, and uses above instead
(of course, with inserting 'Lesser' before 'General').

Except a bunch of files for security driver, all others are changed
automatically, the copyright for securify files are not complete,
that's why to do it manually:

  src/security/security_selinux.h
  src/security/security_driver.h
  src/security/security_selinux.c
  src/security/security_apparmor.h
  src/security/security_apparmor.c
  src/security/security_driver.c

12 years agoESX: Fix ESX_VI__TEMPLATE__DYNAMIC_DEEP_COPY
Ata E Husain Bohra [Thu, 19 Jul 2012 06:14:18 +0000 (23:14 -0700)]
ESX: Fix ESX_VI__TEMPLATE__DYNAMIC_DEEP_COPY

Fix addresses two issues:
1. Fix generator code to allow deep copy operation for objects with
   Dynamic_Cast capabilities.
2. Add missing deep copy routine to Long datatype.

Signed-off-by: Ata E Husain Bohra <ata.husain@hotmail.com>
12 years agovmx: handle shared folders parsing
Jean-Baptiste Rouault [Wed, 11 Jul 2012 10:16:35 +0000 (12:16 +0200)]
vmx: handle shared folders parsing

This patch adds support for parsing vmx files with
shared folders enabled.

Update test suite accordingly.

12 years agovmx: handle shared folders formatting
Jean-Baptiste Rouault [Wed, 11 Jul 2012 10:16:34 +0000 (12:16 +0200)]
vmx: handle shared folders formatting

This patch adds support for generating vmx files with
shared folders enabled.

Update test suite accordingly.

12 years agotests: reduce length of nodeinfodata test names
Eric Blake [Fri, 20 Jul 2012 19:12:44 +0000 (13:12 -0600)]
tests: reduce length of nodeinfodata test names

Commit ddd6bef4 switched to the ustar format to fix an issue where
'make dist' fails to create a tarball because we have files with
relative names longer than 100 bytes by the time you include a
'libvirt-0.9.13' prefix.  Unfortunately, even with ustar format,
the use of 'tar -ch' tries to convert symlinks to hard links,
also with a name too long (omitting the -h works, but automake
automatically passes -h); such symlinks were added in commit
6dcf98c, which resulted in 'make dist' breaking again.  The
solution is to rename the offending symlinks to something shorter,
by shortening the entire nodeinfodata naming scheme.

* tests/nodeinfotest.c (mymain): Shorten test names.
(linuxTestNodeInfo): Accommodate new names.
* tests/nodeinfodata/*: Rename files accordingly.

12 years agotests: avoid seclabeltest crash
Eric Blake [Fri, 20 Jul 2012 20:44:54 +0000 (14:44 -0600)]
tests: avoid seclabeltest crash

Commit a56c347 introduced a use of random numbers into seclabel
handling, but failed to initialize the random number generator
in the testsuite.  Also, fail with usual status, not 255.

* tests/seclabeltest.c (main): Initialize randomness.

12 years agoopenvz: Implement domainGetHostname
Guido Günther [Tue, 10 Jul 2012 11:58:44 +0000 (13:58 +0200)]
openvz: Implement domainGetHostname

12 years agoopenvz: Add openvzVEGetStringParam
Guido Günther [Tue, 10 Jul 2012 11:57:38 +0000 (13:57 +0200)]
openvz: Add openvzVEGetStringParam

to retrieve a VEs config parameters as a single string. This will be
used by the upcoming domainGetHostname implementation.

12 years agoremote: Provide RPC call for domainGetHostname
Guido Günther [Fri, 13 Jul 2012 07:12:07 +0000 (09:12 +0200)]
remote: Provide RPC call for domainGetHostname

12 years agovirsh: Add domhostname
Guido Günther [Tue, 10 Jul 2012 10:45:30 +0000 (12:45 +0200)]
virsh: Add domhostname

to query the guest's hostname.

12 years agoAdd virDomainGetHostname
Guido Günther [Tue, 10 Jul 2012 07:34:23 +0000 (09:34 +0200)]
Add virDomainGetHostname

to query a guests's hostname. Containers like LXC and OpenVZ allow to
set a hostname different from the hosts name and QEMU's guest agent
could provide similar functionality.

12 years agoReport 'errno' in int1 field of virErrorPtr
Daniel P. Berrange [Mon, 24 Oct 2011 16:34:18 +0000 (17:34 +0100)]
Report 'errno' in int1 field of virErrorPtr

When reporting a system error (VIR_ERR_SYSTEM_ERROR) via
virReportSystemError, we should copy the errno value into
the 'int1' field of the virErrorPtr struct. This allows
callers to detect certain errno conditions & discard the
error

* src/util/virterror.c: Place errno value in int1 field

12 years agoOnly enforce check for YAJL when starting a VM
Daniel P. Berrange [Wed, 4 Jul 2012 09:44:58 +0000 (10:44 +0100)]
Only enforce check for YAJL when starting a VM

The previous check for YAJL would have many undesirable
consequences, the most important being that it caused the
capabilities XML to lose all <guest> elements. There is
no user visible feedback as to what is wrong in this respect,
merely a syslog message. The empty capabilities causes
libvirtd to then throw away all guest XML configs that are
stored.

This changes the code so that the check for YAJL is only
performed at the time we attempt to spawn a QEMU process

error: Failed to start domain vm-vnc
error: unsupported configuration: this qemu binary requires libvirt to be compiled with yajl

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoUse a hash table for storing MCS labels
Daniel P. Berrange [Thu, 24 May 2012 16:22:29 +0000 (17:22 +0100)]
Use a hash table for storing MCS labels

Instead of using an O(n) efficiency linked list for storing
MCS labels, use a hash table. Instead of having the list
be global, put it in the SELinux driver private data struct
to ensure uniqueness across different instances of the driver.
This also ensures thread safety when multiple hypervisor
drivers are used in the same libvirtd process

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix error handling when adding MCS labels
Daniel P. Berrange [Thu, 24 May 2012 15:52:18 +0000 (16:52 +0100)]
Fix error handling when adding MCS labels

When adding MCS labels, OOM was not being handled correctly.
In addition when reserving an existing label, no check was
made to see if it was already reserved

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoUse standard naming prefix for SELinux driver function names
Daniel P. Berrange [Thu, 24 May 2012 15:42:51 +0000 (16:42 +0100)]
Use standard naming prefix for SELinux driver function names

The function names in the SELinux driver all start with
SELinux or 'mcs' as a prefix. Sanitize this so that they
all use 'virSecuritySELinux' as the prefix

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDisable NWFilter driver completely when unprivileged
Daniel P. Berrange [Thu, 19 Jul 2012 14:58:45 +0000 (15:58 +0100)]
Disable NWFilter driver completely when unprivileged

Running libvirtd unprivileged results in a warning message from
the NWFilter driver

  virNWFilterSnoopLeaseFileRefresh:1882 : open("/var/run/libvirt/network/nwfilter.ltmp"): No such file or directory

Since it requires privileged network access, this driver should
not even run when unprivileged.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of custom macros with virReportError in the Xen drivers
Daniel P. Berrange [Wed, 18 Jul 2012 13:48:05 +0000 (14:48 +0100)]
Replace use of custom macros with virReportError in the Xen drivers

Update the legacy Xen drivers to use virReportError instead of
the statsError, virXenInotifyError, virXenStoreError,
virXendError, xenUnifiedError, xenXMError custom macros

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMake sure xenHypervisorInit correctly reports errors
Daniel P. Berrange [Fri, 20 Jul 2012 13:57:39 +0000 (14:57 +0100)]
Make sure xenHypervisorInit correctly reports errors

The xenHypervisorInit method was called from two different
locations, during initial driver registration and also while
opening a Xen connection. The former can't report any useful
errors to the end user/app, so remove it. To ensure thread
safety use a VIR_ONCE_GLOBAL_INIT call to invoke
xenHypervisorInit from the xenHypervisorOpen method.

12 years agoEnsure failure to talk to Xen hypervisor is fatal when privileged
Daniel P. Berrange [Fri, 20 Jul 2012 13:52:44 +0000 (14:52 +0100)]
Ensure failure to talk to Xen hypervisor is fatal when privileged

As per the comment, the Xen hypervisor driver is considered to
be mandatory when running privileged. When it fails to open,
we should thus return an error, not ignore it.

12 years agoUsing virOnce for global initialization is desirable since it
Daniel P. Berrange [Fri, 20 Jul 2012 14:03:39 +0000 (15:03 +0100)]
Using virOnce for global initialization is desirable since it
ensures that initialization will always take place when it is
needed, and guarantees it only occurs once. The problem is that
the code to setup a global initializer with proper error
propagation is tedious. This introduces VIR_ONCE_GLOBAL_INIT
macro to simplify this.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of VMX_ERROR with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 14:47:21 +0000 (15:47 +0100)]
Replace use of VMX_ERROR with virReportError

Update the VMX shared code to use virReportError instead of
the VMX_ERROR custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of virNetError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 18:30:53 +0000 (19:30 +0100)]
Replace use of virNetError with virReportError

Update the libvirtd dispatch code to use virReportError
instead of the virNetError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of virConfError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 18:26:35 +0000 (19:26 +0100)]
Replace use of virConfError with virReportError

Update the libvirtd config handling code to use virReportError
instead of the virConfError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of nodeReportError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 18:19:23 +0000 (19:19 +0100)]
Replace use of nodeReportError with virReportError

Update the nodeinfo helper code to use virReportError instead
of the nodeReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>