]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
13 years agoDon't kill QEMU process when a monitor I/O parsing error occurs
Daniel P. Berrange [Sun, 29 May 2011 12:37:29 +0000 (20:37 +0800)]
Don't kill QEMU process when a monitor I/O parsing error occurs

Currently whenever there is any failure with parsing the monitor,
this is treated in the same was as end-of-file (ie QEMU quit).
The domain is terminated, if not already dead.

With this change, failures in parsing the monitor stream do not
result in the death of QEMU. The guest continues running unchanged,
but all further use of the monitor will be disabled.

The VMM_FAILURE event will be emitted, and the mgmt application
can decide when to kill/restart the guest to re-gain control

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Run a
  different callback for monitor EOF vs error conditions.
* src/qemu/qemu_process.c: Emit VMM_FAILURE event when monitor
  fails

13 years agoIntroduce a new event emitted when a virtualization failure occurs
Daniel P. Berrange [Sun, 29 May 2011 12:21:53 +0000 (20:21 +0800)]
Introduce a new event emitted when a virtualization failure occurs

This introduces a new domain

  VIR_DOMAIN_EVENT_ID_CONTROL_ERROR

Which uses the existing generic callback

typedef void (*virConnectDomainEventGenericCallback)(virConnectPtr conn,
                                                     virDomainPtr dom,
                                                     void *opaque);

This event is intended to be emitted when there is a failure in
some part of the domain virtualization system. Whether the domain
continues to run/exist after the failure is an implementation
detail specific to the hypervisor.

The idea is that with some types of failure, hypervisors may
prefer to leave the domain running in a "degraded" mode of
operation. For example, if something goes wrong with the QEMU
monitor, it is possible to leave the guest OS running quite
happily. The mgmt app will simply loose the ability todo various
tasks. The mgmt app can then choose how/when to deal with the
failure that occured.
* daemon/remote.c: Dispatch of new event
* examples/domain-events/events-c/event-test.c: Demo catch
  of event
* include/libvirt/libvirt.h.in: Define event ID and callback
* src/conf/domain_event.c, src/conf/domain_event.h: Internal
  event handling
* src/remote/remote_driver.c: Receipt of new event from daemon
* src/remote/remote_protocol.x: Wire protocol for new event
* src/remote_protocol-structs: add new event for checks

13 years agosched: provide new API shims for remaining drivers
Eric Blake [Tue, 17 May 2011 22:33:53 +0000 (16:33 -0600)]
sched: provide new API shims for remaining drivers

Well, the remaining drivers that already had the get/set
scheduler parameter functionality to begin with.

For now, this blindly treats VIR_DOMAIN_SCHEDINFO_CURRENT as
the only supported operation for these 5 domains; it will
take domain-specific patches if more specific behavior is
preferred.

* src/esx/esx_driver.c (esxDomainGetSchedulerParameters)
(esxDomainSetSchedulerParameters): Move guts...
(esxDomainGetSchedulerParametersFlags)
(esxDomainSetSchedulerParametersFlags): ...to new functions.
* src/libxl/libxl_driver.c (libxlDomainGetSchedulerParameters)
(libxlDomainSetSchedulerParameters)
(libxlDomainGetSchedulerParametersFlags)
(libxlDomainSetSchedulerParametersFlags): Likewise.
* src/lxc/lxc_driver.c (lxcGetSchedulerParameters)
(lxcSetSchedulerParameters, lxcGetSchedulerParametersFlags)
(lxcSetSchedulerParametersFlags): Likewise.
* src/test/test_driver.c (testDomainGetSchedulerParams)
(testDomainSetSchedulerParams, testDomainGetSchedulerParamsFlags)
(testDomainSetSchedulerParamsFlags): Likewise.
* src/xen/xen_driver.c (xenUnifiedDomainGetSchedulerParameters)
(xenUnifiedDomainSetSchedulerParameters)
(xenUnifiedDomainGetSchedulerParametersFlags)
(xenUnifiedDomainSetSchedulerParametersFlags): Likewise.

13 years agovirsh: improve schedinfo querying ability
Eric Blake [Tue, 17 May 2011 22:06:12 +0000 (16:06 -0600)]
virsh: improve schedinfo querying ability

Since we can now set just --live or --config, we also need to be
able to query that back.

In the case of setting both --live and --config, it shouldn't matter
which value we read back; otherwise, since querying treats the two
flags as mutually exclusive, so does this patch.

* tools/virsh.c (cmdSchedinfo): Use new API where appropriate.

13 years agoremote: introduce remoteGetSchedulerParametersFlags
Eric Blake [Tue, 17 May 2011 21:45:03 +0000 (15:45 -0600)]
remote: introduce remoteGetSchedulerParametersFlags

* daemon/remote.c (remoteDispatchDomainGetSchedulerParameters):
New function.
* src/remote/remote_driver.c (remoteDomainGetSchedulerParameters):
Likewise.
* src/remote/remote_protocol.x
(remote_domain_get_scheduler_parameters_flags_args)
(remote_domain_get_scheduler_parameters_flags_ret): New types.
(remote_procedure): New RPC.
* src/remote_protocol-structs: Likewise.

13 years agoqemu: introduce qemuGetSchedulerParametersFlags
Eric Blake [Tue, 17 May 2011 21:35:26 +0000 (15:35 -0600)]
qemu: introduce qemuGetSchedulerParametersFlags

* src/qemu/qemu_driver.c (qemuGetSchedulerParameters): Move
guts...
(qemuGetSchedulerParametersFlags): ...to new callback, and honor
flags more accurately.

13 years agosched: introduce virDomainGetSchedulerParametersFlags
Eric Blake [Tue, 17 May 2011 21:17:14 +0000 (15:17 -0600)]
sched: introduce virDomainGetSchedulerParametersFlags

If we can choose live or config when setting, then we need to
be able to choose which one we are querying.

Also, make the documentation clear that set must use a non-empty
subset (some of the hypervisors fail if params is NULL).

* include/libvirt/libvirt.h.in
(virDomainGetSchedulerParametersFlags): New prototype.
* src/libvirt.c (virDomainGetSchedulerParametersFlags): Implement
it.
* src/libvirt_public.syms: Export it.
* python/generator.py (skip_impl): Don't auto-generate.
* src/driver.h (virDrvDomainGetSchedulerParametersFlags): New
callback.

13 years agoremote: consolidate typed parameter handling
Eric Blake [Tue, 17 May 2011 20:58:40 +0000 (14:58 -0600)]
remote: consolidate typed parameter handling

* src/remote/remote_protocol.x (remote_typed_param_value)
(remote_typed_param):  New types.
(remote_sched_param_value, remote_sched_param)
(remote_blkio_param_value, remote_blkio_param)
(remote_memory_param_value, remote_memory_param): Delete.
(remote_domain_get_scheduler_parameters_ret)
(remote_domain_set_scheduler_parameters_args)
(remote_domain_set_scheduler_parameters_flags_args)
(remote_domain_set_blkio_parameters_args)
(remote_domain_get_blkio_parameters_ret)
(remote_domain_set_memory_parameters_args)
(remote_domain_get_memory_parameters_ret): Update clients.
* src/remote_protocol-structs: Likewise.
* src/remote/remote_driver.c (remoteSerializeTypedParameters)
(remoteDeserializeTypedParameters): New functions.
(remoteDomainSetMemoryParameters)
(remoteDomainGetMemoryParameters, remoteDomainSetBlkioParameters)
(remoteDomainGetBlkioParameters)
(remoteDomainGetSchedulerParameters)
(remoteDomainSetSchedulerParameters)
(remoteDomainSetSchedulerParametersFlags): Update clients.
* daemon/remote.c (remoteSerializeTypedParameters)
(remoteDeserializeTypedParameters): New functions.
(remoteDispatchDomainGetSchedulerParameters)
(remoteDispatchDomainSetSchedulerParameters)
(remoteDispatchDomainSetSchedulerParametersFlags)
(remoteDispatchDomainSetMemoryParameters)
(remoteDispatchDomainGetMemoryParameters)
(remoteDispatchDomainSetBlkioParameters)
(remoteDispatchDomainGetBlkioParameters): Update clients.

13 years agomaint: prefer newer API names internally
Eric Blake [Thu, 26 May 2011 17:39:04 +0000 (11:39 -0600)]
maint: prefer newer API names internally

Rather mechanical in nature.

* src/driver.h: Use newer virTypedParameter API names.
* src/libvirt.c: Likewise.
* daemon/remote.c: Likewise.
* src/esx/esx_driver.c: Likewise.
* src/libxl/libxl_driver.c: Likewise.
* src/lxc/lxc_driver.c: Likewise.
* src/qemu/qemu_driver.c: Likewise.
* src/remote/remote_driver.c: Likewise.
* src/test/test_driver.c: Likewise.
* src/xen/xen_driver.c: Likewise.
* src/xen/xen_hypervisor.c: Likewise.
* src/xen/xen_hypervisor.h: Likewise.
* src/xen/xend_internal.c: Likewise.
* tools/virsh.c: Likewise.

13 years agolibvirt.h: avoid regression, and document preferred name
Eric Blake [Sun, 29 May 2011 10:24:20 +0000 (18:24 +0800)]
libvirt.h: avoid regression, and document preferred name

Commit 824dcaff was a regression (thankfully unreleased) for any
client code that used 'struct _virSchedParameter' directly rather
than the preferred virSchedParameter typedef.  Adding a #define
avoids even that API change, while rearranging the file makes it
clear what the old vs. new API is.

* include/libvirt/libvirt.h.in: Rearrange older names to the
bottom and improve documentation on preferred names.
(virDomainGetSchedulerParameters, virDomainSetSchedulerParameters)
(virDomainSetSchedulerParametersFlags)
(virDomainSetBlkioParameters, virDomainGetBlkioParameters)
(virDomainSetMemoryParameters, virDomainGetMemoryParameters):
Use newer type names.
* python/libvirt-override.c: Adjust code generation to cope.
Suggested by Daniel P. Berrange.

13 years agoFix a make check error
Daniel Veillard [Sun, 29 May 2011 10:21:24 +0000 (18:21 +0800)]
Fix a make check error

Apparently introdunced in commit 376e1d9420b
the generator produces u_int flags not unsigned int flags.

* src/remote_protocol-structs: fix to the actual expected type and
  alignment

13 years agoFix virExecWithHook Prototype
Richard Laager [Sun, 29 May 2011 01:56:22 +0000 (20:56 -0500)]
Fix virExecWithHook Prototype

This was necessary to get libvirt to build on Solaris 11 Express and
seems correct (as it makes this match the definition in util.c):

13 years agonwfilter: reorder locks
Stefan Berger [Fri, 27 May 2011 20:50:40 +0000 (16:50 -0400)]
nwfilter: reorder locks

This patch reorders the locks for the nwfilter updates and the access
the nwfilter objects. In the case that the IP address learning thread
was instantiating filters while an update happened, the previous order
lead to a deadlock.

13 years agointerface: reformat error logs
Laine Stump [Thu, 26 May 2011 17:14:36 +0000 (13:14 -0400)]
interface: reformat error logs

It was suggested during review of a different patch that the libvirt
interface driver API's should have "netcf:" in their log
messages. This patch eliminates that from all interface driver API
functions, and also eliminates the extra " - " in the case that netcf
returns no details in its error info (which *never* happens at
present, but could happen sometime in the future.

13 years agointerface: implement a test driver for network config transaction API.
Michal Privoznik [Mon, 9 May 2011 19:17:26 +0000 (21:17 +0200)]
interface: implement a test driver for network config transaction API.

13 years agointerface: Implement driver methods for network config transaction API
Michal Privoznik [Fri, 6 May 2011 12:54:53 +0000 (14:54 +0200)]
interface: Implement driver methods for network config transaction API

This is the functionality at the end of the libvirt part of the call
chain - for each function, the corresponding netcf API is called.

13 years agointerface: expose network config transaction API to virsh
Michal Privoznik [Fri, 6 May 2011 11:52:13 +0000 (13:52 +0200)]
interface: expose network config transaction API to virsh

This implements the commands iface-begin, iface-commit, and iface-rollback,
which simply call the corresponding functions in the libvirt API.

13 years agointerface: implement remote protocol for network config transaction API
Michal Privoznik [Thu, 5 May 2011 13:35:40 +0000 (15:35 +0200)]
interface: implement remote protocol for network config transaction API

13 years agointerface: implement public APIs for libvirt transactional network changes
Michal Privoznik [Thu, 5 May 2011 13:32:15 +0000 (15:32 +0200)]
interface: implement public APIs for libvirt transactional network changes

13 years agointerface: define internal driver API for network config transactions
Michal Privoznik [Thu, 5 May 2011 10:06:53 +0000 (12:06 +0200)]
interface: define internal driver API for network config transactions

13 years agointerface: new public API for network config change transactions
Michal Privoznik [Thu, 5 May 2011 09:21:41 +0000 (11:21 +0200)]
interface: new public API for network config change transactions

This is the API agreed on in:

  https://www.redhat.com/archives/libvir-list/2011-May/msg00026.html

(with a slight name change to use "...begin" rather than
"...start"). This implements transactional changes to the host network
config. When a transaction is begun with ncf_change_begin(), all other
netcf APIs will continue to work as they always have, but a snapshot
of the existing config will be taken, allowing reversion (rollback,
using ncf_change_rollback()) to the exact state of config at the time
ncf_change_begin() was called. Alternately, if it's determined that
the new changes are acceptable, ncf_change_commit() can be called,
which will eliminate the snapshot and make the changes permanent.

As a failsafe measure, if neither ncf_change_commit() or
ncf_change_rollback() is called by the next time the system reboots,
the netcf-transaction initscript will be automatically called to
rollback the changes.

13 years agoopenvz: Fix regression in openvzGetVPSUUID
Matthias Bolte [Fri, 27 May 2011 11:50:13 +0000 (13:50 +0200)]
openvz: Fix regression in openvzGetVPSUUID

Commit f044376530f313a replaced openvz_readline with getline and
changed EOF-handling in the openvzGetVPSUUID.

This patch restores original EOF-handling.

Reported by Jean-Baptiste Rouault.

13 years agoAdd sexpr.c to the list of file with translatable messages
Matthias Bolte [Fri, 27 May 2011 13:48:47 +0000 (15:48 +0200)]
Add sexpr.c to the list of file with translatable messages

This should have been in the last commit.

13 years agosexpr: Improve serialization error reporting
Matthias Bolte [Fri, 27 May 2011 13:08:43 +0000 (15:08 +0200)]
sexpr: Improve serialization error reporting

13 years agoFix build with --with-driver-modules enabled
Matthias Bolte [Thu, 26 May 2011 21:30:21 +0000 (23:30 +0200)]
Fix build with --with-driver-modules enabled

Export a bunch of missing symbols and link the remote driver to gnulib.

13 years agoqemu: implement the new flags for setting memory parameters
Hu Tao [Fri, 27 May 2011 07:47:41 +0000 (15:47 +0800)]
qemu: implement the new flags for setting memory parameters

* src/qemu/qemu_driver.c: update qemuDomainSetMemoryParameters to
  look at the flag parameter and depending on it save the config
  or the live amount

13 years agoqemu: implement the new flags for getting memory parameters
Hu Tao [Fri, 27 May 2011 07:41:29 +0000 (15:41 +0800)]
qemu: implement the new flags for getting memory parameters

* src/qemu/qemu_driver.c: update qemuDomainGetMemoryParameters to
  look at the flag parameter and depending on it read the config
  or the live amount

13 years agoAdd new flags for setting memory parameters
Hu Tao [Fri, 27 May 2011 07:35:11 +0000 (15:35 +0800)]
Add new flags for setting memory parameters

The new flags allow to pick current state, config or the live
parameter, with current being the existing API default (0).
This also hooks this to --config, --live, --current parameters for
the memtune virsh command

* include/libvirt/libvirt.h.in: defines the new flags
* tools/virsh.c: adds support at virsh level
* tools/virsh.pod: updates virsh documentation

13 years agoqemu : support persistent add/delete network interface
KAMEZAWA Hiroyuki [Fri, 27 May 2011 07:01:47 +0000 (15:01 +0800)]
qemu : support persistent add/delete network interface

This patch allows to modify interfaces of domain(qemu)
* src/conf/domain_conf.c src/conf/domain_conf.h src/libvirt_private.syms:
  (virDomainNetInsert)     : Insert a network device to domain definition.
  (virDomainNetIndexByMac) : Returns an index of net device in array.
  (virDomainNetRemoveByMac): Remove a NIC of passed MAC address.
* src/qemu/qemu_driver.c
  (qemuDomainAttachDeviceConfig): add codes for NIC.
  (qemuDomainDetachDeviceConfig): add codes for NIC.

13 years agoesx: Fix regression in absolute file name handling
Matthias Bolte [Thu, 26 May 2011 15:40:51 +0000 (17:40 +0200)]
esx: Fix regression in absolute file name handling

Before commit 145d6cb05c45f4 (in August 2010) absolute file names
in VMX and domain XML configs were handled correctly. But this got
lost during the refactoring. The test cases didn't highlight this
problem because they have their own set of file name handling
functions. The actual ones require a real connection to an ESX
server. Also the test case functions always worked correctly.

Fix the regression and add a new in-the-wild VMX file that contains
such a problematic absolute path. Even though this test case won't
protect against new regressions.

Reported by lofic (IRC nick)

13 years agoopenvz: Add simple testcase for config file parsing function
Matthias Bolte [Thu, 26 May 2011 17:45:41 +0000 (19:45 +0200)]
openvz: Add simple testcase for config file parsing function

This testcase passes before the regression is added in f0443765, fails
after that commit and passes again after the regression was fixed.

13 years agodon't check flags in virDomainSetSchedulerParametersFlags
Hu Tao [Wed, 18 May 2011 02:34:20 +0000 (10:34 +0800)]
don't check flags in virDomainSetSchedulerParametersFlags

drivers implementing domainSetSchedulerParametersFlags should check
flags themselves.

13 years agoopenvz: Fix regression in config file parsing
Taisuke Yamada [Thu, 26 May 2011 17:28:54 +0000 (19:28 +0200)]
openvz: Fix regression in config file parsing

As reported by Diego Blanco in

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

commit f0443765 which replaced openvz_readline to getline(3)
broke OpenVZ driver as it changed semantics of EOF-handling
when parsing OpenVZ configuration.

There're several other issues reported with current OpenVZ driver:

 #1: unclear error message when parsing "CPUS=" line
 #2: openvz driver goes into crashing loop
 #3: "NETIF=" line in configuration is not parsed correctly
 #4: aborts even when optional parameter is missing
 #5: there's a potential memory leak

This updated patch to fix #[145]. This patch does not fix #[23]
as I haven't verified these yet, but this at least got me to run
OpenVZ on libvirt once again.

13 years agoaudit: fix minor off-by-one
Eric Blake [Thu, 26 May 2011 15:09:42 +0000 (09:09 -0600)]
audit: fix minor off-by-one

Coverity spotted this off-by-one.  Thankfully, no one in libvirt
was ever calling virAuditSend with an argument of 3.

* src/util/virtaudit.c (virAuditSend): Use correct comparison.

13 years agoqemu: allow blkstat/blkinfo calls during migration
Federico Simoncelli [Fri, 13 May 2011 10:11:47 +0000 (06:11 -0400)]
qemu: allow blkstat/blkinfo calls during migration

Originally most of libvirt domain-specific calls were blocking
during a migration.
A new mechanism to allow specific calls (blkstat/blkinfo) to be
executed in such condition has been implemented.
In the long term it'd be desirable to get a more general
solution to mark further APIs as migration safe, without needing
special case code.

 * src/qemu/qemu_migration.c: add some additional job signal
   flags for doing blkstat/blkinfo during a migration
 * src/qemu/qemu_domain.c: add a condition variable that can be
   used to efficiently wait for the migration code to clear the
   signal flag
 * src/qemu/qemu_driver.c: execute blkstat/blkinfo using the
   job signal flags during migration

13 years agoAdd disk attach/detach support to libxl driver
Markus Groß [Thu, 26 May 2011 15:27:06 +0000 (23:27 +0800)]
Add disk attach/detach support to libxl driver

Based on the device attach/detach code from the QEMU driver,
but using the new functions to create the structures associated.
* src/libxl/libxl_driver.c: implements domainAttachDevice,
  domainAttachDeviceFlags, domainDetachDevice, domainDetachDeviceFlags
  and domainUpdateDeviceFlags

13 years agoFix libxl vm def handling on domU cleanup
Markus Groß [Thu, 26 May 2011 15:16:31 +0000 (23:16 +0800)]
Fix libxl vm def handling on domU cleanup

* src/libxl/libxl_driver.c: in libxlVmCleanup, free up the
  newDef definition if present overwise it would be leaked.

13 years agoRefactored libxl datastructure instantiation
Markus Groß [Thu, 26 May 2011 15:09:01 +0000 (23:09 +0800)]
Refactored libxl datastructure instantiation

Create 3 new function refactored from previous list ones and
exports them internally to the driver

* src/libxl/libxl_conf.c src/libxl/libxl_conf.h: create libxlMakeDisk,
  libxlMakeNic libxlMakeVfb out of the exsting static List functions
  and exports them

13 years agoFix modifying disk devices in qemu driver
Markus Groß [Thu, 26 May 2011 14:28:23 +0000 (22:28 +0800)]
Fix modifying disk devices in qemu driver

When modifying the disk devices of a live domain and the domain
configuration, the function qemuDomainAttachDeviceConfig
first sets dev->data->disk to NULL. Later qemuDomainAttachDeviceLive
accesses dev->data.disk and causes a segfault.
* src/qemu/qemu_driver.c: fix qemuDomainModifyDeviceFlags() accordingly

13 years agoschema: Add graphics element passwdValidTo attribute to schema
Michal Privoznik [Thu, 26 May 2011 11:47:39 +0000 (13:47 +0200)]
schema: Add graphics element passwdValidTo attribute to schema

We support this in code, but forgot to add this to RNG schema as well.
According to documentation, the value match the dateTime type.

13 years agobuild: fix 'make dist' for ./configure --without-remote
Eric Blake [Wed, 11 May 2011 20:26:06 +0000 (14:26 -0600)]
build: fix 'make dist' for ./configure --without-remote

Anything generated that must end up in the tarball must either
have unconditional rules for generation (remote_protocol.c) or
must live in libvirt.git for the case where the person running
'make dist' has disabled the configure options that control the
rebuild of the generated file (remote_protocol-structs).

* src/Makefile.am (remote_protocol-structs): Add a dependency and
document why it must live in git.
($(srcdir)/remote/%_protocol.c, $(srcdir)/remote/%_protocol.c):
Unconditionally generate.

13 years agojson: Avoid passing large positive 64 bit integers to QMP.
Richard W.M. Jones [Wed, 25 May 2011 16:52:26 +0000 (17:52 +0100)]
json: Avoid passing large positive 64 bit integers to QMP.

http://lists.gnu.org/archive/html/qemu-devel/2011-05/threads.html#02162

Currently, qemu silently clips any JSON integer in the range
0x8000000000000000 - 0xffffffffffffffff (all numbers in this range
will be clipped to 0x7fffffffffffffff == LLONG_MAX).

To avoid this, pass these as signed 64 bit integers in the QMP
request.

13 years agoFix sign mismatches between public API, driver API and XDR protocol
Matthias Bolte [Sat, 21 May 2011 14:20:44 +0000 (16:20 +0200)]
Fix sign mismatches between public API, driver API and XDR protocol

In most cases this affects flags parameters that are unsigned in the
public and driver API but signed in the XDR protocol. Switch the
XDR protocol to unsigned for those.

A counterexample is virNWFilterGetXMLDesc. Its flags parameter is signed
in the public API and XDR protocol, but unsigned in the driver API.

13 years agoremote generator: Fix XDR sign mismatch for virNodeGet(Cells)FreeMemory
Matthias Bolte [Sat, 21 May 2011 10:24:40 +0000 (12:24 +0200)]
remote generator: Fix XDR sign mismatch for virNodeGet(Cells)FreeMemory

virNodeGetFreeMemory used unsigned long long in the public API but
signed hyper in the XDR protocol. Convert the XDR protocol to use
unsigned hyper.

As explained by Eric before, this doesn't affect the on-the-wire protocol.

13 years agoremote generator: Handle stream-using functions
Matthias Bolte [Sat, 21 May 2011 09:24:28 +0000 (11:24 +0200)]
remote generator: Handle stream-using functions

Extend procedure annotation in the .x file for stream handling.

Adds a missing remoteStreamRelease call to remoteDomainScreenshot
error path.

13 years agoremote generator: Make call-by-reference handling stricter
Matthias Bolte [Sat, 21 May 2011 09:16:07 +0000 (11:16 +0200)]
remote generator: Make call-by-reference handling stricter

Several functions return values by reference parameters. This is realized
by passing the members of remote_CALL_ret by reference to the called
function.

The position of this parameters in the function signature follows some
patterns with some exceptions. This patterns and exceptions are hardcoded
in the generator.

Add an insert@<offset> annotation to the remote_CALL_ret struct members
for functions that return lists to remove some of the hardcoded patterns
and exceptions.

13 years agoremote generator: Rename virNodeGetCellsFreeMemory parameters to common pattern
Matthias Bolte [Sat, 21 May 2011 07:52:19 +0000 (09:52 +0200)]
remote generator: Rename virNodeGetCellsFreeMemory parameters to common pattern

This allows to remove some special case code from the generator.

13 years agoremote generator: Handle virDomainCreateWithFlags
Matthias Bolte [Fri, 20 May 2011 15:58:34 +0000 (17:58 +0200)]
remote generator: Handle virDomainCreateWithFlags

Add special case code for updating a given domain object instead of
returning a new one.

13 years agovirsh: time_t is not a long on FreeBSD
Matthias Bolte [Fri, 13 May 2011 06:31:03 +0000 (08:31 +0200)]
virsh: time_t is not a long on FreeBSD

localtime_r expects time_t.

13 years agotime_t is not a long on FreeBSD, switch internal type to long long
Matthias Bolte [Fri, 13 May 2011 05:07:13 +0000 (07:07 +0200)]
time_t is not a long on FreeBSD, switch internal type to long long

13 years agoAllow to explicitly disable the secrets a directory storage driver
Matthias Bolte [Tue, 24 May 2011 11:21:51 +0000 (13:21 +0200)]
Allow to explicitly disable the secrets a directory storage driver

13 years agobuild: avoid strerror_r pitfalls
Eric Blake [Tue, 24 May 2011 22:36:14 +0000 (16:36 -0600)]
build: avoid strerror_r pitfalls

In particular, this guarantees that virStrerror always gives a
useful result.

* .gnulib: Update to latest, for (lots of) strerror_r fixes.

13 years agoFix the signature of virDomainMigrateFinish3 for error reporting
Daniel P. Berrange [Tue, 24 May 2011 12:05:33 +0000 (08:05 -0400)]
Fix the signature of virDomainMigrateFinish3 for error reporting

The current virDomainMigrateFinish3 method signature attempts to
distinguish two types of errors, by allowing return with ret== 0,
but ddomain == NULL, to indicate a failure to start the guest.
This is flawed, because when ret == 0, there is no way for the
virErrorPtr details to be sent back to the client.

Change the signature of virDomainMigrateFinish3 so it simply
returns a virDomainPtr, in the same way as virDomainMigrateFinish2
The disk locking code will protect against the only possible
failure mode this doesn't account for (loosing conenctivity to
libvirtd after Finish3 starts the CPUs, but before the client
sees the reply for Finish3).

* src/driver.h, src/libvirt.c, src/libvirt_internal.h: Change
  virDomainMigrateFinish3 to return a virDomainPtr instead of int
* src/remote/remote_driver.c, src/remote/remote_protocol.x,
  daemon/remote.c, src/qemu/qemu_driver.c, src/qemu/qemu_migration.c:
  Update for API change

13 years agoFix preservation of errors across migration steps
Daniel P. Berrange [Mon, 23 May 2011 16:48:36 +0000 (12:48 -0400)]
Fix preservation of errors across migration steps

When doing migration, if an error occurs in Perform, it must not
be overwritten during Finish/Confirm steps. If an error occurs
in Finish, it must not be overwritten in Confirm.

Previous commit a9d12c2444e43a0d3e5135eb15b4b62a7c011427 added
code to qemudDomainMigrateFinish2 to preserve the error. This
is not the right place, because it is not applicable in non-p2p
migration. The src/libvirt.c virDomainMigrateV2/3 methods need
code to preserve errors for non-p2p migration, while the
doPeer2PeerMigrate2 and doPeer2PeerMigrate3 methods contain
code to preverse errors for p2p migration.

Remove the bogus error preservation from qemudDomainMigrateFinish2
and qemudDomainMigrateFinish3.

Fix virDomainMigrateV3 and doPeer2PeerMigrate3 so that they
preserve any error hit during the Finish3 step, before invoking
Confirm3.

Finally if qemuMigrationFinish fails to resume the CPUs, it must
preserve the error before tearing down the VM, so that VM cleanup
doesn't overwrite it.

* src/libvirt.c: Preserve error before invoking Confirm3
* src/qemu/qemu_driver.c: Remove bogus error preservation
  code in qemudDomainMigrateFinish2/qemudDomainMigrateFinish3
* src/qemu/qemu_migration.c: Preserve error before invoking Confirm3
  and after resume fails in qemuMigrationFinish.

13 years agoImprove debug logging of migration APIs
Daniel P. Berrange [Fri, 20 May 2011 10:03:04 +0000 (06:03 -0400)]
Improve debug logging of migration APIs

* src/libvirt.c: Add further debug lines in helper APIs for
  migration
* src/qemu/qemu_migration.c: Add debug lines for all internal
  migration API parameters

13 years agoFix error propagation in finish method for v3 migration
Daniel P. Berrange [Mon, 23 May 2011 12:50:11 +0000 (08:50 -0400)]
Fix error propagation in finish method for v3 migration

Even when failing to start CPUs, the finish method was returning
a success result. Fix this so that the QEMU process is killed
off when finish fails under v3 protocol. Also rename the
killOnFinish boolean to 'v3proto' to make it clearer that this
is a tunable based on the migration protocol version

* src/qemu/qemu_driver.c: Update for API change
* src/qemu/qemu_migration.c, src/qemu/qemu_migration.h: Kill
  VM in qemuMigrationFinish if failing to start CPUs

13 years agoFix SPICE seamless migration hostname
Daniel P. Berrange [Mon, 23 May 2011 15:42:15 +0000 (11:42 -0400)]
Fix SPICE seamless migration hostname

The SPICE seamless migration process requires data to be passed
back from the target host, to the source host via a cookie.
The cookie includes the target host's hostname, but this was not
stored, merely validated. This patch explicitly records the
remote hostname after parsing the cookie, and uses it when
initiating the SPICE migration

* qemu/qemu_migration.c: Fix SPICE seamless migration hostname

13 years agoFix resume on destination when doing non-live tunnelled migration
Daniel P. Berrange [Fri, 20 May 2011 12:29:42 +0000 (08:29 -0400)]
Fix resume on destination when doing non-live tunnelled migration

Before running perform in peer-2-peer migration, the current
guest state must be recorded, so that non-live migration can
currently unpause a running guest on completion.

* src/qemu/qemu_migration.c: Move check for offline guest
  to fix non-live migration

13 years agoIntroduce two method migration APIs
Daniel P. Berrange [Wed, 18 May 2011 13:45:28 +0000 (09:45 -0400)]
Introduce two method migration APIs

There are two pieces of information which are desirable for
migration, which cannot be supplied by applications

 - The explicit QEMU migration URI, while using Peer2Peer
   migration
 - An override for the target VM XML

This introduces two new public APIs to support these extra
parameters. There is no need for extra wire protocool changes,
since this is supported by the v3 migration enhancements

* include/libvirt/libvirt.h.in,
  src/libvirt.c, src/libvirt_public.syms: Add virDomainMigrate2
  and virDomainMigrateToURI2

13 years agoAdd a second URI parameter to virDomainMigratePerform3 method
Daniel P. Berrange [Wed, 18 May 2011 13:18:53 +0000 (09:18 -0400)]
Add a second URI parameter to virDomainMigratePerform3 method

The virDomainMigratePerform3 currently has a single URI parameter
whose meaning varies. It is either

 - A QEMU migration URI (normal migration)
 - A libvirtd connection URI (peer2peer migration)

Unfortunately when using peer2peer migration, without also
using tunnelled migration, it is possible that both URIs are
required.

This adds a second URI parameter to the virDomainMigratePerform3
method, to cope with this scenario. Each parameter how has a fixed
meaning.

NB, there is no way to actually take advantage of this yet,
since virDomainMigrate/virDomainMigrateToURI do not have any
way to provide the 2 separate URIs

* daemon/remote.c, src/remote/remote_driver.c,
  src/remote/remote_protocol.x, src/remote_protocol-structs: Add
  the second URI parameter to perform3 message
* src/driver.h, src/libvirt.c, src/libvirt_internal.h: Add
  the second URI parameter to Perform3 method
* src/libvirt_internal.h, src/qemu/qemu_migration.c,
  src/qemu/qemu_migration.h: Update to handle URIs correctly

13 years agoExtend v3 migration protocol to allow app supplied XML for target
Daniel P. Berrange [Wed, 18 May 2011 09:26:30 +0000 (05:26 -0400)]
Extend v3 migration protocol to allow app supplied XML for target

This extends the v3 migration protocol such that the
virDomainMigrateBegin3 and virDomainMigratePerform3
methods accept an application supplied XML config for
the target VM.

If the 'xmlin' parameter is NULL, then Begin3 uses the
current guest XML as normal. A driver implementing the
Begin3 method should either reject all non-NULL 'xmlin'
parameters, or strictly validate that the app supplied
XML does not change guest ABI.

The Perform3 method also needed the xmlin parameter to
cope with the Peer2Peer migration sequence.

NB it is not yet possible to use this capability since
neither of the public virDomainMigrate/virDomainMigrateToURI
methods have a way to pass in XML.

* daemon/remote.c, src/remote/remote_driver.c,
  src/remote/remote_protocol.x, src/remote_protocol-structs:
  Add 'remote_string xmlin' parameter to begin3/perform3
  RPC messages
* src/libvirt.c, src/driver.h, src/libvirt_internal.h: Add
  'const char *xmlin' parameter to Begin3/Perform3 methods
* src/qemu/qemu_driver.c, src/qemu/qemu_migration.c,
  src/qemu/qemu_migration.h: Pass xmlin parameter around
  migration methods

13 years agoesx: Report an error when auth pointer is missing instead of declining
Matthias Bolte [Wed, 25 May 2011 13:52:34 +0000 (15:52 +0200)]
esx: Report an error when auth pointer is missing instead of declining

Otherwise an attempt to use virConnectOpen or virConnectOpenAuth without
auth pointer results in the driver declining the URI and libvirt falling
back to the remote driver for an esx:// URI.

13 years agoFix initialization of current vcpus in libxl driver
Jim Fehlig [Mon, 23 May 2011 22:06:00 +0000 (16:06 -0600)]
Fix initialization of current vcpus in libxl driver

The cur_vcpus member of struct libxl_domain_build_info was incorrectly
initialized to the number of vcpus, when it should have been interpreted
as a bitmap, where bit X corresponds to online/offline status of vcpuX.

To complicate matters, cur_vcpus is an int, so only 32 vcpus can be
set online.  Add a check to ensure vcpus does not exceed this limit.

V2: Eric Blake noted a compilation pitfal when '1 << 32' on an int.
    Account for vcpus == 32.

13 years agobuild: fix VIR_DEBUG on mingw
Eric Blake [Tue, 24 May 2011 17:20:19 +0000 (11:20 -0600)]
build: fix VIR_DEBUG on mingw

We don't use the gnulib vsnprintf replacement, which means that
on mingw, vsnprintf doesn't support %zn or %lln.

And as it turns out, VIR_GET_VAR_STR was a rather inefficient
reimplementation of virVasprintf logic.

* src/util/logging.c (VIR_GET_VAR_STR): Drop.
(virLogMessage): Inline a simpler version here.
* src/util/virterror.c (VIR_GET_VAR_STR, virRaiseErrorFull):
Likewise.
Reported by Matthias Bolte.

13 years agoqemu: Don't change ownership of file when appending to it
Michal Privoznik [Tue, 24 May 2011 12:36:08 +0000 (14:36 +0200)]
qemu: Don't change ownership of file when appending to it

Saving domain to previously created file changes also its ownership.
This is certainly not what users want if some conditions are met:
it is a regular, local file and dynamic_ownership is off.

13 years agoFix accidental revert of .gnulib update
Daniel P. Berrange [Tue, 24 May 2011 15:36:43 +0000 (11:36 -0400)]
Fix accidental revert of .gnulib update

Change f88af9dc16cf891f88bb925885bdf5e328cf44df accidentally
reverted the .gnulib update from f3cfc99e794bd77479878fc224c6581b61d57dbd

* .gnulib: Update to 2c25c9ebe8db1415bfde25f0a451767332c8cf59

13 years agoqemu: fix typo in name - should be VHOST_NET, not VNET_HOST
Laine Stump [Mon, 23 May 2011 17:38:32 +0000 (13:38 -0400)]
qemu: fix typo in name - should be VHOST_NET, not VNET_HOST

NB: the enum that uses the string vnet-host (now changed to vhost-net)
is used in XML, but fortunately that hasn't been in an official
release yet, so it can still be fixed.

13 years agoFix QEMU -vnc arg generation with raw IPv6 addresses
Daniel P. Berrange [Thu, 19 May 2011 10:39:35 +0000 (06:39 -0400)]
Fix QEMU -vnc arg generation with raw IPv6 addresses

Since -vnc uses ':' to separate the address from the port, raw
IPv6 addresses need to be escaped like [addr]:port

* src/qemu/qemu_command.c: Escape raw IPv6 addresses with []
* tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args,
  tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml: Tweak
  to test Ipv6 escaping
* docs/schemas/domain.rng: Allow Ipv6 addresses, or hostnames
  in <graphics> listen attributes

13 years agoFix peer2peer migration with transient VMs
Daniel P. Berrange [Thu, 19 May 2011 11:48:15 +0000 (07:48 -0400)]
Fix peer2peer migration with transient VMs

The qemuMigrationConfirm method shouldn't deal with final VM
cleanup, since it can be called from the peer2peer migration,
which expects to still use the 'vm' object afterwards.

Push the cleanup code out of qemuMigrationConfirm, into its
caller, qemuDomainMigrateConfirm3

* src/qemu/qemu_driver.c: Add VM cleanup code to
  qemuDomainMigrateConfirm3
* src/qemu/qemu_migration.c, src/qemu/qemu_migration.h: Remove
  job handling cleanup from qemuMigrationConfirm

13 years agoPerform feature flag compat checking in QEMU migration cookies
Daniel P. Berrange [Wed, 18 May 2011 15:33:17 +0000 (11:33 -0400)]
Perform feature flag compat checking in QEMU migration cookies

To allow new mandatory migration cookie data to be introduced,
add support for checking supported feature flags when parsing
migration cookie.

* src/qemu/qemu_migration.c: Feature flag checking in migration
  cookie parsing

13 years agoReplace all remaining setgid/setuid calls with virSetUIDGID
Jiri Denemark [Sun, 22 May 2011 14:05:07 +0000 (17:05 +0300)]
Replace all remaining setgid/setuid calls with virSetUIDGID

Two additional places need initgroups call to properly work in an
environment where the UID is allowed to open/create stuff through its
supplementary groups.

13 years agoutil: Keep errno set to the root error after when returning from virSetUIDGID
Jiri Denemark [Sun, 22 May 2011 14:16:44 +0000 (17:16 +0300)]
util: Keep errno set to the root error after when returning from virSetUIDGID

13 years agopython: Don't free must-not-free variables
Michal Privoznik [Mon, 23 May 2011 12:41:00 +0000 (14:41 +0200)]
python: Don't free must-not-free variables

py_str() function call PyString_AsString(). As written in documentation,
the caller must not free the returned value, because it points to some
internal structures.

13 years agostorage: Add comment to picking return value of qemu-img
Michal Privoznik [Tue, 24 May 2011 06:54:37 +0000 (08:54 +0200)]
storage: Add comment to picking return value of qemu-img

Commit d7b2679253504d6defa9fc7159b572cfd6a25a95 introduced
a return value picking of qemu-img on '-h', but without any comment.

13 years agospice: support streaming-video parameter
Alon Levy [Mon, 23 May 2011 15:16:42 +0000 (18:16 +0300)]
spice: support streaming-video parameter

This adds a streaming-video=filter|all|off attribute. It is used to change
the behavior of video stream detection in spice, the default is filter (the
default for libvirt is not to specify it - the actual default is defined in
libspice-server.so).

Usage:

    <graphics type='spice' autoport='yes'>
      <streaming mode='off'/>
    </graphics>

Tested with the above and with tests/qemuxml2argvtest.

Signed-off-by: Alon Levy <alevy@redhat.com>
13 years agonwfilter: enable filtering of gratuitous ARP packets
Stefan Berger [Mon, 23 May 2011 23:41:18 +0000 (19:41 -0400)]
nwfilter: enable filtering of gratuitous ARP packets

This patch enables filtering of gratuitous ARP packets using the following XML:

<rule action='accept' direction='in' priority='425'>
<arp gratuitous='true'/>
</rule>

13 years agoqemu: don't require is_kvm for vhost-net support
Laine Stump [Mon, 23 May 2011 16:59:41 +0000 (12:59 -0400)]
qemu: don't require is_kvm for vhost-net support

This was discussed in:

  https://www.redhat.com/archives/libvir-list/2011-May/msg01370.html

The capabilities code only sets the flag to allow use of vhost-net if
kvm is detected (set if the help string contains "(qemu-kvm-" or
"(kvm-"), but actually vhost-net is available in some qemu builds that
don't have kvm in their name, so just checking for ",vhost=" is enough.

13 years agoUse per-user TLS certificates when possible
Doug Goldstein [Fri, 20 May 2011 20:18:09 +0000 (15:18 -0500)]
Use per-user TLS certificates when possible

When using TLS authentication and operating as the non-root user,
initially attempt to use that specific user's TLS certificates before
attempting to use the system wide TLS certificates.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
13 years agopython: Fix typo in bindings
Michal Privoznik [Mon, 23 May 2011 08:51:46 +0000 (10:51 +0200)]
python: Fix typo in bindings

This typo caused a bug in which we wanted to free() invalid pointer.

13 years agostorage: pick return value of qemu-img
Michal Privoznik [Mon, 23 May 2011 07:08:01 +0000 (09:08 +0200)]
storage: pick return value of qemu-img

qemu-img returns non-zero status on -h. Therefore we need to
provide virCommandRun() a non-NULL exit status pointer.

13 years agobuild: generate files when building without libvirtd
Wen Congyang [Fri, 13 May 2011 08:02:13 +0000 (16:02 +0800)]
build: generate files when building without libvirtd

Steps to reproduce this problem:
1. # ./autogen.sh --without-libvirtd
2. # make dist
   ...
   make[1]: Entering directory `/home/wency/source/libvirt-nodaemon/daemon'
   make[1]: *** No rule to make target `remote_dispatch_prototypes.h', needed by `distdir'.  Stop.
   make[1]: Leaving directory `/home/wency/source/libvirt-nodaemon/daemon'
   make: *** [distdir] Error 1

13 years agodocs: Fix error syntax of vcpupin example XML
Osier Yang [Sat, 21 May 2011 09:12:23 +0000 (17:12 +0800)]
docs: Fix error syntax of vcpupin example XML

Lacks of "/", push this directly in trivial rule.

13 years agoremote generator: Add special case for virConnectGetType
Matthias Bolte [Mon, 16 May 2011 18:10:06 +0000 (20:10 +0200)]
remote generator: Add special case for virConnectGetType

13 years agolibvirt.spec: /var/cache/libvirt should be 0711.
Richard W.M. Jones [Fri, 20 May 2011 15:18:11 +0000 (16:18 +0100)]
libvirt.spec: /var/cache/libvirt should be 0711.

This allows qemu to create files in /var/cache/libvirt/qemu/, and
specifically is required to fix virDomainMemoryPeek.

13 years agoremote: remove bogus virDomainFree.
Richard W.M. Jones [Fri, 20 May 2011 14:55:40 +0000 (15:55 +0100)]
remote: remove bogus virDomainFree.

13 years agoqemudDomainMemoryPeek: change ownership/selinux label on temporary file.
Richard W.M. Jones [Fri, 20 May 2011 12:56:46 +0000 (13:56 +0100)]
qemudDomainMemoryPeek: change ownership/selinux label on temporary file.

Otherwise qemu is unable to write to it, with the error:

libvir: QEMU error : internal error unable to execute QEMU command 'memsave': Could not open '/var/cache/libvirt/qemu/qemu.mem.RRNvLv'

13 years agoremote generator: Don't rely on $_ being stable over a large function
Matthias Bolte [Sun, 15 May 2011 06:14:35 +0000 (08:14 +0200)]
remote generator: Don't rely on $_ being stable over a large function

Replace $calls{$_} with $call in the dispatch bodies generator function.

No functional change included.

13 years agobuild: require newer gettext
Eric Blake [Thu, 12 May 2011 15:29:51 +0000 (09:29 -0600)]
build: require newer gettext

Now that RHEL 5.6 ships with gettext 0.17, we can get out of the
stone age and use the newer gettext capabilities and improved
macros for certain configure tests.

* configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.17.
(MKINSTALLDIRS): Delete hack that is no longer needed.
* bootstrap.conf (buildreq): Check for minimum gettext version.
Based on a report by Wen Congyang.

13 years agovirsh: Use Env variables for debug level and logfile
Supriya Kannery [Mon, 9 May 2011 07:08:06 +0000 (12:38 +0530)]
virsh: Use Env variables for debug level and logfile

Use variables VIRSH_DEBUG and VIRSH_LOG_FILE for controlling virsh logging.

Signed-off-by: Supriya Kannery <supriyak@in.ibm.com>
13 years agoDon't generate cookies with v2 migration protocol.
Daniel P. Berrange [Wed, 18 May 2011 16:34:08 +0000 (12:34 -0400)]
Don't generate cookies with v2 migration protocol.

The v2 migration protocol had a limit on cookie length that was
too small to be useful for QEMU. Avoid generating cookies with
v2 protocol, so that old libvirtd can still reliably migrate a
guest to new libvirtd uses v2 protocol.

* src/qemu/qemu_driver.c: Avoid migration cookies with v2
  migration

13 years agoFix QEMU migration cookie crash for guests with no graphics
Daniel P. Berrange [Tue, 17 May 2011 08:54:22 +0000 (04:54 -0400)]
Fix QEMU migration cookie crash for guests with no graphics

When generating a cookie for a guest with no data, the
QEMU_MIGRATION_COOKIE_GRAPHICS flag was set even if no
graphics data was added. Avoid setting the flag unless
it was needed, also add a safety check for mig->graphics
being non-NULL

* src/qemu/qemu_migration.c: Avoid cookie crash for guest
  with no graphics

13 years agoEnsure p2p and direct migration use the new v3 protocol if available
Daniel P. Berrange [Tue, 17 May 2011 12:38:30 +0000 (08:38 -0400)]
Ensure p2p and direct migration use the new v3 protocol if available

The internal virDomainMigratePeer2Peer and virDomainMigrateDirect
helper methods were not checking whether the target supports the
v3 migration protocol.

* src/libvirt.c: Use v3 migration protocol for p2p/direct
  migration if available.

13 years agoBlank out the 'listenAddr' parameter if empty string
Daniel P. Berrange [Wed, 18 May 2011 13:52:26 +0000 (09:52 -0400)]
Blank out the 'listenAddr' parameter if empty string

Some bogus apps are generating a VNC/SPICE/RFB listen attribute
with no content. This then causes a failure with the graphics
migration cookie parsing. Blank out the 'listenAddr' parameter
after parsing domain XML if it is the empty string, so the host
default takes over

* src/qemu/qemu_migration.c: Blank out listenAddr parameter
  if empty

13 years agoremote: remove special case for getting version
Eric Blake [Wed, 11 May 2011 22:48:35 +0000 (16:48 -0600)]
remote: remove special case for getting version

The on-the-wire protocol is identical; XDR guarantees that
both 'hyper' and 'unsigned hyper' are transmitted as 8 bytes.

* src/remote/remote_protocol.x (remote_get_version_ret)
(remote_get_lib_version_ret): Match public API.
* daemon/remote_generator.pl: Drop special case.
* src/remote_protocol-structs: Reflect updated type.

13 years agobuild: silence clang false positive
Eric Blake [Thu, 12 May 2011 01:41:46 +0000 (19:41 -0600)]
build: silence clang false positive

Clang couldn't quite see that the same condition of
(flags & VIR_DOMAIN_MEM_CONFIG) is used twice, such that
the second block is guaranteed that def was assigned in
the first block.

* src/libxl/libxl_driver.c (libxlDomainSetMemoryFlags): Add a hint
for clang.

13 years agovirsh: optimize creation of default connection
Eric Blake [Mon, 14 Mar 2011 20:30:24 +0000 (14:30 -0600)]
virsh: optimize creation of default connection

Ramon de Carvalho Valle reported a problem with:
virsh connect qemu:///system
as a non-root user.  The real root problem appears to be a regression
in libvirtd being auto-started on the default qemu:///session URI;
however, the symptom points to an independent flaw in virsh - we
shouldn't be wasting efforts on making a connection if we aren't going
to be using that connection.  Fixing virsh avoids Ramon's issue, while
I work in the meantime to fix the real libvirtd regression.

This patch looks big, but that's because 'gcc -Wmissing-field-initializers'
gets triggered by './autobuild.sh --enable-compile-warnings=error', so I
had to add 0 initialization to everyone (rather than my preference of
just adding the non-zero flags to virshCmds and to cmdConnect).

Meanwhile, if you use 'virsh -c URI', the connection must succeed; this
patch _only_ optimizes the default connection to be deferred to a later
point where we know if a particular command to be run needs a connection.

* tools/virsh.c (VSH_CMD_FLAG_NOCONNECT): New flag.
(vshCmdDef): Add new flags field.
(vshCommandRun): Honor new flag.
(domManagementCmds, domMonitoringCmds, storagePoolCmds)
(storageVolCmds, networkCmds, nodedevCmds, ifaceCmds)
(nwfilterCmds, secretCmds, virshCmds, snapshotCmds)
(hostAndHypervisorCmds): Populate new field.
(vshReconnect): Don't warn on initial connection.

13 years agoImprove invalid argument checks for the public API
Matthias Bolte [Wed, 18 May 2011 09:42:50 +0000 (11:42 +0200)]
Improve invalid argument checks for the public API

13 years agoClarify that virDomainGet(Memory|Blkio)Parameters doesn't support subsets
Matthias Bolte [Wed, 18 May 2011 09:33:42 +0000 (11:33 +0200)]
Clarify that virDomainGet(Memory|Blkio)Parameters doesn't support subsets

Improve invalid argument checks in the size query case. The drivers already
relied on this unchecked behavior.

Relax the implementation of virDomainGet(Memory|Blkio)MemoryParameters
in the drivers and allow to pass more memory than necessary for all
parameters.

13 years agoClarify that virDomainSet(Memory|Blkio)Parameters can take parameter subsets
Matthias Bolte [Wed, 18 May 2011 09:24:07 +0000 (11:24 +0200)]
Clarify that virDomainSet(Memory|Blkio)Parameters can take parameter subsets

13 years agoClarify that virDomainSetSchedulerParameters(Flags) can take subsets
Matthias Bolte [Wed, 18 May 2011 09:04:12 +0000 (11:04 +0200)]
Clarify that virDomainSetSchedulerParameters(Flags) can take subsets

Add invalid argument checks for params and nparams to the public API
and remove them from the drivers (e.g. xend).

Add subset handling to libxl and test drivers.