]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
14 years agoRemote driver client and server for virDomainOpenConsole
Daniel P. Berrange [Fri, 23 Jul 2010 12:57:14 +0000 (13:57 +0100)]
Remote driver client and server for virDomainOpenConsole

This provides an implementation of the virDomainOpenConsole
API for the remote driver client and server.

* daemon/remote.c: Server side impl
* src/remote/remote_driver.c: Client impl
* src/remote/remote_protocol.x: Wire definition

14 years agoIntroduce a virDomainOpenConsole API
Daniel P. Berrange [Fri, 23 Jul 2010 12:34:31 +0000 (13:34 +0100)]
Introduce a virDomainOpenConsole API

To enable virsh console (or equivalent) to be used remotely
it is necessary to provide remote access to the /dev/pts/XXX
pseudo-TTY associated with the console/serial/parallel device
in the guest. The virStream API provide a bi-directional I/O
stream capability that can be used for this purpose. This
patch thus introduces a virDomainOpenConsole API that uses
the stream APIs.

* src/libvirt.c, src/libvirt_public.syms,
  include/libvirt/libvirt.h.in, src/driver.h: Define the
  new virDomainOpenConsole API
* src/esx/esx_driver.c, src/lxc/lxc_driver.c,
  src/opennebula/one_driver.c, src/openvz/openvz_driver.c,
  src/phyp/phyp_driver.c, src/qemu/qemu_driver.c,
  src/remote/remote_driver.c, src/test/test_driver.c,
  src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
  src/xen/xen_driver.c, src/xenapi/xenapi_driver.c: Stub
  API entry point

14 years agoSupport callbacks on virStream APIs in remote driver client
Daniel P. Berrange [Fri, 23 Jul 2010 12:24:37 +0000 (13:24 +0100)]
Support callbacks on virStream APIs in remote driver client

The current remote driver code for streams only supports
blocking I/O mode. This is fine for the usage with migration
but is a problem for more general use cases, in particular
bi-directional streams.

This adds supported for the stream callbacks and non-blocking
I/O. with the minor caveat is that it doesn't actually do
non-blocking I/O for sending stream data, only receiving it.
A future patch will try to do non-blocking sends, but this is
quite tricky to get right.

* src/remote/remote_driver.c: Allow non-blocking I/O for
  streams and support callbacks

14 years agoFix LXC container console device setup
Daniel P. Berrange [Fri, 5 Nov 2010 13:27:34 +0000 (13:27 +0000)]
Fix LXC container console device setup

The /dev/console device inside the container must NOT map
to the real /dev/console device node, since this allows the
container control over the current host console. A fun side
effect of this is that starting a container containing a
real Fedora OS will kill off your X server.

Remove the /dev/console node, and replace it with a symlink
to the primary console TTY

* src/lxc/lxc_container.c: Replace /dev/console with a
  symlink to /dev/pty/0
* src/lxc/lxc_controller.c: Remove /dev/console from cgroups
  ACL

14 years agovirsh: supply long option for -V
Eric Blake [Tue, 9 Nov 2010 20:44:47 +0000 (13:44 -0700)]
virsh: supply long option for -V

* tools/virsh.c (vshParseArgv): Use NULL instead of 0 for pointer,
and symbolic names for has_arg.  Give --version an optional arg.
(vshUsage): Document this.
* tools/virsh.pod: Likewise.

14 years agoqemu: Add flag to force a CDROM eject
Cole Robinson [Mon, 8 Nov 2010 17:52:48 +0000 (12:52 -0500)]
qemu: Add flag to force a CDROM eject

QEMU allows forcing a CDROM eject even if the guest has locked the device.
Expose this via a new UpdateDevice flag, VIR_DOMAIN_DEVICE_MODIFY_FORCE.

This has been requested for RHEV:

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

v2: Change flag name, bool cleanups

14 years agorpm: fix /var/lib/libvirt permissions
Eric Blake [Wed, 3 Nov 2010 21:20:24 +0000 (15:20 -0600)]
rpm: fix /var/lib/libvirt permissions

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

Regression of forcing 0700 permissions (which breaks guest startup
because the qemu user can't see /var/lib/libvirt/*.monitor) was
introduced in commit 66823690e, as part of libvirt 0.8.2.

* libvirt.spec.in (%files): Drop %{_localstatedir}/lib/libvirt,
since libvirt depends on libvirt-client.
(%files client): Guarantee 755 permissions on
%(_localstatedir}/lib/libvirt, since the qemu user must be able to
do pathname resolution to a subdirectory.

14 years agoAugment bug reporting documentation
Daniel Veillard [Wed, 10 Nov 2010 12:16:37 +0000 (13:16 +0100)]
Augment bug reporting documentation

With some instruction on how to attach useful gdb backtraces

14 years agoAllow non-file disk backingStores
Adam Litke [Wed, 3 Nov 2010 15:50:11 +0000 (10:50 -0500)]
Allow non-file disk backingStores

I am trying to use a qcow image with libvirt where the backing 'file' is a
qemu-nbd server.  Unfortunately virDomainDiskDefForeachPath() assumes that
backingStore is always a real file so something like 'nbd:0:3333' is rejected
because a file with that name cannot be accessed.  Note that I am not worried
about directly using nbd images.  That would require a new disk type with XML
markup, etc.  I only want it to be permitted as a backingStore

The following patch implements danpb's suggestion:
> I think I'm inclined to push the logic for skipping NBD one stage higher.
> I'd rather expect virStorageFileGetMetadata() to return all backing
> stores, even if not files. The virDomainDiskDefForeachPath() method
> should definitely ignore non-file backing stores though.
>
> So what I'm thinking is to extend the virStorageFileMetadata struct and
> just add a 'bool isFile' field to it. Default this field to true, unless
> you see the prefix of nbd: in which case set it to false. The
> virDomainDiskDefForeachPath() method can then skip over any backing
> store with isFile == false

Signed-off-by: Adam Litke <agl@us.ibm.com>
Cc: Daniel P. Berrange <berrange@redhat.com>
14 years agoxencapstest: Don't fail when Xen is installed
Matthias Bolte [Tue, 9 Nov 2010 22:38:12 +0000 (23:38 +0100)]
xencapstest: Don't fail when Xen is installed

xencapstest calls xenHypervisorMakeCapabilitiesInternal with conn == NULL
which calls xenDaemonNodeGetTopology with conn == NULL when a recent
enough Xen was detected (sys_interface_version >= SYS_IFACE_MIN_VERS_NUMA).
But xenDaemonNodeGetTopology insists in having conn != NULL and fails,
because it expects to be able to talk to an actual xend.

We cannot do that in a 'make check' test. Therefore, only call the xend
subdriver function when conn isn't NULL.

Reported by Andy Howell and Jim Fehlig.

14 years agovirsh: fix non-literal string format
Laine Stump [Tue, 9 Nov 2010 22:37:05 +0000 (17:37 -0500)]
virsh: fix non-literal string format

These are in the newly added -V output.

14 years agobye to close(), welcome to VIR_(FORCE_)CLOSE()
Stefan Berger [Tue, 9 Nov 2010 20:48:48 +0000 (15:48 -0500)]
bye to close(), welcome to VIR_(FORCE_)CLOSE()

Using automated replacement with sed and editing I have now replaced all
occurrences of close() with VIR_(FORCE_)CLOSE() except for one, of
course. Some replacements were straight forward, others I needed to pay
attention. I hope I payed attention in all the right places... Please
have a look. This should have at least solved one more double-close
error.

14 years agoFix syntax-check error in domain.rng
Matthias Bolte [Tue, 9 Nov 2010 19:02:35 +0000 (20:02 +0100)]
Fix syntax-check error in domain.rng

Replace tab with spaces.

14 years agoesx: Add support for memtune/min_guarantee
Matthias Bolte [Sat, 6 Nov 2010 17:53:39 +0000 (18:53 +0100)]
esx: Add support for memtune/min_guarantee

Also add a test case for the VMX handling of it.

14 years agoschema: Move timer element inside clock
Jiri Denemark [Mon, 8 Nov 2010 11:27:41 +0000 (12:27 +0100)]
schema: Move timer element inside clock

Both conf/domain_conf.c and domain XML documentation have <timer>
elements inside /domain/clock. Change domain.rng schema to be consistent
with them.

14 years agoMisc test case fixes for SPICE
Daniel P. Berrange [Tue, 9 Nov 2010 13:51:21 +0000 (13:51 +0000)]
Misc test case fixes for SPICE

* docs/schemas/domain.rng: Fix merge error which left SPICE channel
  elements under VNC schema.
* tests/qemuhelptest.c: Add SPICE flag to kvm-83 test
* tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml: Add
  <memballoon> element

14 years agovirsh: Add .xml suffix to tmp files used in *edit commands
Jiri Denemark [Tue, 9 Nov 2010 09:27:09 +0000 (10:27 +0100)]
virsh: Add .xml suffix to tmp files used in *edit commands

This helps editors with detecting the temporary files as XML since the
temporary files do not contain <?xml ...?> declaration.

Requested by https://bugzilla.redhat.com/show_bug.cgi?id=602277

14 years agoSupport SPICE channel security options
Daniel P. Berrange [Fri, 9 Apr 2010 16:56:00 +0000 (17:56 +0100)]
Support SPICE channel security options

This extends the SPICE XML to allow channel security options

    <graphics type='spice' port='-1' tlsPort='-1' autoport='yes'>
      <channel name='main' mode='secure'/>
      <channel name='record' mode='insecure'/>
    </graphics>

Any non-specified channel uses the default, which allows both
secure & insecure usage

* src/conf/domain_conf.c, src/conf/domain_conf.h,
  src/libvirt_private.syms: Add XML syntax for specifying per
  channel security options for spice.
* src/qemu/qemu_conf.c: Configure channel security with spice

14 years agoSupport multiple QXL video cards
Daniel P. Berrange [Fri, 9 Apr 2010 16:26:06 +0000 (17:26 +0100)]
Support multiple QXL video cards

QEMU crashes & burns if you try multiple Cirrus video cards, but
QXL copes fine. Adapt QEMU config code to allow multiple QXL
video cards

* src/qemu/qemu_conf.c: Support multiple QXL video cards

14 years agoDefine XML syntax for password expiry
Daniel P. Berrange [Thu, 8 Apr 2010 12:43:23 +0000 (13:43 +0100)]
Define XML syntax for password expiry

This extends the XML syntax for <graphics> to allow a password
expiry time to be set

eg

  <graphics type='vnc' port='5900' autoport='yes' keymap='en-us' passwd='12345' passwdValidTo='2010-04-09T15:51:00'/>

The timestamp is in UTC.

* src/conf/domain_conf.h: Pull passwd out into separate struct
  virDomainGraphicsAuthDef to allow sharing between VNC & SPICE
* src/conf/domain_conf.c: Add parsing/formatting of new passwdValidTo
  argument
* src/opennebula/one_conf.c, src/qemu/qemu_conf.c, src/qemu/qemu_driver.c,
  src/xen/xend_internal.c, src/xen/xm_internal.c: Update for changed
  struct containing VNC password

14 years agoAdd SPICE support for QEMU driver configuration file
Daniel P. Berrange [Fri, 5 Mar 2010 20:31:50 +0000 (20:31 +0000)]
Add SPICE support for QEMU driver configuration file

In common with VNC, the QEMU driver configuration file is used
specify the host level TLS certificate location and a default
password / listen address

* src/qemu/qemu.conf: Add spice_listen, spice_tls,
  spice_tls_x509_cert_dir & spice_password config params
* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Parsing of
  spice config parameters and updating -spice arg generation
  to use them
* tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-rhel6.args,
  tests/qemuxml2argvtest.c: Expand test case to cover driver
  level configuration

14 years agoSupport automatic port number allocation for SPICE
Daniel P. Berrange [Fri, 5 Mar 2010 20:22:45 +0000 (20:22 +0000)]
Support automatic port number allocation for SPICE

* src/qemu/qemu_driver.c: Allocate the TCP ports for SPICE
  before starting guest

14 years agoImplement QEMU/KVM support for SPICE graphics
Daniel P. Berrange [Fri, 5 Mar 2010 20:18:52 +0000 (20:18 +0000)]
Implement QEMU/KVM support for SPICE graphics

This supports the -spice argument posted for review against
the latest upstream QEMU/KVM. This supports the bare minimum
config with port, TLS port & listen address. The x509 bits are
added in a later patch.

* src/qemu_conf.c, src/qemu_conf.h: Add SPICE flag. Check for
  -spice availability. Format -spice arg for command line
* qemuhelptest.c: Add SPICE flag
* qemuxml2argvdata/qemuxml2argv-graphics-spice.args: Add <graphics>
  for spice
* qemuxml2argvdata/qemuxml2argv-graphics-spice.xml: Add -spice arg
* qemuxml2argvtest.c: Add SPICE flag

14 years agoImplement QEMU/KVM QXL video card support in QEMU driver
Daniel P. Berrange [Fri, 5 Mar 2010 17:12:52 +0000 (17:12 +0000)]
Implement QEMU/KVM QXL video card support in QEMU driver

This supports the '-vga qxl' parameter in upstream QEMU/KVM
which has SPICE support added. This isn't particularly useful
until you get the next patch for -spice support. Also note that
while the libvirt XML supports multiple video devices, this
patch only supports a single one. A later patch can add support
for 2nd, 3rd, etc PCI devices for QXL

* src/qemu/qemu_conf.h: Flag for QXL support
* src/qemu/qemu_conf.c: Probe for '-vga qxl' support and implement it
* tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c,
  tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args,
  tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml: Test
  case for generating spice args with RHEL6 kvm

14 years agoAdd a <graphics> type for SPICE protocol
Daniel P. Berrange [Fri, 14 Aug 2009 09:54:14 +0000 (10:54 +0100)]
Add a <graphics> type for SPICE protocol

This adds an element

 <graphics type='spice' port='5903' tlsPort='5904' autoport='yes' listen='127.0.0.1'/>

This is the bare minimum that should be exposed in the guest
config for SPICE. Other parameters are better handled as per
host level configuration tunables

* docs/schemas/domain.rng: Define the SPICE <graphics> schema
* src/domain_conf.h, src/domain_conf.c: Add parsing and formatting
  for SPICE graphics config
* src/qemu_conf.c: Complain about unsupported graphics types

14 years agoAdd a QXL graphics card type to domain XML schema
Daniel P. Berrange [Wed, 8 Jul 2009 13:47:14 +0000 (14:47 +0100)]
Add a QXL graphics card type to domain XML schema

* src/qemu_conf.c: Add dummy entry in enumeration
* docs/schemas/domain.rng: Add 'qxl' as a type for the <video> tag
* src/domain_conf.c, src/domain_conf.h: Add QXL to video type
  enumerations

14 years agoShow compiled in options in virsh -V
Daniel Veillard [Mon, 8 Nov 2010 14:03:32 +0000 (15:03 +0100)]
Show compiled in options in virsh -V

  To ease debugging this trivial patch allows to find what was compiled
in in the local version of libvirt, this doesn't work for remote access
but that's probably sufficient. With the patch I get on my machine:

paphio:~/libvirt/tools -> ./virsh -V
Virsh command line tool of libvirt 0.8.4
See web site at http://libvirt.org/

Compiled with support for:
 Hypervisors: Xen QEmu/KVM UML OpenVZ LXC ESX PHYP Test
 Networking: Remote Daemon Network Bridging Netcf Nwfilter
 Storage: Dir Disk Filesystem SCSI Multipath iSCSI LVM
 Miscellaneous: SELinux Secrets Debug Readline
paphio:~/libvirt/tools ->

* tools/virsh.c: add -V option
* tools/virsh.pod: document the extension

14 years agomaint: Commit .gitignore sorting done by bootstrap
Jiri Denemark [Tue, 9 Nov 2010 10:45:14 +0000 (11:45 +0100)]
maint: Commit .gitignore sorting done by bootstrap

14 years agoqemu: Fix non-literal format string
Jiri Denemark [Tue, 9 Nov 2010 10:03:32 +0000 (11:03 +0100)]
qemu: Fix non-literal format string

14 years agoxen-proxy: Remove it entirely and use libvirtd instead
Matthias Bolte [Mon, 8 Nov 2010 16:32:02 +0000 (17:32 +0100)]
xen-proxy: Remove it entirely and use libvirtd instead

Suggested by danpb, as it's not up-to-date anymore and
lacks many functions that were added to libvirtd.

14 years agolxc: Exit on first error in lxcDomainGetMemoryParameters
Matthias Bolte [Sat, 6 Nov 2010 17:52:00 +0000 (18:52 +0100)]
lxc: Exit on first error in lxcDomainGetMemoryParameters

There is no point in trying to fill params beyond the first error,
because when lxcDomainGetMemoryParameters returns -1 then the caller
cannot detect which values in params are valid.

14 years agoAllow virDomainGetMemoryParameters on read-only connections
Matthias Bolte [Sat, 6 Nov 2010 17:49:07 +0000 (18:49 +0100)]
Allow virDomainGetMemoryParameters on read-only connections

Also fix a typo in the documentation of the function.

14 years agovirsh: fix incorrect help text mentioning non-existent network 'id'
Justin Clift [Mon, 8 Nov 2010 14:32:04 +0000 (01:32 +1100)]
virsh: fix incorrect help text mentioning non-existent network 'id'

14 years agoAdd a new test for sysinfo and smbios handling
Daniel Veillard [Fri, 5 Nov 2010 15:16:40 +0000 (16:16 +0100)]
Add a new test for sysinfo and smbios handling

14 years agoAdd sysinfo/smbios support to the QEmu driver
Daniel Veillard [Fri, 5 Nov 2010 14:44:57 +0000 (15:44 +0100)]
Add sysinfo/smbios support to the QEmu driver

The patch is based on the possiblity in the QEmu command line to
add -smbios options allowing to override the default values picked
by QEmu. We need to detect this first from QEmu help output.
If the domain is defined with smbios to be inherited from host
then we pass the values coming from the Host own SMBIOS, but
if the domain is defined with smbios to come from sysinfo, we
use the ones coming from the domain definition.

* src/qemu/qemu_conf.h: add the QEMUD_CMD_FLAG_SMBIOS_TYPE enum
  value
* src/qemu/qemu_conf.c: scan the help output for the smbios support,
  and if available add support based on the domain definitions,
  and host data
* tests/qemuhelptest.c: add the new enum in the outputs

14 years agoRead the host sysinfo for the QEmu driver
Daniel Veillard [Fri, 29 Oct 2010 12:18:29 +0000 (14:18 +0200)]
Read the host sysinfo for the QEmu driver

Read and store the data when initializing the driver.

14 years agoAdd a sysinfo util module and read host info API
Daniel Veillard [Fri, 5 Nov 2010 14:22:13 +0000 (15:22 +0100)]
Add a sysinfo util module and read host info API

Move existing routines about virSysinfoDef to an util module,
add a new entry point virSysinfoRead() to read the host values
with dmidecode

* src/conf/domain_conf.c src/conf/domain_conf.h src/util/sysinfo.c
  src/util/sysinfo.h: move to a new module, add virSysinfoRead()
* src/Makefile.am: handle the new module build
* src/libvirt_private.syms: new internal symbols
* include/libvirt/virterror.h src/util/virterror.c: defined a new
  error code for that module
* po/POTFILES.in: add new file for translations

14 years agoAdd smbios element to schema and configuration to HVM os
Daniel Veillard [Fri, 5 Nov 2010 13:10:34 +0000 (14:10 +0100)]
Add smbios element to schema and configuration to HVM os

the element has a mode attribute allowing only 3 values:
  - emulate: use the smbios emulation from the hypervisor
  - host: try to use the smbios values from the node
  - sysinfo: grab the values from the <sysinfo> fields

* docs/schemas/domain.rng: extend the schemas
* src/conf/domain_conf.h: add the flag to the domain config
* src/conf/domain_conf.h: parse and serialize the smbios if present

14 years agoSysinfo parsing and saving to/from configuration files
Daniel Veillard [Fri, 5 Nov 2010 10:45:44 +0000 (11:45 +0100)]
Sysinfo parsing and saving to/from configuration files

* src/conf/domain_conf.h: defines a new internal type added to the
  domain structure
* src/conf/domain_conf.c: parsing and serialization of that new type

14 years agoSysinfo extension to relax-ng schemas
Daniel Veillard [Sun, 24 Oct 2010 13:37:21 +0000 (15:37 +0200)]
Sysinfo extension to relax-ng schemas

Currently includes a subset of the SMBIOS strings set

14 years agoqemu: Remove redundant slash in save directory path
Matthias Bolte [Fri, 5 Nov 2010 18:35:25 +0000 (19:35 +0100)]
qemu: Remove redundant slash in save directory path

14 years agoImplement virsh qemu-monitor-command.
Chris Lalancette [Tue, 13 Apr 2010 18:08:59 +0000 (14:08 -0400)]
Implement virsh qemu-monitor-command.

Now that the virsh parsing has been revamped, we can
implement qemu-monitor-command.  This is basically the same
as it was in previous iterations, but has now been tested to
work both with the plain text monitor and the QMP monitor.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoFix off-by-1 in todo page generator
Daniel P. Berrange [Fri, 5 Nov 2010 13:24:04 +0000 (13:24 +0000)]
Fix off-by-1 in todo page generator

The todo.pl script had an off-by-1 which meant any category
with only a single bug would not appear

* docs/todo.pl: Fix off-by-1

14 years agomacvtap: libvirtd forgot macvtap dev name when restarted
Stefan Berger [Wed, 3 Nov 2010 11:26:29 +0000 (07:26 -0400)]
macvtap: libvirtd forgot macvtap dev name when restarted

During a shutdown/restart cycle libvirtd forgot the macvtap device name that it had created on behalf of a VM so that a stale macvtap device remained on the host when the VM terminated. Libvirtd has to actively tear down a macvtap device and it uses its name for identifying which device to tear down.

The solution is to not blank out the <target dev='...'/> completely, but only blank it out on VMs that are not active. So, if a VM is active, the device name makes it into the XML and is also being parsed. If a VM is not active, the device name is discarded.

14 years agotests: fix daemon-conf testing failure
Osier Yang [Wed, 3 Nov 2010 10:43:11 +0000 (11:43 +0100)]
tests: fix daemon-conf testing failure

libvirtd.conf uses "libvirt" as the value of "unix_sock_group",
however, group "libvirt" may not exist on the system, in this case
the case will always fail.

As a solution, replace "libvirt" with "$USER" in "tmp.conf".

14 years agoFix virPipeReadUntilEOF on more than 1024 bytes of data
Daniel Veillard [Wed, 3 Nov 2010 07:43:43 +0000 (08:43 +0100)]
Fix virPipeReadUntilEOF on more than 1024 bytes of data

virPipeReadUntilEOF is used to read the stdout of exec'ed
and this could fail to capture the full output and read only
1024 bytes.
  The problem is that this is based on a poll loop, and in the
loop we read at most 1024 bytes per file descriptor, but we also
note in the loop if poll indicates that the process won't output
more than that on that fd by setting finished[i] = 1.
  The simplest way is that if we read a full buffer make sure
finished[i] is still 0 because we will need another pass in the
loop.

14 years agovirterror: supply missing spaces
Eric Blake [Tue, 2 Nov 2010 21:34:33 +0000 (15:34 -0600)]
virterror: supply missing spaces

* src/util/virterror.c (virErrorDomainName): Always supply
trailing space if category was present.

14 years agoxen: work with xen 4.0.1 headers
Eric Blake [Mon, 1 Nov 2010 20:02:55 +0000 (14:02 -0600)]
xen: work with xen 4.0.1 headers

* src/xen/xen_driver.h (includes): Include main xen headers
here...
* src/xen/xs_internal.c (includes): ...rather than in just one of
the sub-drivers.

14 years agoFix build with polkit 0
Jim Fehlig [Mon, 1 Nov 2010 23:50:32 +0000 (17:50 -0600)]
Fix build with polkit 0

Commit e8066d53 broke the build with polkit0:

remote.c: In function 'remoteDispatchAuthPolkit':
remote.c:4177: error: 'rv' undeclared (first use in this function)

Add missing identifier.

14 years agoChange calling conventions in remote driver client internals
Daniel P. Berrange [Fri, 23 Jul 2010 11:05:46 +0000 (12:05 +0100)]
Change calling conventions in remote driver client internals

The remoteIO() method has wierd calling conventions, where
it is passed a pre-allocated 'struct remote_call *' but
then free()s it itself, instead of letting the caller free().
This fixes those weird semantics

* src/remote/remote_driver.c: Sanitize semantics of remoteIO
  method wrt to memory release

14 years agoFix comment for <video> tag in domain RNG schema
Daniel P. Berrange [Mon, 12 Apr 2010 17:16:38 +0000 (18:16 +0100)]
Fix comment for <video> tag in domain RNG schema

The comment for the <video> tag was a cut+paste error duplicating
info about the <graphics> tag

* docs/schemas/domain.rng: Fix comment for <video> tag

14 years agoMisc error handling fixes in text mode monitor commands
Daniel P. Berrange [Mon, 1 Nov 2010 17:09:31 +0000 (13:09 -0400)]
Misc error handling fixes in text mode monitor commands

A couple of places in the text monitor were overwriting the
'ret' variable with a >= 0 value before success was actually
determined. So later error paths would not correctly return
the -1 value. The drive_add code was not checking for errors
like missing command

* src/qemu/qemu_monitor_text.c: Misc error handling fixes

14 years agoIgnore open failures when relabelling disk images
Daniel P. Berrange [Fri, 29 Oct 2010 11:23:56 +0000 (12:23 +0100)]
Ignore open failures when relabelling disk images

NFS in root squash mode may prevent opening disk images to
determine backing store. Ignore errors in this scenario.

* src/security/security_selinux.c: Ignore open failures on disk
  images

14 years agoTreat failure to relabel stdin_path as non-fatal on NFS
Daniel P. Berrange [Fri, 29 Oct 2010 11:20:40 +0000 (12:20 +0100)]
Treat failure to relabel stdin_path as non-fatal on NFS

NFS does not support file labelling, so ignore this error
for stdin_path when on NFS.

* src/security/security_selinux.c: Ignore failures on labelling
  stdin_path on NFS
* src/util/storage_file.c, src/util/storage_file.h: Refine
  virStorageFileIsSharedFS() to allow it to check for a
  specific FS type.

14 years agoRevert commit 06f81c63ebc19cb0e51f9b397991f6d6ae56d090
Daniel P. Berrange [Fri, 29 Oct 2010 10:47:20 +0000 (11:47 +0100)]
Revert commit 06f81c63ebc19cb0e51f9b397991f6d6ae56d090

Commit 06f81c63ebc19cb0e51f9b397991f6d6ae56d090 attempted to make
QEMU driver ignore the failure to relabel 'stdin_path' if it was
on NFS. The actual result was that it ignores *all* failures to
label any aspect of the VM, unless stdin_path is non-NULL and
is not on NFS.

* src/qemu/qemu_driver.c: Treat all relabel failures as terminal

14 years agoFix several warnings about a non-literal format string
Jiri Denemark [Tue, 2 Nov 2010 08:47:22 +0000 (09:47 +0100)]
Fix several warnings about a non-literal format string

They only popped up during --disable-nls build. Without this configure
option, gcc wasn't able to detect them.

14 years agoutil: Add helper function to build timestamp string
Osier Yang [Mon, 1 Nov 2010 04:17:14 +0000 (12:17 +0800)]
util: Add helper function to build timestamp string

* src/util/util.h
* src/util/util.c
* src/libvirt_private.syms

14 years agodocs: fix typo
Eric Blake [Mon, 1 Nov 2010 20:57:18 +0000 (14:57 -0600)]
docs: fix typo

* docs/drvqemu.html.in (qemu): Fix typo.

14 years agobuild: avoid compiler warning in xen code
Eric Blake [Mon, 1 Nov 2010 18:18:06 +0000 (12:18 -0600)]
build: avoid compiler warning in xen code

* src/xen/xend_internal.c (xenDaemonFormatSxpr): Hoist verify
outside of function to avoid a -Wnested-externs warning.
* src/xen/xm_internal.c (xenXMDomainConfigFormat): Likewise.
Reported by Daniel P. Berrange.

14 years agomisc: encode the Emacs suggstions from HACKING into a .dir-locals.el file
Diego Elio Pettenò [Mon, 1 Nov 2010 11:03:17 +0000 (12:03 +0100)]
misc: encode the Emacs suggstions from HACKING into a .dir-locals.el file

With this file in place, opening any source file in libvirt will set up
Emacs for proper indentation.

14 years agoqemu: add the USB devices to the cgroup whitelist
Diego Elio Pettenò [Mon, 1 Nov 2010 11:03:16 +0000 (12:03 +0100)]
qemu: add the USB devices to the cgroup whitelist

Make sure that the QEmu process within the cgroup can access the device
file for the USB device that has to be connected to the virtual domain.

14 years agoxen: work with ia64 MAX_VIRT_CPUS of 64
Eric Blake [Fri, 29 Oct 2010 16:51:01 +0000 (10:51 -0600)]
xen: work with ia64 MAX_VIRT_CPUS of 64

* src/xen/xen_hypervisor.c (MAX_VIRT_CPUS): Move...
* src/xen/xen_driver.h (MAX_VIRT_CPUS): ...so all xen code can see
same value.
* src/xen/xend_internal.c (sexpr_to_xend_domain_info)
(xenDaemonDomainGetVcpusFlags, xenDaemonParseSxpr)
(xenDaemonFormatSxpr): Work if MAX_VIRT_CPUS is 64 on a platform
where long is 64-bits.
* src/xen/xm_internal.c (xenXMDomainConfigParse)
(xenXMDomainConfigFormat): Likewise.

14 years agobuild: cleanup declaration of xen tests.
Diego Elio Pettenò [Fri, 29 Oct 2010 16:30:50 +0000 (18:30 +0200)]
build: cleanup declaration of xen tests.

Only build statstest and reconnect if they should be used, so add them
behind the ENABLE_XEN_TESTS conditional.

14 years agoqemu: check compression program availability of virsh save and dump
KAMEZAWA Hiroyuki [Thu, 28 Oct 2010 08:51:18 +0000 (17:51 +0900)]
qemu: check compression program availability of virsh save and dump

14 years agoadd compression support for "virsh dump"
KAMEZAWA Hiroyuki [Thu, 28 Oct 2010 07:31:46 +0000 (16:31 +0900)]
add compression support for "virsh dump"

Add dump_image_format[] to qemu.conf and support compressed dump
at virsh dump. coredump compression is important for saving disk space
in an environment where multiple guests run.

In general, "disk space for dump" is specially allocated and will be
a dead space in the system. It's used only at emergency. So, it's better
to have both of save_image_format and dump_image_format. "save" is done
in scheduled manner with enough calculated disk space for it.

This code reuses some of save_image_format[] and supports the same format.

Changelog:
 - modified libvirtd_qemu.aug
 - modified test_libvirtd_qemu.aug
 - fixed error handling of qemudSaveCompressionTypeFromString()

14 years agoqemu_driver: add virCgroupMounted
Lai Jiangshan [Fri, 29 Oct 2010 09:32:16 +0000 (17:32 +0800)]
qemu_driver: add virCgroupMounted

When we mount any cgroup without "-o devices", we will fail to start vms:

error: Failed to start domain vm1
error: Unable to deny all devices for vm1: No such file or directory

When we mount any cgroup without "-o cpu", we will fail to get schedinfo:
Scheduler      : posix
error: unable to get cpu shares tunable: No such file or directory

We should only use the cgroup controllers which are mounted on host.
So I add virCgroupMounted() for qemuCgroupControllerActive()

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
14 years agoRelease of libvirt-0.8.5
Daniel Veillard [Fri, 29 Oct 2010 14:50:33 +0000 (16:50 +0200)]
Release of libvirt-0.8.5

* configure.ac libvirt.spec.in: new version
* docs/news.html.in: update news page and improve format
* po/*.po*: Update po again

14 years agoUpdating localization and regenerating before release
Daniel Veillard [Fri, 29 Oct 2010 13:46:52 +0000 (15:46 +0200)]
Updating localization and regenerating before release

14 years agovbox: Don't warn when the linker search path doesn't contain VBoxXPCOMC.so
Matthias Bolte [Fri, 29 Oct 2010 14:31:29 +0000 (16:31 +0200)]
vbox: Don't warn when the linker search path doesn't contain VBoxXPCOMC.so

This is actually a workaround, to unbreak make check on systems
without VirtualBox.

14 years agovbox: Stop hardcoding a single path for VBoxXPCOMC.so
Matthias Bolte [Fri, 22 Oct 2010 19:25:03 +0000 (21:25 +0200)]
vbox: Stop hardcoding a single path for VBoxXPCOMC.so

This partly reverts df90ca7661b0a789bd790ccf8258a4527c13eb8d.

Don't disable the VirtualBox driver when configure can't find
VBoxXPCOMC.so, rely on detection at runtime again instead.

Keep --with-vbox=/path/to/virtualbox intact, added to for:
https://bugzilla.redhat.com/show_bug.cgi?id=609185

Detection order for VBoxXPCOMC.so:

1. VBOX_APP_HOME environment variable
2. configure provided location
3. hardcoded list of known locations
4. dynamic linker search path

Also cleanup the glue code and improve error reporting.

14 years agovirsh: improve the help description for managedsave and start
Justin Clift [Fri, 29 Oct 2010 00:50:15 +0000 (11:50 +1100)]
virsh: improve the help description for managedsave and start

Updated the descriptions for managedsave and start in virsh and
the virsh man page, and also for managedsave-remove in the virsh
man page.

14 years agoaudit: printf warning fix
KAMEZAWA Hiroyuki [Thu, 28 Oct 2010 10:24:32 +0000 (19:24 +0900)]
audit: printf warning fix

fix warning
  CC     libvirt_util_la-virtaudit.lo
cc1: warnings being treated as errors
util/virtaudit.c: In function 'virAuditEncode':
util/virtaudit.c:146: error: implicit declaration of function 'virAsprintf' [-Wimplicit-function-declaration]
util/virtaudit.c:146: error: nested extern declaration of 'virAsprintf' [-Wnested-externs]

14 years agoeliminate possibility of a double-closed file descriptor
Stefan Berger [Thu, 28 Oct 2010 15:43:16 +0000 (11:43 -0400)]
eliminate possibility of a double-closed file descriptor

The 2nd and 3rd hunk show the only double-closed file descriptor code part that I found while trying to clean up close(). The first hunk seems a harmless cleanup in that same file.

14 years agoqemu: check for vm after starting a job
Eric Blake [Tue, 26 Oct 2010 15:31:19 +0000 (09:31 -0600)]
qemu: check for vm after starting a job

https://bugzilla.redhat.com/show_bug.cgi?id=638285 - when migrating
a guest, it was very easy to provoke a race where an application
could query block information on a VM that had just been migrated
away.  Any time qemu code obtains a job lock, it must also check
that the VM was not taken down in the time where it was waiting
for the lock.

* src/qemu/qemu_driver.c (qemudDomainSetMemory)
(qemudDomainGetInfo, qemuDomainGetBlockInfo): Check that vm still
exists after obtaining job lock, before starting monitor action.

14 years agoOnly attempt removal of the rule allowing tftp if it was added
Laine Stump [Thu, 28 Oct 2010 02:45:43 +0000 (22:45 -0400)]
Only attempt removal of the rule allowing tftp if it was added

During virtual network startup, the iptables rule that allows tftp
traffic is only added if network->def->tftproot is non-empty, but when
the virtual network is destroyed, we had been unconditionally trying
to delete the rule. This was harmless, except that it created a bogus
error message.

This patch conditionalizes the delete command in the same manner that
the insert command is already conditionalized.

14 years agodocs: updated the C# bindings page with arnauds latest changes
Justin Clift [Thu, 28 Oct 2010 08:02:09 +0000 (19:02 +1100)]
docs: updated the C# bindings page with arnauds latest changes

14 years agodocs: update ruby bindings maintainer to chris lalancette
Justin Clift [Wed, 27 Oct 2010 22:34:04 +0000 (09:34 +1100)]
docs: update ruby bindings maintainer to chris lalancette

14 years agobuild: use shorter file names for 'make dist'
Eric Blake [Wed, 27 Oct 2010 14:12:02 +0000 (08:12 -0600)]
build: use shorter file names for 'make dist'

* docs/api_extension/{0013,0014}*.patch: Rename to shorter files.
* docs/api_extension.html.in: Reflect rename.

14 years agodocs: reworded and reordered the bindings page, plus minor tweaks
Justin Clift [Wed, 27 Oct 2010 03:17:38 +0000 (14:17 +1100)]
docs: reworded and reordered the bindings page, plus minor tweaks

Reordered the bindings into alphabetical order, added a link to
the php-libvirt source on Github, plus gave the direct package
names needed for Python usage on RHEL/Fedora, and Ubuntu.

14 years agomingw: Add body for virFork and remove double virDriverLoadModule export
Matthias Bolte [Wed, 27 Oct 2010 09:25:23 +0000 (11:25 +0200)]
mingw: Add body for virFork and remove double virDriverLoadModule export

Commit 9bd3cce0d2d54e6ab893bb8137218b83d9294714 added virFork and
virDriverLoadModule to libvirt_private.syms, but virFork didn't have
a body on Win32 and virDriverLoadModule was already correctly
exported conditional via libvirt_driver_modules.syms.

14 years agoAdd disk/net resource auditing to QEMU driver
Daniel P. Berrange [Mon, 25 Oct 2010 13:08:39 +0000 (14:08 +0100)]
Add disk/net resource auditing to QEMU driver

Add auditing of all initial disk/net assignments to QEMU guests
at startup. Add auditing for all hotplug & unplug events and
disk media changes.

* src/qemu/qemu_driver.c: Add disk/net resource auditing

14 years agoAdd auditing of security label in QEMU driver
Daniel P. Berrange [Wed, 27 Oct 2010 10:52:24 +0000 (11:52 +0100)]
Add auditing of security label in QEMU driver

Add auditing of the allocated security label in the QEMU driver
VM startup code

* src/qemu/qemu_driver.c: Audit security label

14 years agoAdd auditing of start/stop events to the QEMU driver
Daniel P. Berrange [Tue, 26 Oct 2010 16:34:16 +0000 (17:34 +0100)]
Add auditing of start/stop events to the QEMU driver

Add audit hooks to report all start and stop events on QEMU
guest domains.

* src/qemu/qemu_driver.c: Audit start/stop events

14 years agoAdd printf format attribute annotation to virAuditSend method
Daniel P. Berrange [Tue, 26 Oct 2010 17:02:08 +0000 (18:02 +0100)]
Add printf format attribute annotation to virAuditSend method

* src/util/virtaudit.h: Add printf format attribute annotation

14 years agoAdd audit helper for escaping log message strings
Daniel P. Berrange [Wed, 27 Oct 2010 10:53:48 +0000 (11:53 +0100)]
Add audit helper for escaping log message strings

Add a helper API for ecscaping the value in audit log
messages

* src/util/virtaudit.h, src/util/virtaudit.c,
  src/libvirt_private.syms: Add virAuditEncode

14 years agoRemove audit hooks from the selinux security driver code
Daniel P. Berrange [Wed, 27 Oct 2010 10:01:27 +0000 (11:01 +0100)]
Remove audit hooks from the selinux security driver code

This reverts commit b8e2de8899594edcd78b3a7cb1b39b89bbed2891
The hooks will be re-added in the QEMU driver itself.

* src/security/security_selinux.c: Remove audit hooks

14 years agoRemove all auditing hooks from libvirtd dispatch code
Daniel P. Berrange [Tue, 26 Oct 2010 15:19:13 +0000 (16:19 +0100)]
Remove all auditing hooks from libvirtd dispatch code

Revert most of commit a8b5f9bd27d65c2ced064b9267ca31dee7ad9c86.
The audit hooks will be re-added directly in the QEMU driver code
in a future commit

* daemon/remote.c: Remove all audit logging hooks
* src/qemu/qemu_driver.c: Remove all audit logging hooks

14 years agoFix xen API documentation
Philipp Hahn [Wed, 27 Oct 2010 13:25:39 +0000 (15:25 +0200)]
Fix xen API documentation

*src/xen/xend_internal.c: fix a couple of comments in function descriptions

14 years agodocs: added a table of contents to the first 11 docs files
Justin Clift [Sat, 23 Oct 2010 21:46:32 +0000 (08:46 +1100)]
docs: added a table of contents to the first 11 docs files

There are a 58 docs files, so adding an autogenerated Table Of
Contents to them all will take some time.  This is the first
piece of the work done.

14 years agodocs: reformated the bindings page html markup to match other pages
Justin Clift [Sat, 23 Oct 2010 21:06:01 +0000 (08:06 +1100)]
docs: reformated the bindings page html markup to match other pages

14 years agovirsh: use - not _ in memtune option names
Eric Blake [Tue, 26 Oct 2010 17:51:37 +0000 (11:51 -0600)]
virsh: use - not _ in memtune option names

* tools/virsh.c (opts_memtune): All other options in virsh use -
for separating words.

14 years agobuild: fix shell detection bug
Eric Blake [Tue, 26 Oct 2010 16:37:06 +0000 (10:37 -0600)]
build: fix shell detection bug

A missing shell was noisy, and the use of command to decipher a
shell's absolute path requires "" rather than ''.

* configure.ac (lv_cv_wrapper_shell): Fix logic errors if candidate
shell is not available.
* .gitignore: Ignore file created when /bin/sh is old dash.
Reported by Matthias Bolte.

14 years agomaint: fix syntax-check failure of previous patch
Eric Blake [Tue, 26 Oct 2010 21:50:19 +0000 (15:50 -0600)]
maint: fix syntax-check failure of previous patch

* cfg.mk (sc_prohibit_trailing_blank_lines): Delete; this is
adequately covered by maint.mk's sc_prohibit_empty_lines_at_EOF.
* .x-sc_prohibit_empty_lines_at_EOF: New file, to exempt raw
patches.
* Makefile.am (EXTRA_DIST): Include new exemption.

14 years agodocs: revamp api_extension example, using vcpu patch series
Eric Blake [Wed, 20 Oct 2010 16:04:19 +0000 (10:04 -0600)]
docs: revamp api_extension example, using vcpu patch series

* docs/api_extension/*: Replace example files.
* docs/api_extension.html.in: Rewrite to match new example files.

14 years agoqemu: don't use %.3d format for bus/addr of USB devices
Diego Elio Pettenò [Tue, 26 Oct 2010 12:45:03 +0000 (14:45 +0200)]
qemu: don't use %.3d format for bus/addr of USB devices

When using 0-prefixed numbers, QEmu will interpret them as octal numbers
(as C convention says); this means that if you attach a device that has
addr > 10 (decimal) you're going to attach a different device.

14 years agovirsh: fix range of memtune command
Eric Blake [Tue, 19 Oct 2010 16:44:31 +0000 (10:44 -0600)]
virsh: fix range of memtune command

* tools/virsh.c (cmdMemtune): Use long long for memory
sizes. Simplify allocation, and plug memory leak.

14 years agovirsh: improve help text where integers are expected
Eric Blake [Tue, 19 Oct 2010 16:27:02 +0000 (10:27 -0600)]
virsh: improve help text where integers are expected

* tools/virsh.c (opts_freecell, opts_memtune, opts_vcpupin)
(opts_setvcpus, opts_setmaxmem, opts_setmem)
(opts_migrate_setmaxdowntime): Use VSH_OT_INT when only an integer
is expected.
(vshCmddefHelp, vshCmddefGetData): Allow mandatory VSH_OT_INT
arguments.

14 years agoqemu: work around dash 0.5.5 bug in managed save
Eric Blake [Fri, 22 Oct 2010 23:26:08 +0000 (17:26 -0600)]
qemu: work around dash 0.5.5 bug in managed save

Older dash mistakenly truncates regular files when using <> redirection;
this kills our use of double dd to reduce storage overhead when
saving qemu images.  But qemu insists on running a command through
/bin/sh, so we work around it by having qemu run $sh -c 'real command'
when we have a replacement $sh in mind.

* configure.ac (VIR_WRAPPER_SHELL): Define to a replacement shell,
if /bin/sh is broken on <> redirection.
* src/qemu/qemu_monitor.h (VIR_WRAPPER_SHELL_PREFIX)
(VIR_WRAPPER_SHELL_SUFFIX): New macros.
* src/qemu/qemu_monitor_text.c (qemuMonitorTextMigrateToFile): Use
them.
* src/qemu/qemu_monitor_json.c (qemuMonitorJSONMigrateToFile):
Likewise.

14 years agodocs: make the location of the xml catalog file a configure option
Justin Clift [Tue, 26 Oct 2010 15:07:00 +0000 (02:07 +1100)]
docs: make the location of the xml catalog file a configure option

The default location for the XML catalog file, /etc/xml/catalog,
used when validating the generated html docs, isn't correct for
MacOS X.

This commit adds an option to the configure script, allowing the
default to be overridden:

  --with-xml-catalog-file=/path/to/xml/catalog/file

14 years agoAvoid squashing errors during network startup cleanup path
Daniel P. Berrange [Tue, 26 Oct 2010 10:17:25 +0000 (11:17 +0100)]
Avoid squashing errors during network startup cleanup path

When failing to start a virtual network, we have to cleanup,
tearing down any iptables rules. If the iptables rules were
not present yet though, this raises an error, which squashes
the original error we were handling.

* src/network/bridge_driver.c: When failing to start a virtual
  network, don't squash the original error in cleanup