]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
12 years agobuild: Fix typo which causes build failure
Osier Yang [Thu, 13 Sep 2012 04:44:19 +0000 (12:44 +0800)]
build: Fix typo which causes build failure

Pushed under build-breaker rule.

12 years agobuild: force libnl1 if netcf also used libnl1
Eric Blake [Fri, 7 Sep 2012 22:38:52 +0000 (16:38 -0600)]
build: force libnl1 if netcf also used libnl1

Recent spec file changes ensure that in distro situations, netcf
and libvirt will link against the same libnl in order to avoid
dumping core.  But for every-day development, if you use F17 and
have the libnl3-devel headers available, libvirt was blindly
linking against libnl3 even though F17 netcf still links against
libnl1, making testing a self-built binary on F17 impossible.

By making configure a little bit smarter, we can avoid this
situation - we merely skip the probe of libnl-3 if we can prove
that netcf is still using libnl-1.  I intentionally wrote the
test so that we still favor libnl-3 if netcf is not installed or
if we couldn't use ldd to determine things.

Defaults being what they are, someone will invariably complain
that our smarts were wrong.  Never fear - in that case, just run
./configure LIBNL_CFLAGS=..., where the fact that you set
LIBNL_CFLAGS (even to the empty string) will go back to probing
for libnl-3, regardless of netcf's choice.

* configure.ac (LIBNL): Don't probe libnl3 if netcf doesn't use it.

12 years agomaint: fix missing spaces in message
Eric Blake [Wed, 12 Sep 2012 16:54:42 +0000 (10:54 -0600)]
maint: fix missing spaces in message

I got an off-list report about a bad diagnostic:
Target network card mac 52:54:00:49:07:ccdoes not match source 52:54:00:49:07:b8

True to form, I've added a syntax check rule to prevent it
from recurring, and found several other offenders.

* cfg.mk (sc_require_whitespace_in_translation): New rule.
* src/conf/domain_conf.c (virDomainNetDefCheckABIStability): Add
space.
* src/esx/esx_util.c (esxUtil_ParseUri): Likewise.
* src/qemu/qemu_command.c (qemuCollectPCIAddress): Likewise.
* src/qemu/qemu_driver.c (qemuDomainSetMetadata)
(qemuDomainGetMetadata): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainChangeNetBridge): Likewise.
* src/rpc/virnettlscontext.c
(virNetTLSContextCheckCertDNWhitelist): Likewise.
* src/vmware/vmware_driver.c (vmwareDomainResume): Likewise.
* src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc, vboxAttachDrives):
Avoid false negatives.
* tools/virsh-domain.c (info_save_image_dumpxml): Reword.
Based on a report by Luwen Su.

12 years agobuild: avoid confusing make with raw name 'undefine'
Eric Blake [Wed, 12 Sep 2012 17:25:51 +0000 (11:25 -0600)]
build: avoid confusing make with raw name 'undefine'

Make has a builtin operator 'undefine', and coupled with latest
automake.git, this test name ended up confusing make into thinking
the file name was meant to be used as the make operator.  Renaming
the file avoids the confusion.

* tests/undefine: Rename...
* tests/virsh-undefine: ...to this.
* tests/Makefile.am (test_scripts): Use new name.
Reported by Jim Meyering.

12 years agoAdd API for opening a QEMU monitor from a socket FD
Daniel P. Berrange [Thu, 6 Sep 2012 15:23:57 +0000 (16:23 +0100)]
Add API for opening a QEMU monitor from a socket FD

Currently qemuMonitorOpen() requires an address of the QEMU
monitor. When doing QMP based capabilities detection it is
easier if a pre-opened FD can be provided, since then the
monitor can be run on the STDIO console. Add a new API
qemuMonitorOpenFD() for such usage

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoparallels: fix parallelsDomainDefineXML for domains with VNC and autoport
Dmitry Guryanov [Mon, 10 Sep 2012 15:23:44 +0000 (19:23 +0400)]
parallels: fix parallelsDomainDefineXML for domains with VNC and autoport

virDomainDefParseString assigns 0 to port if autoport enabled.
So fix code, which check different between old and new
configurations.

12 years agoparallels: fix parallelsDoCmdRun in case of command failure
Dmitry Guryanov [Mon, 10 Sep 2012 15:23:43 +0000 (19:23 +0400)]
parallels: fix parallelsDoCmdRun in case of command failure

Don't try to dereferece NULL pointer.

12 years agoBackcompt for console devices in virDomainDeviceInfoIterate
Li Zhang [Tue, 11 Sep 2012 02:57:28 +0000 (10:57 +0800)]
Backcompt for console devices in virDomainDeviceInfoIterate

Historically, the first <console> element is treated as the
alias of a <serial> device. In the virDomainDeviceInfoIterate,
This situation is not considered. It still handles the first <console>
element as another devices, which means that for console[0] with
serial targetType, it calls callback function another time.
It will cause the problem of address conflicts when assigning
spapr-vio address for serial device on pSeries guest.

For pSeries guest, the serial configuration in the xml file
is as the following:
         <serial type='pty'>
               <target port='0'/>
               <address type='spapr-vio'/>
          </serial>

Console configuration is default, the dumped xml file is as the following:
   <serial type='pty'>
      <source path='/dev/pts/5'/>
      <target port='0'/>
      <alias name='serial0'/>
      <address type='spapr-vio' reg='0x30000000'/>
    </serial>
    <console type='pty' tty='/dev/pts/5'>
      <source path='/dev/pts/5'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
      <address type='spapr-vio' reg='0x30000000'/>
    </console>

It shows that the <console> device is the alias of serial device.
So its address is the same as the serial device. When detecting
the conflicts in the qemuAssignSpaprVIOAddress the first console
and the serial device conflicts because virDomainDeviceInfoIterate()
still handle these as two different devices, and in the qemuAssignSpaprVIOAddress(),
it will compare these two devices' addressed. If they have same address,
it will report address conflict error.

So this patch is to handle the first console which targetType is serial
as the alias of serial device to avoid address conflicts error reported.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
12 years agolist: Expose virConnectListAllInterfaces to Python binding
Osier Yang [Tue, 4 Sep 2012 16:10:19 +0000 (00:10 +0800)]
list: Expose virConnectListAllInterfaces to Python binding

The implementation is done manually as the generator does not support
wrapping lists of C pointers into Python objects.

python/libvirt-override-api.xml: Document

python/libvirt-override-virConnect.py:
  * New file, includes implementation of listAllInterfaces.

python/libvirt-override.c: Implementation for the wrapper.

12 years agolist: Use virConnectListAllInterfaces in virsh
Osier Yang [Tue, 4 Sep 2012 16:10:18 +0000 (00:10 +0800)]
list: Use virConnectListAllInterfaces in virsh

tools/virsh-interface.c:
  * vshInterfaceSorter to sort interfaces by name

  * vshInterfaceListFree to free the interface objects list.

  * vshInterfaceListCollect to collect the interface objects, trying
    to use new API first, fall back to older APIs if it's not supported.

12 years agolist: Implement listAllInterfaces
Osier Yang [Tue, 4 Sep 2012 16:10:17 +0000 (00:10 +0800)]
list: Implement listAllInterfaces

This is not that ideal as API for other objects, as it's still
O(n). Because interface driver uses netcf APIs to manage the
stuffs, instead of by itself. And netcf APIs don't return a object.
It provides APIs like old libvirt APIs:

   ncf_number_of_interfaces
   ncf_list_interfaces
   ncf_lookup_by_name
   ......

Perhaps we should further improve netcf to let it provide an API
to return the object, but it could be a later patch. And anyway,
we will still benefit from the new API for the simplification,
and no race like the old APIs.

src/interface/netcf_driver.c: Implement listAllInterfaces

12 years agolist: Implemente RPC calls for virConnectListAllInterfaces
Osier Yang [Tue, 4 Sep 2012 16:10:16 +0000 (00:10 +0800)]
list: Implemente RPC calls for virConnectListAllInterfaces

The RPC generator doesn't support returning list of object yet, this patch
do the work manually.

  * daemon/remote.c:
    Implemente the server side handler remoteDispatchConnectListAllInterfaces.

  * src/remote/remote_driver.c:
    Add remote driver handler remoteConnectListAllInterfaces.

  * src/remote/remote_protocol.x:
    New RPC procedure REMOTE_PROC_CONNECT_LIST_ALL_INTERFACES and
    structs to represent the args and ret for it.

  * src/remote_protocol-structs: Likewise.

12 years agolist: Define new API virConnectListAllInterfaces
Osier Yang [Tue, 4 Sep 2012 16:10:15 +0000 (00:10 +0800)]
list: Define new API virConnectListAllInterfaces

This is to list the interface objects, supported filtering flags
are: active|inactive.

include/libvirt/libvirt.h.in: Declare enum virConnectListAllInterfaceFlags
                              and virConnectListAllInterfaces.
python/generator.py: Skip auto-generating
src/driver.h: (virDrvConnectListAllInterfaces)
src/libvirt.c: Implement the public API
src/libvirt_public.syms: Export the symbol to public

12 years agodocs: mention another iaas app built on libvirt
Eric Blake [Tue, 11 Sep 2012 21:28:32 +0000 (15:28 -0600)]
docs: mention another iaas app built on libvirt

Reported on the libvirt-users list.

* docs/apps.html.in: Add Eucalyptus.
Reported by Eric Choi.

12 years agofix bug in qemuSetupCgroupForEmulator
Hu Tao [Thu, 6 Sep 2012 10:13:52 +0000 (18:13 +0800)]
fix bug in qemuSetupCgroupForEmulator

Should not return 0 when failed to setup cgroup.

12 years agobuild: avoid dirty docs on fresh bootstrap
Eric Blake [Tue, 11 Sep 2012 21:26:10 +0000 (15:26 -0600)]
build: avoid dirty docs on fresh bootstrap

* HACKING: Regenerate.

12 years agopython: Initialize new_params in virDomainSetSchedulerParameters
Federico Simoncelli [Tue, 11 Sep 2012 14:41:49 +0000 (10:41 -0400)]
python: Initialize new_params in virDomainSetSchedulerParameters

The new_params variable must be initialized in case the
virDomainGetSchedulerParameters call fails and we hit the cleanup
section before actually allocating the new parameters.

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
12 years agodocs: page.xsl: fix FAQ link in subdirectories
Ján Tomko [Tue, 11 Sep 2012 14:43:34 +0000 (16:43 +0200)]
docs: page.xsl: fix FAQ link in subdirectories

Links to the FAQ didn't work on pages in subdirectories, like
devhelp/libvirt-virterror.html or internals/command.html, because
they have had href_base prepended to them.

12 years agodocs: hacking.html.in: fix table of contents
Ján Tomko [Tue, 11 Sep 2012 12:01:56 +0000 (14:01 +0200)]
docs: hacking.html.in: fix table of contents

Two sections didn't have a working link in the TOC.

12 years agoBuild: Fix typos which cause build failure
Osier Yang [Tue, 11 Sep 2012 12:11:48 +0000 (20:11 +0800)]
Build: Fix typos which cause build failure

Pushed under trivial rule.

12 years agoDon't invoke the auth callback if all credentials were in config file
Daniel P. Berrange [Mon, 10 Sep 2012 15:47:58 +0000 (16:47 +0100)]
Don't invoke the auth callback if all credentials were in config file

The remote driver first looks at the libvirt auth config file to
fill in any credentials. It then invokes the auth callback for
any remaining credentials. It was accidentally invoking the
auth callback even if there were not any more credentials
required.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoCall virResetLastError in all virConnectOpen* functions
Daniel P. Berrange [Mon, 10 Sep 2012 15:47:15 +0000 (16:47 +0100)]
Call virResetLastError in all virConnectOpen* functions

All public API functions must call virResetLastError to clear
out any previous error. The virConnectOpen* functions forgot
to do this.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoCheck against python None type when filling in auth parameters
Daniel P. Berrange [Mon, 10 Sep 2012 15:45:53 +0000 (16:45 +0100)]
Check against python None type when filling in auth parameters

When deciding whether to provide an auth function callback
in openAuth(), credcb was checked against NULL, when it
really needs to be checked against Py_None

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoPrint any exception that occurs in authentication callback
Daniel P. Berrange [Mon, 10 Sep 2012 15:44:40 +0000 (16:44 +0100)]
Print any exception that occurs in authentication callback

If an exception occurs in the python callback for openAuth()
the stack trace isn't seen by the apps, since this code is
called from libvirt context. To aid diagnostics, print the
error to stderr at least

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix crash passing an empty list to python openAuth() API
Daniel P. Berrange [Mon, 10 Sep 2012 15:00:05 +0000 (16:00 +0100)]
Fix crash passing an empty list to python openAuth() API

If passing a 'credtype' parameter which was an empty list
to the python openAuth() API, the 'credtype' field in
the virConnectAuth struct would not be initialized. This
lead to a crash when later trying to free that field.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agovirsh: Fix the typos
Osier Yang [Tue, 11 Sep 2012 10:48:19 +0000 (18:48 +0800)]
virsh: Fix the typos

* tools/virsh-network.c: s/MATCH/VSH_MATCH/

12 years agolist: Expose virConnectListAllNetworks to Python binding
Osier Yang [Tue, 4 Sep 2012 15:55:21 +0000 (23:55 +0800)]
list: Expose virConnectListAllNetworks to Python binding

The implementation is done manually as the generator does not support
wrapping lists of C pointers into Python objects.

python/libvirt-override-api.xml: Document

python/libvirt-override-virConnect.py: Implement listAllNetworks.

python/libvirt-override.c: Implementation for the wrapper.

12 years agolist: Use virConnectListAllNetworks in virsh
Osier Yang [Tue, 4 Sep 2012 15:55:20 +0000 (23:55 +0800)]
list: Use virConnectListAllNetworks in virsh

tools/virsh-network.c:
  * vshNetworkSorter to sort networks by name

  * vshNetworkListFree to free the network objects list.

  * vshNetworkListCollect to collect the network objects, trying
    to use new API first, fall back to older APIs if it's not supported.

  * New options --persistent, --transient, --autostart, --no-autostart,
    for net-list, and new field 'Persistent' for its output.

tools/virsh.pod:
  * Add documents for the new options.

12 years agolist: Implement listAllNetworks for test driver
Osier Yang [Tue, 4 Sep 2012 15:55:19 +0000 (23:55 +0800)]
list: Implement listAllNetworks for test driver

src/test/test_driver.c: Implement listAllNetworks.

12 years agolist: Implement listAllNetworks for network driver
Osier Yang [Tue, 4 Sep 2012 15:55:18 +0000 (23:55 +0800)]
list: Implement listAllNetworks for network driver

src/network/bridge_driver.c: Implement listAllNetworks.

12 years agolist: Add helpers to list network objects
Osier Yang [Tue, 4 Sep 2012 15:55:17 +0000 (23:55 +0800)]
list: Add helpers to list network objects

src/conf/network_conf.c: Add virNetworkMatch to filter the networks;
and virNetworkList to iterate over all the networks with the filter.

src/conf/network_conf.h: Declare virNetworkList and define the macros
for filters.

src/libvirt_private.syms: Export virNetworkList.

12 years agolist: Implement RPC calls for virConnectListAllNetworks
Osier Yang [Tue, 4 Sep 2012 15:55:16 +0000 (23:55 +0800)]
list: Implement RPC calls for virConnectListAllNetworks

The RPC generator doesn't support returning list of object, this patch
do the work manually.

* daemon/remote.c:
  Implemente the server side handler remoteDispatchConnectListAllNetworks.

* src/remote/remote_driver.c:
  Add remote driver handler remoteConnectListAllNetworks.

* src/remote/remote_protocol.x:
  New RPC procedure REMOTE_PROC_CONNECT_LIST_ALL_NETWORKS and
  structs to represent the args and ret for it.

* src/remote_protocol-structs: Likewise.

12 years agolist: Define new API virConnectListAllNetworks
Osier Yang [Tue, 4 Sep 2012 15:55:15 +0000 (23:55 +0800)]
list: Define new API virConnectListAllNetworks

This is to list the network objects, supported filtering flags
are: active|inactive, persistent|transient, autostart|no-autostart.

include/libvirt/libvirt.h.in: Declare enum virConnectListAllNetworkFlags
                              and virConnectListAllNetworks.
python/generator.py: Skip auto-generating
src/driver.h: (virDrvConnectListAllNetworks)
src/libvirt.c: Implement the public API
src/libvirt_public.syms: Export the symbol to public

12 years agoFix unwanted closing of libvirt client connection
Christophe Fergeau [Mon, 10 Sep 2012 10:17:07 +0000 (12:17 +0200)]
Fix unwanted closing of libvirt client connection

e5a1bee07 introduced a regression in Boxes: when Boxes is left idle
(it's still doing some libvirt calls in the background), the
libvirt connection gets closed after a few minutes. What happens is
that this code in virNetClientIOHandleOutput gets triggered:

if (!thecall)
    return -1; /* Shouldn't happen, but you never know... */

and after the changes in e5a1bee07, this causes the libvirt connection
to be closed.

Upon further investigation, what happens is that
virNetClientIOHandleOutput is called from gvir_event_handle_dispatch
in libvirt-glib, which is triggered because the client fd became
writable. However, between the times gvir_event_handle_dispatch
is called, and the time the client lock is grabbed and
virNetClientIOHandleOutput is called, another thread runs and
completes the current call. 'thecall' is then NULL when the first
thread gets to run virNetClientIOHandleOutput.

After describing this situation on IRC, danpb suggested this:

11:37 < danpb> In that case I think the correct thing would be to change
               'return -1' above to 'return 0' since that's not actually an
               error - its a rare, but expected event

which is what this patch is doing. I've tested it against master
libvirt, and I didn't get disconnected in ~10 minutes while this
happens in less than 5 minutes without this patch.

12 years agolist: Expose virStoragePoolListAllVolumes to Python binding
Osier Yang [Tue, 4 Sep 2012 15:32:58 +0000 (23:32 +0800)]
list: Expose virStoragePoolListAllVolumes to Python binding

The implementation is done manually as the generator does not support
wrapping lists of C pointers into Python objects.

python/libvirt-override-api.xml: Document

python/libvirt-override-virStoragePool.py:
  * New file, includes implementation of listAllVolumes.

python/libvirt-override.c: Implementation for the wrapper.

12 years agolist: Use virStoragePoolListAllVolumes in virsh
Osier Yang [Tue, 4 Sep 2012 15:32:57 +0000 (23:32 +0800)]
list: Use virStoragePoolListAllVolumes in virsh

tools/virsh-volume.c:
  * vshStorageVolSorter to sort storage vols by name

  * vshStorageVolumeListFree to free the volume objects list

  * vshStorageVolumeListCollect to collect the volume objects, trying
    to use new API first, fall back to older APIs if it's not supported.

12 years agolist: Implement virStoragePoolListAllVolumes for test driver
Osier Yang [Tue, 4 Sep 2012 15:32:56 +0000 (23:32 +0800)]
list: Implement virStoragePoolListAllVolumes for test driver

src/test/test_driver.c: Implement poolListAllVolumes.

12 years agolist: Implement virStoragePoolListAllVolumes for storage driver
Osier Yang [Tue, 4 Sep 2012 15:32:55 +0000 (23:32 +0800)]
list: Implement virStoragePoolListAllVolumes for storage driver

src/storage/storage_driver.c: Implement poolListAllVolumes.

12 years agolist: Implement RPC calls for virStoragePoolListAllVolumes
Osier Yang [Tue, 4 Sep 2012 15:32:54 +0000 (23:32 +0800)]
list: Implement RPC calls for virStoragePoolListAllVolumes

The RPC generator doesn't returning support list of object, this
patch do the work manually.

  * daemon/remote.c:
    Implemente the server side handler remoteDispatchStoragePoolListAllVolumes

  * src/remote/remote_driver.c:
    Add remote driver handler remoteStoragePoolListAllVolumes

  * src/remote/remote_protocol.x:
    New RPC procedure REMOTE_PROC_STORAGE_POOL_LIST_ALL_VOLUMES and
    structs to represent the args and ret for it.

  * src/remote_protocol-structs: Likewise.

12 years agolist: Define new API virStoragePoolListAllVolumes
Osier Yang [Tue, 4 Sep 2012 15:32:53 +0000 (23:32 +0800)]
list: Define new API virStoragePoolListAllVolumes

Simply returns the storage volume objects. No supported filter
flags.

include/libvirt/libvirt.h.in: Declare the API
python/generator.py: Skip the function for generating. virStoragePool.py
                     will be added in later patch.
src/driver.h: virDrvStoragePoolListVolumesFlags
src/libvirt.c: Implementation for the API.
src/libvirt_public.syms: Export the symbol to public

12 years agoesx: Remove unused variable from esxDomainGetAutostart
Matthias Bolte [Sun, 9 Sep 2012 10:44:20 +0000 (12:44 +0200)]
esx: Remove unused variable from esxDomainGetAutostart

12 years agodocs: point out git send-email location, be more stern about make check
Laine Stump [Thu, 6 Sep 2012 17:21:21 +0000 (13:21 -0400)]
docs: point out git send-email location, be more stern about make check

An email came to libvir-list wondering why the git send-email command
was missing in spite of having git installed; this is due to the
send-email command being in a sub-package of the main git package.

While touching the hacking file, I thought it would be useful to 1)
indicate the location of the source (docs/hacking.html.in) in the
message at the top of HACKING, and also to make the note about running
"make check" and "make syntax-check" a bit more stern.

12 years agobuild: fix build on older gcc
Eric Blake [Fri, 7 Sep 2012 17:42:10 +0000 (11:42 -0600)]
build: fix build on older gcc

On RHEL 6.2, gcc 4.4.6 complains:
cc1: warning: command line option "-Wenum-compare" is valid for C++/ObjC++ but not for C
which in turn breaks a -Werror build.

Meanwhile, in Fedora 17, gcc 4.7.0, -Wenum-compare has been enhanced
to also work on C, but at the same time, it is documented that -Wall
now implicitly includes -Wenum-compare.

Therefore, it is sufficient to remove explicit checks for this option,
avoiding the warning from older gcc while still getting the
compile-time safety from newer gcc.

* m4/virt-compile-warnings.m4 (-Wenum-compare): Omit explicit check.

12 years agoFix RPM spec conditional when %{rhel} is not defined
Daniel P. Berrange [Fri, 7 Sep 2012 15:45:50 +0000 (16:45 +0100)]
Fix RPM spec conditional when %{rhel} is not defined

12 years agoevents: Fix domain event race on client disconnect
Christophe Fergeau [Thu, 6 Sep 2012 06:16:46 +0000 (08:16 +0200)]
events: Fix domain event race on client disconnect

GNOME Boxes sometimes stops getting domain events from libvirtd, even
after restarting it. Further investigation in libvirtd shows that
events are properly queued with virDomainEventStateQueue, but the
timer virDomainEventTimer which flushes the events and sends them to
the clients never gets called. Looking at the event queue in gdb
shows that it's non-empty and that its size increases with each new
events.

virDomainEventTimer is set up in virDomainEventStateRegister[ID]
when going from 0 client connecte to 1 client connected, but is
initially disabled. The timer is removed in
virDomainEventStateRegister[ID] when the last client is disconnected
(going from 1 client connected to 0).

This timer (which handles sending the events to the clients) is
enabled in virDomainEventStateQueue when queueing an event on an
empty queue (queue containing 0 events). It's disabled in
virDomainEventStateFlush after flushing the queue (ie removing all
the elements from it). This way, no extra work is done when the queue
is empty, and when the next event comes up, the timer will get
reenabled because the queue will go from 0 event to 1 event, which
triggers enabling the timer.

However, with this Boxes bug, we have a client connected (Boxes), a
non-empty queue (there are events waiting to be sent), but a disabled
timer, so something went wrong.

When Boxes connects (it's the only client connecting to the libvirtd
instance I used for debugging), the event timer is not set as expected
(state->timer == -1 when virDomainEventStateRegisterID is called),
but at the same time the event queue is not empty. In other words,
we had no clients connected, but pending events. This also explains
why the timer never gets enabled as this is only done when an event
is queued on an empty queue.

I think this can happen if an event gets queued using
virDomainEventStateQueue and the client disconnection happens before
the event timer virDomainEventTimer gets a chance to run and flush
the event. In this situation, virDomainEventStateDeregister[ID] will
get called with a non-empty event queue, the timer will be destroyed
if this was the only client connected. Then, when other clients connect
at a later time, they will never get notified about domain events as
the event timer will never get enabled because the timer is only
enabled if the event queue is empty when virDomainEventStateRegister[ID]
gets called, which will is no longer the case.

To avoid this issue, this commit makes sure to remove all events from
the event queue when the last client in unregistered. As there is
no longer anyone interested in receiving these events, these events
are stale so there is no need to keep them around. A client connecting
later will have no interest in getting events that happened before it
got connected.

12 years agoFix location of SELinux mount during RPM builds
Daniel P. Berrange [Thu, 6 Sep 2012 14:22:27 +0000 (15:22 +0100)]
Fix location of SELinux mount during RPM builds

When building RPMs the host kernel cannot be assumed to match
the target OS kernel. Thus auto-detecting /selinux vs
/sys/fs/selinux based on the host kernel can result in the
wrong choice (eg F18 builds on a RHEL6 host kernel)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDon't assume use of /sys/fs/cgroup
Daniel P. Berrange [Thu, 6 Sep 2012 14:19:32 +0000 (15:19 +0100)]
Don't assume use of /sys/fs/cgroup

The introduction of /sys/fs/cgroup came in fairly recent kernels.
Prior to that time distros would pick a custom directory like
/cgroup or /dev/cgroup. We need to auto-detect where this is,
rather than hardcoding it

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoIntroduce a test suite for the JSON monitor
Daniel P. Berrange [Mon, 20 Aug 2012 12:31:29 +0000 (13:31 +0100)]
Introduce a test suite for the JSON monitor

Take advantage of the previously added monitor helpers to
create a test suite for the QEMU JSON monitor impl. As a
proof of concept, this tests the 'qemuMonitorGetStatus'
implementation

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd helper library for testing the qemu monitor code
Daniel P. Berrange [Mon, 20 Aug 2012 13:06:21 +0000 (14:06 +0100)]
Add helper library for testing the qemu monitor code

To be able to test the QEMU monitor code, we need to have a fake
QEMU monitor server. This introduces a simple (dumb) framework
that can do this. The test case registers a series of items to
be sent back as replies to commands that will be executed. A
thread runs the event loop looking for incoming replies and
sending back this pre-registered data. This allows testing all
QEMU monitor code that deals with parsing responses and errors
from QEMU, without needing QEMU around

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd non-null annotations to qemuMonitorOpen
Daniel P. Berrange [Mon, 20 Aug 2012 12:39:47 +0000 (13:39 +0100)]
Add non-null annotations to qemuMonitorOpen

Add some non-null annotations to qemuMonitorOpen and also
check that the error callback is set, since it is mandatory

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoexamples: Fix event detail printing in python test
Jiri Denemark [Thu, 6 Sep 2012 15:02:47 +0000 (17:02 +0200)]
examples: Fix event detail printing in python test

If there is only one detail string for a particular event, we need to pu
comma after the string otherwise the string itself will be taken as a
list and only its first character will be printed out. For example,

    myDomainEventCallback1 EVENT: Domain fedora17(12) Shutdown F

instead of the desired

    myDomainEventCallback1 EVENT: Domain fedora17(12) Shutdown Finished

12 years agoAdd PMSUSPENDED life cycle event
Jiri Denemark [Thu, 6 Sep 2012 15:00:43 +0000 (17:00 +0200)]
Add PMSUSPENDED life cycle event

While PMSUSPENDED state was added a long time ago, we didn't have
corresponding life cycle event.

12 years agoFix PMSuspend and PMWakeup events
Jiri Denemark [Thu, 6 Sep 2012 14:56:08 +0000 (16:56 +0200)]
Fix PMSuspend and PMWakeup events

The unused reason parameter of PM{Suspend,Wakeup} event callbacks was
completely ignored in lot of places and those events were not actually
working at all.

12 years agovirsh: Update only changed scheduler tunables
Peter Krempa [Wed, 5 Sep 2012 12:41:25 +0000 (14:41 +0200)]
virsh: Update only changed scheduler tunables

When setting the cpu tunables in virsh you are able to update only a
subset of them. Virsh while doing the update updated all of the
tunables, changed ones with new values and unchanged with old ones.
This is unfortunate as it:
a) might overwrite some other change by a race condition (unprobable)
b) fails with range checking as some of the old values saved might be
   out of range

This patch changes the update procedure so that only the changed value
is updated on the host.

This patch also fixes a very unprobable memory leak if the daemon would
return a string tunable parameter, as the typed parameter array was not
cleared.

12 years agoutil: Add helper to assign typed params from string
Peter Krempa [Thu, 6 Sep 2012 12:47:40 +0000 (14:47 +0200)]
util: Add helper to assign typed params from string

This patch adds a helper to deal with assigning values to
virTypedParameter structures from strings. The helper parses the value
from the string and assigns it to the corresponding union value.

12 years agoqemu: Add range checking for scheduler tunables when changed by API
Peter Krempa [Tue, 4 Sep 2012 13:17:07 +0000 (15:17 +0200)]
qemu: Add range checking for scheduler tunables when changed by API

The quota and period tunables for cpu scheduler accept only a certain
range of values. When changing the live configuration invalid values get
rejected. This check is not performed when changing persistent config.

This patch adds a separate range check, that improves error messages
when changing live config and adds the check for persistent config.
This check is done only when using the API. It is still possible to
specify invalid values in the XML.

12 years agoqemu: clean up qemuSetSchedulerParametersFlags()
Peter Krempa [Tue, 4 Sep 2012 12:26:38 +0000 (14:26 +0200)]
qemu: clean up qemuSetSchedulerParametersFlags()

This patch tries to clean the code up a little bit and shorten very long
lines.

The apparent semantic change from moving the condition before calling
the setter function is a non-issue here as the setter function is a
no-op when called with both arguments zero.

12 years agovirsh: Improve the document for pool-list
Osier Yang [Thu, 6 Sep 2012 16:01:24 +0000 (00:01 +0800)]
virsh: Improve the document for pool-list

Which is lost by commit 93a346d353.

12 years agonwfilter: drop use of awk
Eric Blake [Fri, 31 Aug 2012 22:54:48 +0000 (15:54 -0700)]
nwfilter: drop use of awk

Commit 2a41bc9 dropped a dependency on gawk, but we can go one step
further and avoid awk altogether.

* src/nwfilter/nwfilter_ebiptables_driver.c
(iptablesLinkIPTablesBaseChain): Simplify command.
(ebiptablesDriverInit, ebiptablesDriverShutdown): Drop awk probe.

12 years agoremove dnsmasq command line parameter "--filterwin2k"
Gene Czarcinski [Thu, 6 Sep 2012 16:08:22 +0000 (12:08 -0400)]
remove dnsmasq command line parameter "--filterwin2k"

This patch removed the "--filterwin2k" dnsmasq command line
parameter which was unnecessary for domain specification,
possibly blocked some usage, and was command line clutter.

Gene Czarcinski <gene@czarc.net>

12 years agobuild: improved handling of <execinfo.h>, BSD <net/if.h>
Eric Blake [Wed, 5 Sep 2012 22:27:42 +0000 (16:27 -0600)]
build: improved handling of <execinfo.h>, BSD <net/if.h>

FreeBSD and OpenBSD have a <net/if.h> that is not self-contained;
and mingw lacks the header altogether.  But gnulib has just taken
care of that for us, so we might as well simplify our code.  In
the process, I got a syntax-check failure if we don't also take
the gnulib execinfo module.

* .gnulib: Update to latest, for execinfo and net_if.
* bootstrap.conf (gnulib_modules): Add execinfo and net_if modules.
* configure.ac: Let gnulib check for headers.  Simplify check for
'struct ifreq', while also including enough prereq headers.
* src/internal.h (IF_NAMESIZE): Drop, now that gnulib guarantees it.
* src/nwfilter/nwfilter_learnipaddr.h: Use correct header for
IF_NAMESIZE.
* src/util/virnetdev.c (includes): Assume <net/if.h> exists.
* src/util/virnetdevbridge.c (includes): Likewise.
* src/util/virnetdevtap.c (includes): Likewise.
* src/util/logging.c (includes): Assume <execinfo.h> exists.
(virLogStackTraceToFd): Handle gnulib's fallback implementation.

12 years agobuild: avoid tabs that failed syntax-check
Eric Blake [Thu, 6 Sep 2012 15:42:35 +0000 (09:42 -0600)]
build: avoid tabs that failed syntax-check

Introduced in commit f299ddd6.

* src/check-symfile.pl: Fix whitespace.
* .dir-locals.el (perl-mode): Prevent future occurrences.

12 years agolist: fix typo in virsh patch
Eric Blake [Thu, 6 Sep 2012 15:35:00 +0000 (09:35 -0600)]
list: fix typo in virsh patch

A last minute rename in commit fc122e1a to virsh.h was not properly
reflected when rebasing virsh-pool.c in commit 93a346d.

* tools/virsh-pool.c (vshStoragePoolListCollect): Use VSH_MATCH,
not MATCH.

12 years agoRemove duplicate symbols and add test case
Daniel P. Berrange [Thu, 6 Sep 2012 14:45:57 +0000 (15:45 +0100)]
Remove duplicate symbols and add test case

When the event symbols were added to the public API, not all
of them were removed from the private exports list. Solaris
gets unhappy when there are duplicated symbols. Extend the
symfile check to test for this scenario

12 years agopython: Expose virStorageListAllStoragePools to python binding
Osier Yang [Tue, 4 Sep 2012 15:16:33 +0000 (23:16 +0800)]
python: Expose virStorageListAllStoragePools to python binding

The implementation is done manually as the generator does not support
wrapping lists of C pointers into Python objects.

python/libvirt-override-api.xml: Document
python/libvirt-override-virConnect.py: Add listAllStoragePools
python/libvirt-override.c: Implementation for the wrapper.

12 years agolist: Use virConnectListAllStoragePools in virsh
Osier Yang [Wed, 5 Sep 2012 06:36:33 +0000 (14:36 +0800)]
list: Use virConnectListAllStoragePools in virsh

tools/virsh-pool.c:
  * vshStoragePoolSorter to sort the pool list by pool name.

  * struct vshStoragePoolList to present the pool list, pool info
    is collected by list->poolinfo if 'details' is specified by
    user.

  * vshStoragePoolListFree to free the pool list

  * vshStoragePoolListCollect to collect the pool list, new API
    virStorageListAllPools is tried first, if it's not supported,
    fall back to older APIs.

  * New options --persistent, --transient, --autostart, --no-autostart
    and --type for pool-list. --persistent or --transient is to filter
    the returned pool list by whether the pool is persistent or not.
    --autostart or --no-autostart is to filter the returned pool list
    by whether the pool is autostarting or not. --type is to filter
    the pools by pool types. E.g.

    % virsh pool-list --all --persistent --type dir,disk

tools/virsh.pod:
   * Add documentations for the new options.

12 years agolist: Change MATCH for common use in virsh
Osier Yang [Tue, 4 Sep 2012 15:16:31 +0000 (23:16 +0800)]
list: Change MATCH for common use in virsh

Move definition of MATCH from virsh-domain-monitor.c into
virsh.h, and rename it as VSH_MATCH for further use.

* tools/virsh-domain-monitor.c: Change MATCH into VSH_MATCH
* tools/virsh.h: Define VSH_MATCH

12 years agovirsh: Fix the wrong doc for pool-list
Osier Yang [Tue, 4 Sep 2012 15:16:30 +0000 (23:16 +0800)]
virsh: Fix the wrong doc for pool-list

The storage pool's management doesn't relate with a domain, it
probably was an intention, but not achieved yet. And the fact
is only active pools are listed by default.

12 years agolist: Add helper to convert strings separated by ', ' to array
Osier Yang [Tue, 4 Sep 2012 15:16:29 +0000 (23:16 +0800)]
list: Add helper to convert strings separated by ', ' to array

tools/virsh.c: New helper function vshStringToArray.
tools/virsh.h: Declare vshStringToArray.
tools/virsh-domain.c: use the helper in cmdUndefine.

12 years agolist: Implement listAllStoragePools for test driver
Osier Yang [Tue, 4 Sep 2012 15:16:28 +0000 (23:16 +0800)]
list: Implement listAllStoragePools for test driver

src/test/test_driver.c: Implement listAllStoragePools

12 years agolist: Implement listAllStoragePools for storage driver
Osier Yang [Tue, 4 Sep 2012 15:16:27 +0000 (23:16 +0800)]
list: Implement listAllStoragePools for storage driver

src/storage/storage_driver.c: Implement listAllStoragePools.

12 years agolist: Implement the RPC calls for virConnectListAllStoragePools
Osier Yang [Tue, 4 Sep 2012 15:16:26 +0000 (23:16 +0800)]
list: Implement the RPC calls for virConnectListAllStoragePools

The RPC generator doesn't support returning list of object, this patch does
the work manually.

  * daemon/remote.c:
    Implement the server side handler remoteDispatchConnectListAllStoragePools

  * src/remote/remote_driver.c:
    Add remote driver handler remoteConnectListAllStoragePools.

  * src/remote/remote_protocol.x:
    New RPC procedure REMOTE_PROC_CONNECT_LIST_ALL_STORAGE_POOLS and
    structs to represent the args and ret for it.

  * src/remote_protocol-structs: Likewise.

12 years agolist: Add helpers for listing storage pool objects
Osier Yang [Tue, 4 Sep 2012 15:16:25 +0000 (23:16 +0800)]
list: Add helpers for listing storage pool objects

src/conf/storage_conf.c: Add virStoragePoolMatch to filter the
pools; Add virStoragePoolList to iterate over the pool objects
with filter.

src/conf/storage_conf.h: Declare virStoragePoolMatch,
virStoragePoolList, and the macros for filters.

src/libvirt_private.syms: Export helper virStoragePoolList.

12 years agolist: Define new API virStorageListAllStoragePools
Osier Yang [Tue, 4 Sep 2012 15:16:24 +0000 (23:16 +0800)]
list: Define new API virStorageListAllStoragePools

This introduces a new API to list the storage pool objects,
4 groups of flags are provided to filter the returned pools:

  * Active or not

  * Autostarting or not

  * Persistent or not

  * And the pool type.

include/libvirt/libvirt.h.in: New enum virConnectListAllStoragePoolFlags;
                              Declare the API.
python/generator.py: Skip the generating
src/driver.h: (virDrvConnectListAllStoragePools)
src/libvirt.c: Implementation for the API.
src/libvirt_public.syms: Export the symbol.

12 years agoesx: Add implementation for virConnectListAllDomains()
Peter Krempa [Tue, 5 Jun 2012 12:24:40 +0000 (14:24 +0200)]
esx: Add implementation for virConnectListAllDomains()

ESX doesn't use the common virDomainObj implementation so this patch
adds a separate implementation.

This driver supports all currently defined filtering flags, but as with
other drivers some combinations yield a empty result list.

12 years agohyperv: Add implementation for virConnectListAllDomains()
Peter Krempa [Tue, 5 Jun 2012 12:20:58 +0000 (14:20 +0200)]
hyperv: Add implementation for virConnectListAllDomains()

Hyperv doesn't use the common virDomainObj implementation so this patch
adds a separate implementation.

This driver supports all currently added flags for filtering although
some of those don't make sense with this driver (no support yet) and
thus produce no output when used.

12 years agoDefine DYNLIB_NAME on OpenBSD.
Jasper Lievisse Adriaanse [Tue, 4 Sep 2012 14:48:51 +0000 (16:48 +0200)]
Define DYNLIB_NAME on OpenBSD.

12 years agobuild: avoid test failure when sasl was not compiled in
Eric Blake [Wed, 5 Sep 2012 21:02:01 +0000 (15:02 -0600)]
build: avoid test failure when sasl was not compiled in

On systems without cyrus-sasl-devel available (I happened to be
in that situation on my FreeBSD testing), this test fails rather
miserably:

TEST: libvirtdconftest
      .....!!!!!!...!!!!!!!!!!!!!!!!!!!!!!!!!  39  FAIL
FAIL: libvirtdconftest

with verbose output showing things like:

39) Test corruption                                          ... libvir: Config File error : unsupporeted configuration: remoteReadConfigFile: /usr/home/dummy/libvirt/tests/../daemon/libvirtd.conf: auth_tcp: unsupported auth sasl

* tests/libvirtdconftest.c (testCorrupt): Avoid failure when sasl
is missing.

12 years agobuild: avoid check-symfile on non-Linux
Eric Blake [Wed, 5 Sep 2012 19:10:18 +0000 (13:10 -0600)]
build: avoid check-symfile on non-Linux

I tested both OpenBSD and cygwin; both failed 'make check' with:

  GEN    check-symfile
Can't return outside a subroutine at ./check-symfile.pl line 13.

Perl requires 'exit 77' instead of 'return 77' in that context,
but even with that tweak, the build still fails, since the exit
code of 77 is only special to explicit TESTS=foo listings, and
not to make-only dependency rules where we are not going through
automake's test framework.

* src/check-symfile.pl: Kill bogus platform check...
* src/Makefile.am (check-symfile): ...and replace with an automake
conditional.

12 years agonetwork: prevent infinite hang if ovs-vswitchd isn't running
Laine Stump [Tue, 4 Sep 2012 19:26:29 +0000 (15:26 -0400)]
network: prevent infinite hang if ovs-vswitchd isn't running

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=852984

If a network or interface is configured to use Open vSwitch, but
ovs-vswitchd (the Open vSwitch database service) isn't running, the
ovs-vsctl add-port/del-port commands will hang indefinitely rather
than returning an error. There is a --nowait option, but that appears
to have no effect on add-port and del-port commands, so instead we add
a --timeout=5 to the commands - they will retry for up to 5 seconds,
then fail if there is no response.

12 years agobuild: require netcf-0.2.2 when installing on Fedora18+
Laine Stump [Tue, 4 Sep 2012 17:05:54 +0000 (13:05 -0400)]
build: require netcf-0.2.2 when installing on Fedora18+

A previous patch forced libnl-3 and netcf-0.2.2 (which itself requires
libnl-3) when *building* for Fedora 18+ (and RHEL 7+), but the
install-time Requires: for netcf has always been implicit due to
libvirtd linking with libnetcf.so. However, the since the API of netcf
didn't change when it was rebuilt to use libnl-3, the internal library
version didn't change either, making it possible (from rpm's point of
view) to upgrade libvirt without upgrading netcf (in reality, that
leads to a segfault - see
https://bugzilla.redhat.com/show_bug.cgi?id=853381).

The solution is to put an explicit Requires: line in libvirt's
specfile for fedora >= 18 and rhel >= 7.

12 years agobuild: don't fail when xsltproc is missing
Eric Blake [Wed, 5 Sep 2012 17:55:42 +0000 (11:55 -0600)]
build: don't fail when xsltproc is missing

On a machine without xsltproc, the build failed with:

Scripting search.php
/usr/local/bin/bash: line 1: search.php.tmp: No such file or directory
rm: ./search.php: No such file or directory

Regression introduced in commit 28183590.

* docs/Makefile.am (%.php): Skip in the same conditions when the
.tmp file is skipped.

12 years agobuild: avoid warnings from gcc 4.2.1
Eric Blake [Wed, 5 Sep 2012 17:40:31 +0000 (11:40 -0600)]
build: avoid warnings from gcc 4.2.1

OpenBSD ships with gcc 4.2.1, which annoyingly treats all format
strings as though they were also attribute((nonnull)).  The two
concepts are orthogonal, though, as evidenced by the number of
spurious warnings it generates on uses where we know that
virReportError specifically handles NULL instead of a format
string; worse, since we now force -Werror on git builds, it
prevents development builds on OpenBSD.

I hate to do this, as it disables ALL format checking on older
gcc, and therefore misses out on some useful checks (code that
happened to compile on Linux may still have type mismatches
when compiled on other platforms, as evidenced by the number
of times I have fixed formatting mismatches for uid_t as found
by warnings on Cygwin), but I don't see any other way to keep
-Werror alive and still compile on OpenBSD.

A more invasive change would be to make virReportError() mark
its format attribute as nonnull, and fix (a lot of) fallout;
we may end up doing that anyways as part of danpb's error
refactoring improvements, but not today.

* src/internal.h (ATTRIBUTE_FMT_PRINTF): Use preferred spellings.
* m4/virt-compile-warnings.m4 (-Wformat): Disable on older gcc.

12 years agoqemu: don't pin all the cpus
Martin Kletzander [Tue, 4 Sep 2012 13:26:46 +0000 (15:26 +0200)]
qemu: don't pin all the cpus

This is another fix for the emulator-pin series. When going through
the cputune pinning settings, the current code is trying to pin all
the CPUs, even when not all of them are specified. This causes error
in the subsequent function which, of course, cannot find the cpu to
pin. Since it's enough to pass the correct VCPU ID to the function,
the fix is trivial.

12 years agomaint: avoid doubled name in syntax check failures
Eric Blake [Tue, 4 Sep 2012 23:40:04 +0000 (17:40 -0600)]
maint: avoid doubled name in syntax check failures

Based on the similar gnulib commit 96ad9077.  The use of
$(_sc_search_regexp) already injects $(ME) into any output
messages, so a failure of these rules would look like this,
pre-patch:

maint.mk: maint.mk: use virStrToLong_*, not strtol variants

* cfg.mk (sc_prohibit_strncmp, sc_prohibit_strtol)
(sc_libvirt_unmarked_diagnostics): Drop redundant $(ME).

12 years agobuild: use re-entrant functions in virsh
Eric Blake [Tue, 4 Sep 2012 23:35:27 +0000 (17:35 -0600)]
build: use re-entrant functions in virsh

Yesterday's commit 15d2c9f pointed out that virsh was still using
localtime(), which is not thread-safe, even though virsh is
definitely multi-threaded.  Even if we only ever triggered it from
one thread, it's better safe than sorry for maintenance purposes.

* cfg.mk (exclude_file_name_regexp--sc_prohibit_nonreentrant):
Tighten the rule.
* tools/virsh.c (vshOutputLogFile): Avoid localtime.
(vshEditWriteToTempFile, vshEditReadBackFile, cmdCd, cmdPwd)
(vshCloseLogFile): Avoid strerror.
* tools/console.c (vshMakeStdinRaw): Likewise.
* tools/virsh-domain.c (vshGenFileName): Fix spacing in previous
patch.

12 years agoRemove explicit dependency on ceph RPM
Daniel P. Berrange [Wed, 5 Sep 2012 07:58:50 +0000 (08:58 +0100)]
Remove explicit dependency on ceph RPM

The libvirt storage driver uses librbd.so for its functionality.
RPM will automatically add a dependency on the library, so there
is no need to have an explicit dependency on the ceph RPM itself.
This allows newer Fedora distros to avoid pulling in the huge
ceph RPM, in favour of just having the libraries installed

12 years agoqemu: Do not require auth scheme in graphics events
Jiri Denemark [Tue, 4 Sep 2012 14:52:47 +0000 (16:52 +0200)]
qemu: Do not require auth scheme in graphics events

Only VNC_{{DIS,}CONNECTED,INITIALIZED} and SPICE_INITIALIZED events are
documented to support server/auth field and even there it is marked as
optional. Emit "" auth scheme in case QEMU didn't send it.

12 years agoconf: describe security_driver behavior
Martin Kletzander [Tue, 4 Sep 2012 14:09:43 +0000 (16:09 +0200)]
conf: describe security_driver behavior

As a request was raised for this, I added few lines in the "Notes"
part of the "security_driver" comments about allowed values.

12 years agodocs: correct dompmwakeup description
Martin Kletzander [Tue, 4 Sep 2012 10:01:41 +0000 (12:01 +0200)]
docs: correct dompmwakeup description

12 years agoPass a correct pointer type to localtime_r(3).
Paul Eggert [Tue, 4 Sep 2012 17:03:41 +0000 (10:03 -0700)]
Pass a correct pointer type to localtime_r(3).

On 09/04/2012 08:20 AM, Eric Blake wrote:
> tv_sec is required by POSIX to be
> of type time_t; so this is a bug in the OpenBSD header
> [for declaring it as long]

Most likely this problem arose because of the patch I pushed
in gnulib commit e07d7c40f3ca5ec410cf5aa6fa03cfe51e712039.
Previously, gnulib required timeval's tv_sec to be
the same size as time_t.  But now, it requires only that
tv_sec be big enough to hold a time_t.

This patch was needed for Emacs.  Without the patch, gnulib
replaced struct timeval on OpenBSD, and this messed up
utimens.c, and Emacs wouldn't build.

Alternatively, gnulib could substitute its own struct timeval
for the system's, wrapping every struct timeval-using function
(gettimeofday, futimesat, futimes, lutimes, etc.  That'd be
more work, though.  And it would introduce some performance
issues with gettimeofday, which is supposed to be fast.

I've been trying to get away from using struct timeval,
and to use the higher-resolution struct timespec instead,
so messing with these obsolescent interfaces has been
lower priority for me.  But if someone wants to take the
more-ambitious approach that'd be fine, I expect.

For this particular case, though, how about if we avoid
the problem entirely?  libvirt doesn't need to use struct
timeval here at all.  It makes libvirt smaller and probably
faster, and it ports to OpenBSD without messing with gnulib.

12 years agobuild: use correct libraries for clock_gettime
Eric Blake [Tue, 4 Sep 2012 16:57:25 +0000 (10:57 -0600)]
build: use correct libraries for clock_gettime

On OpenBSD, clock_gettime() exists in libc rather than librt, and
blindly linking with -lrt made the build fail.  Gnulib already
did the work for determining which libraries to use, so we should
reuse that work rather than doing it ourselves.

* bootstrap.conf (gnulib_modules): Pull in clock-time.
* configure.ac (RT_LIBS): Drop.
* src/Makefile.am (libvirt_util_la_LIBADD): Use gnulib variable
instead.
* src/util/virtime.c (includes): Simplify.

12 years agoInclude an extra header needed for OpenBSD.
Jasper Lievisse Adriaanse [Tue, 4 Sep 2012 14:57:09 +0000 (16:57 +0200)]
Include an extra header needed for OpenBSD.

12 years agoRename iolimit to blockio.
Viktor Mihajlovski [Tue, 4 Sep 2012 14:30:55 +0000 (16:30 +0200)]
Rename iolimit to blockio.

After discussion with DB we decided to rename the new iolimit
element as it creates the impression it would be there to
limit (i.e. throttle) I/O instead of specifying immutable
characteristics of a block device.
This is also backed by the fact that the term I/O Limits has
vanished from newer storage admin documentation.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoqemu: Fix reboot with guest agent
Jiri Denemark [Tue, 4 Sep 2012 10:01:43 +0000 (12:01 +0200)]
qemu: Fix reboot with guest agent

When reboot using qemu guest agent was requested, qemu driver kept
waiting for SHUTDOWN event from qemu. However, such event is never
emitted during guest reboot and qemu driver would keep waiting forever.

12 years agoFix mingw64 build by using intptr_t for int->void* casts
Daniel P. Berrange [Tue, 4 Sep 2012 10:16:55 +0000 (11:16 +0100)]
Fix mingw64 build by using intptr_t for int->void* casts

The viratomictest.c was casting from an int to a void* via a
long. This works on Linux or Mingw32, but fails on Mingw64
due to a pointer/integer size mis-match. Replacing 'long'
with 'intptr_t' ensures matching type sizes

12 years agoqemu: Don't update graphic definitions on password change failure
Peter Krempa [Mon, 3 Sep 2012 14:52:27 +0000 (16:52 +0200)]
qemu: Don't update graphic definitions on password change failure

When the password change failed we updated the graphic definition
anyways, which is not desired.

12 years agotests: Add tests for qemu S3/S4 state configuration
Martin Kletzander [Thu, 2 Aug 2012 10:18:16 +0000 (12:18 +0200)]
tests: Add tests for qemu S3/S4 state configuration

Few tests were added which are checking whether the parsing of the xml
and command-line arguments is working and compatible with each other.

12 years agoqemu: Add support for S3/S4 state configuration
Martin Kletzander [Thu, 2 Aug 2012 10:14:39 +0000 (12:14 +0200)]
qemu: Add support for S3/S4 state configuration

This patch adds support for running qemu guests with the required
parameters to forcefully enable or disable BIOS advertising of S3 and
S4 states.  The support for this is added to capabilities and there is
also a qemu command parameter parsing implemented.

12 years agoAdd per-guest S3/S4 state configuration
Martin Kletzander [Thu, 2 Aug 2012 10:12:50 +0000 (12:12 +0200)]
Add per-guest S3/S4 state configuration

There is a new <pm/> element implemented that can control what ACPI
sleeping states will be advertised by BIOS and allowed to be switched
to by libvirt. The default keeps defaults on hypervisor, otherwise
forces chosen setting.
The documentation of the pm element is added as well.