]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
15 years agoAdd a missing break statement to nwfilter errors.
Chris Lalancette [Wed, 31 Mar 2010 20:34:04 +0000 (16:34 -0400)]
Add a missing break statement to nwfilter errors.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoMake virDomainLoadConfig static.
Chris Lalancette [Wed, 31 Mar 2010 20:25:41 +0000 (16:25 -0400)]
Make virDomainLoadConfig static.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoVBox: Fix use of uninitialized value
Jiri Denemark [Wed, 31 Mar 2010 08:39:48 +0000 (10:39 +0200)]
VBox: Fix use of uninitialized value

15 years agoChanges to clock timer XML to match final design.
Laine Stump [Wed, 31 Mar 2010 17:03:54 +0000 (13:03 -0400)]
Changes to clock timer XML to match final design.

The clock timer XML is being updated in the following ways (based on
further off-list discussion that was missed during the initial
implementation):

1) 'wallclock' is changed to 'track', and the possible values are 'boot'
 (corresponds to old 'host'), 'guest', and 'wall'.

2) 'mode' has an additional value 'smpsafe'

3) when tickpolicy='catchup', there can be an optional sub-element of
   timer called 'catchup':

   <catchup threshold=123 slew=120 limit=10000/>

Those three values are all longs, always optional, and if they are present,
they are positive. Internally, 0 indicates "unspecified".

* docs/schemas/domain.rng: updated RNG definition to account for changes

* src/conf/domain_conf.h: change the C struct and enums to match changes.

* src/conf/domain_conf.c: timer parse and format functions changed to
                          handle the new selections and new element.

* src/libvirt_private.syms: *TimerWallclock* changes to *TimerTrack*

* src/qemu/qemu_conf.c: again, account for Wallclock --> Track change.

15 years agoAllow domain disk images on root-squash NFS to coexist with security driver.
Laine Stump [Thu, 1 Apr 2010 15:58:34 +0000 (11:58 -0400)]
Allow domain disk images on root-squash NFS to coexist with security driver.

(suggested by Daniel Berrange, tested by Dan Kenigsberg)

virStorageFileGetMetadata will fail for disk images that are stored on
a root-squash NFS share that isn't world-readable.
SELinuxSetSecurityImageLabel is called during the startup of every
domain (as long as security_driver != "none"), and it will propogate
the error from virStorageFileGetMetadata, causing the domain startup
to fail. This is, however, a common scenario when qemu is run as a
non-root user and the disk image is stored on NFS.

Ignoring this failure (which doesn't matter in this case, since the
next thing done by SELinuxSetSecurityImageLabel - setting the file
context - will also fail (and that function already ignores failures
due to root-squash NFS) will allow us to continue bringing up the
domain. The result is that we don't need to disable the entire
security driver just because a domain's disk image is stored on
root-squashed NFS.

15 years agoEliminate compile warnings in nwfilter error log calls
Laine Stump [Wed, 31 Mar 2010 04:13:42 +0000 (00:13 -0400)]
Eliminate compile warnings in nwfilter error log calls

15 years agoDon't use virFileReadLimFD in qemuDomainRestore.
Chris Lalancette [Tue, 23 Mar 2010 13:11:29 +0000 (09:11 -0400)]
Don't use virFileReadLimFD in qemuDomainRestore.

virFileReadLimFD is a poor fit for reading the header
of the restore file.  The problem is that virFileReadLimFD
returns an error when there is more data after the amount
you ask to read, but that is *expected* in this case.

This patch is essentially a revert of
1a4d5c9543641c444dccd682f6256ee3faf22a80, but I don't think
that commit does what it says anyway.  It purports to prevent
an unwarranted OOM error, but since virFileReadLimFD will
allocate memory up to the maximum anyway, the upper limit
on the total amount of memory allocated is the same for either
the old version or the new version.  Since the old saferead
actually works and virFileReadLimFD does not, revert to
using saferead.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoOnly parse 'CPU XML' in virCPUDefParseXML()
Jim Fehlig [Wed, 31 Mar 2010 23:02:57 +0000 (17:02 -0600)]
Only parse 'CPU XML' in virCPUDefParseXML()

Received report of user crashing libvirtd with

virsh capabilities > capabilities.xml
virsh cpu-compare capabilities.xml

While user has been informed about proper usage of cpu-compare,
segfaulting libvirt should be avoided.

Do not parse CPU definition in virCPUDefParseXML() if XML is not
a 'cpu' node.

15 years agoKeep build quiet for generated file
Daniel P. Berrange [Wed, 31 Mar 2010 12:10:08 +0000 (13:10 +0100)]
Keep build quiet for generated file

Adds $(AM_V_GEN) to many more manual makefile.am rules that
were generating files

15 years agoKeep track of guest paused state after disk IO / watchdog events
Daniel P. Berrange [Tue, 16 Feb 2010 12:07:49 +0000 (12:07 +0000)]
Keep track of guest paused state after disk IO / watchdog events

When a watchdog/IO error occurs, one of the possible actions that
QEMU might take is to pause the guest. In this scenario libvirt
needs to update its internal state for the VM, and emit a
lifecycle event:

  VIR_DOMAIN_EVENT_SUSPENDED

with a detail being one of:

  VIR_DOMAIN_EVENT_SUSPENDED_IOERROR
  VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG

To future proof against possible QEMU support for multiple monitor
consoles, this patch also hooks into the 'STOPPED' event in QEMU
and emits a generic VIR_DOMAIN_EVENT_SUSPENDED_PAUSED event

* include/libvirt/libvirt.h.in: Add VIR_DOMAIN_EVENT_SUSPENDED_IOERROR
* src/qemu/qemu_driver.c: Update VM state to paused when IO error
  or watchdog events occurrs
* src/qemu/qemu_monitor_json.c: Fix typo in disk IO event name

15 years agoReplace sscanf in PCI device address parsing
Matthias Bolte [Tue, 30 Mar 2010 15:31:19 +0000 (17:31 +0200)]
Replace sscanf in PCI device address parsing

This also fixes a problem with MinGW's GCC on Windows. GCC complains
about the L modifier being unknown.

Parsing in pciIterDevices is stricter now and doesn't accept trailing
characters after the actual <domain>:<bus>:<slot>.<function> sequence
anymore.

Parsing in pciWaitForDeviceCleanup is also stricter now and expects
the <start>-<end> : <domain>:<bus>:<slot>.<function> sequence to be
terminated by \n.

Change domain from unsigned long long to unsigned int in
pciWaitForDeviceCleanup, because everywhere else domain is handled as
unsigned int too.

15 years agoxen: Use virStrToLong_i instead of sscanf for XenD port parsing
Matthias Bolte [Tue, 30 Mar 2010 14:52:42 +0000 (16:52 +0200)]
xen: Use virStrToLong_i instead of sscanf for XenD port parsing

Parsing is stricter now and doesn't accept trailing characters
after the actual value anymore.

15 years agoxenapi: Use virStrToLong_i instead of sscanf for CPU map parsing
Matthias Bolte [Tue, 30 Mar 2010 14:51:04 +0000 (16:51 +0200)]
xenapi: Use virStrToLong_i instead of sscanf for CPU map parsing

Parsing is stricter now and doesn't accept trailing characters
after the actual value anymore.

15 years agoopenvz: Use strtok_r instead of sscanf for VPS UUID parsing
Matthias Bolte [Tue, 30 Mar 2010 14:34:43 +0000 (16:34 +0200)]
openvz: Use strtok_r instead of sscanf for VPS UUID parsing

Also free 2k stack space.

15 years agoxen: Use virParseMacAddr instead of sscanf
Matthias Bolte [Tue, 30 Mar 2010 14:29:53 +0000 (16:29 +0200)]
xen: Use virParseMacAddr instead of sscanf

This also fixes a bug in xenXMDomainConfigParse where uninitialized
memory would be used as MAC address if sscanf fails.

15 years agovbox: Replace atoi with virStrToLong_i
Matthias Bolte [Tue, 30 Mar 2010 14:27:20 +0000 (16:27 +0200)]
vbox: Replace atoi with virStrToLong_i

Parsing is stricter now and doesn't accept trailing characters
after the actual value or non-number strings anymore. atoi just
returns 0 in case it cannot parse a number from the given string.
Now an error is reported for such a string.

15 years agocgroup: Replace sscanf with virStrToLong_ll
Matthias Bolte [Tue, 30 Mar 2010 14:20:41 +0000 (16:20 +0200)]
cgroup: Replace sscanf with virStrToLong_ll

The switch from %lli to %lld in virCgroupGetValueI64 is intended,
as virCgroupGetValueU64 uses base 10 too, and virCgroupSetValueI64
uses %lld to format the number to string.

Parsing is stricter now and doesn't accept trailing characters
after the actual value anymore.

15 years agoRefactor major.minor.micro version parsing into a function
Matthias Bolte [Tue, 30 Mar 2010 14:15:13 +0000 (16:15 +0200)]
Refactor major.minor.micro version parsing into a function

virParseVersionString uses virStrToLong_ui instead of sscanf.

This also fixes a bug in the UML driver, that always returned 0
as version number.

Introduce STRSKIP to check if a string has a certain prefix and
to skip this prefix.

15 years agoReplace sscanf in nwfilter rule parsing
Matthias Bolte [Tue, 30 Mar 2010 13:47:59 +0000 (15:47 +0200)]
Replace sscanf in nwfilter rule parsing

Parsing is stricter now and doesn't accept trailing characters
after the actual value anymore.

15 years agoReplace sscanf in legacy device address parsing
Matthias Bolte [Tue, 30 Mar 2010 13:45:53 +0000 (15:45 +0200)]
Replace sscanf in legacy device address parsing

Parsing is stricter now and doesn't accept trailing characters
after the actual <domain>:<bus>:<slot> sequence anymore.

15 years agoWhile writing a couple of test cases for the nwfilter's XML parser I
Stefan Berger [Thu, 1 Apr 2010 10:37:26 +0000 (06:37 -0400)]
While writing a couple of test cases for the nwfilter's XML parser I
found some cases where the output ended up not looking as expected. So
the following changes are in the patch below:

- if the protocol ID in the MAC header is an integer, just write it into
the datastructure without trying to find a corresponding string for it
and if none is found failing
- when writing the protocol ID as string, simply write it as integer if
no corresponding string can be found
- same changes for arpOpcode parsing and printing
- same changes for protocol ID in an IP packet
- DSCP value needs to be written into the data structure
- IP protocol version number is redundant at this level, so remove it
- parse the protocol ID found inside an IP packet not only as string but
also as uint8
- arrange the display of the src and destination masks to be shown after
the src and destination ip address respectively in the XML
- the existing libvirt IP address parser accepts for example '25' as an
IP address. I want this to be parsed as a CIDR type netmask. So try to
parse it as an integer first (CIDR netmask) and if that doesn't work as
a dotted IP address style netmask.
- instantiation of rules with MAC masks didn't work because they weren't
printed into a buffer, yet.

15 years agoESX test case needs '/' in interface name
Stefan Berger [Wed, 31 Mar 2010 14:43:00 +0000 (10:43 -0400)]
ESX test case needs '/' in interface name

To fix an ESX test case, valid interface names need '/' as valid letter.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
15 years agoFix linker errors in proxy
Matthias Bolte [Wed, 31 Mar 2010 20:29:42 +0000 (22:29 +0200)]
Fix linker errors in proxy

domain_conf.c:494: undefined reference to 'virNWFilterHashTableFree'
domain_conf.c:5107: undefined reference to 'virNWFilterFormatParamAttributes'

Add missing source to the proxy and disable XML parsing code in
nwfilter_params.c for a proxy build.

15 years agobuild: more fallout from test -a
Eric Blake [Wed, 31 Mar 2010 20:58:40 +0000 (14:58 -0600)]
build: more fallout from test -a

* cfg.mk (sc_prohibit_test_minus_ao): Also check for [.
* docs/Makefile.am (%.html, html/index.html): Avoid non-portable
test usage.
* libvirt.spec.in (%post): Likewise.
* tools/virt-pki-validate.in (servercert.pem): Likewise.
* configure.ac (LOGNAME): Use test, not [, in files processed by
autoconf.
Detected by Matthias Bolte.

15 years agoFix apibuild.py warning about virNWFilterLookupByUUIDString
Matthias Bolte [Wed, 31 Mar 2010 16:10:08 +0000 (18:10 +0200)]
Fix apibuild.py warning about virNWFilterLookupByUUIDString

The function name was written with capital I in the Filter part.

15 years agowebsite: Add archive link for libvirt-users list
Matthias Bolte [Wed, 31 Mar 2010 16:06:20 +0000 (18:06 +0200)]
website: Add archive link for libvirt-users list

15 years agomaint: remove redundant tests after virStrToLong
Eric Blake [Tue, 30 Mar 2010 21:07:24 +0000 (15:07 -0600)]
maint: remove redundant tests after virStrToLong

virStrToLong* guarantees (via strtol) that the end pointer will be set
to the point at which parsing stopped (even on failure, this point is
the start of the input string).

* src/esx/esx_driver.c (esxGetVersion): Remove pointless
conditional.
* src/qemu/qemu_conf.c (qemuParseCommandLinePCI)
(qemuParseCommandLineUSB, qemuParseCommandLineSmp): Likewise.
* src/qemu/qemu_monitor_text.c
(qemuMonitorTextGetMigrationStatus): Likewise.

15 years agomaint: update AUTHORS
Eric Blake [Wed, 31 Mar 2010 14:39:33 +0000 (08:39 -0600)]
maint: update AUTHORS

* AUTHORS: Add recent contributors.

15 years agovirConnectGetLibVersion: Avoid error message on success.
Paolo Smiraglia [Tue, 30 Mar 2010 21:47:16 +0000 (15:47 -0600)]
virConnectGetLibVersion: Avoid error message on success.

* src/libvirt.c (virConnectGetLibVersion): Don't emit error on
success.

15 years agovirsh: add 'exit' as an alias for 'quit'
Eric Blake [Tue, 30 Mar 2010 20:50:35 +0000 (14:50 -0600)]
virsh: add 'exit' as an alias for 'quit'

Call me lazy: some shells use exit (e.g. sh), others use quit (e.g. ftp),
but I never remember which.  So it's faster to write a patch to make
virsh take both than it is to take a 50-50 guess, and get it wrong
in half of my attempts.

* tools/virsh.c (commands): Add 'exit'.
* tools/virsh.pod: Document it.

15 years agomaint: fix cpp indentation syntax-check failure
Jim Meyering [Wed, 31 Mar 2010 14:32:38 +0000 (16:32 +0200)]
maint: fix cpp indentation syntax-check failure

* src/esx/esx_vi_types.h: Filter through cppi.

15 years agomaint: mark xenapiSessionErrorHandler messages for translation
Jim Meyering [Wed, 31 Mar 2010 10:24:25 +0000 (12:24 +0200)]
maint: mark xenapiSessionErrorHandler messages for translation

* cfg.mk (msg_gen_function): Add xenapiSessionErrorHandler.
* po/POTFILES.in: Add src/xenapi/xenapi_driver.c
* src/xenapi/xenapi_driver.c: Mark strings for translation.
* src/xenapi/xenapi_utils.c (xenapiUtil_ParseQuery):

15 years agoBlank out invalid interface names with escaped letters etc.
Stefan Berger [Wed, 31 Mar 2010 14:22:10 +0000 (10:22 -0400)]
Blank out invalid interface names with escaped letters etc.

Check that interface names only contain valid characters. Blank them out
otherwise.
Valid characters in this code are currently a-z,A-Z,0-9, '-' and '_'.

15 years agoAdd virt-aa-helper and secaatest to .gitignore
Matthias Bolte [Wed, 31 Mar 2010 11:23:07 +0000 (13:23 +0200)]
Add virt-aa-helper and secaatest to .gitignore

15 years agoesx: Remove redundant semicolons
Matthias Bolte [Sun, 7 Mar 2010 14:55:19 +0000 (15:55 +0100)]
esx: Remove redundant semicolons

15 years agoesx: Generate most SOAP mapping and improve inheritance handling
Matthias Bolte [Sat, 6 Mar 2010 16:56:28 +0000 (17:56 +0100)]
esx: Generate most SOAP mapping and improve inheritance handling

The Python script generates the mappings based on the type descriptions
in the esx_vi_generator.input file.

This also improves the inheritance handling and allows to get rid of the
ugly, inflexible, and error prone _base/_super approach. Now every struct
that represents a SOAP type contains a _type member, that allows to
recreate C++-like dynamic dispatch for "method" calls in C.

15 years agoDistribute nwfilter xml files and add them to rpm
Daniel Veillard [Wed, 31 Mar 2010 08:20:22 +0000 (10:20 +0200)]
Distribute nwfilter xml files and add them to rpm

* examples/xml/nwfilter/Makefile.am: add all xml to the distribution
* libvirt.spec.in: reference them from the rpm spec file to have them
  available in the main libvirt package

15 years agoMake sure nwfilter headers are part of distribution
Daniel Veillard [Wed, 31 Mar 2010 08:19:06 +0000 (10:19 +0200)]
Make sure nwfilter headers are part of distribution

* src/Makefile.am: adds a few missing header files in the associated
  file variables, it's needed otherwise the missing headers breaks
  compilation from a distribution tarball

15 years agomaint: show which compiler warning triggered
Eric Blake [Tue, 30 Mar 2010 16:09:21 +0000 (10:09 -0600)]
maint: show which compiler warning triggered

* acinclude.m4 (LIBVIRT_COMPILE_WARNINGS): Add
-fdiagnostics-show-option.

15 years agobuild: automate the rerun of autogen.sh
Eric Blake [Fri, 26 Mar 2010 23:11:22 +0000 (17:11 -0600)]
build: automate the rerun of autogen.sh

Automate the reuse of autogen.sh, rather than just erroring out.

* cfg.mk (_update_required): Run autogen.sh, rather than just
warning about it.
(_autogen): New target.

15 years agoA cosmetic change that makes the entries in the int-2-string maps look
Stefan Berger [Tue, 30 Mar 2010 15:42:03 +0000 (11:42 -0400)]
A cosmetic change that makes the entries in the int-2-string maps look
more readable. Add some missing entries: ipv6 and icmpv6.

15 years agoUse libvirt's existing ipv6/ipv4 parser/printer rather than self-written ones
Stefan Berger [Tue, 30 Mar 2010 15:18:04 +0000 (11:18 -0400)]
Use libvirt's existing ipv6/ipv4 parser/printer rather than self-written ones

This patch changes the network filtering code to use libvirt's existing
IPv4 and IPv6 address parsers/printers rather than my self-written ones.

I am introducing a new function in network.c that counts the number of
bits in a netmask and ensures that the given address is indeed a netmask,
return -1 on error or values of 0-32 for IPv4 addresses and 0-128 for
IPv6 addresses. I then based the function checking for valid netmask
on invoking this function.

15 years agoAdd ip6tables support for IPv6 filtering
Stefan Berger [Tue, 30 Mar 2010 14:36:35 +0000 (10:36 -0400)]
Add ip6tables support for IPv6 filtering

This patch adds IPv6 filtering support for the following protocols:
- tcp-ipv6
- udp-ipv6
- udplite-ipv6
- esp-ipv6
- ah-ipv6
- sctp-ipv6
- all-ipv6
- icmpv6

Many of the IPv4 data structure could be re-used for IPv6 support.
Since ip6tables also supports pretty much the same command line parameters
as iptables does, also much of the code could be re-used and now
command lines are invoked with the ip(6)tables tool parameter passed
through the functions as a parameter.

15 years agoRemove driver dependency from nwfilter_conf.c
Stefan Berger [Tue, 30 Mar 2010 14:25:22 +0000 (10:25 -0400)]
Remove driver dependency from nwfilter_conf.c

This patch removes the driver dependency from nwfilter_conf.c and moves
a callback function calling into the driver into
nwfilter_gentech_driver.c and passes a pointer to that callback function
upon initialization of nwfilter_conf.c.

15 years agoAdd support for so-far missing protocols for iptables filtering
Stefan Berger [Tue, 30 Mar 2010 14:16:40 +0000 (10:16 -0400)]
Add support for so-far missing protocols for iptables filtering

This patch adds filtering support for the so-far missing protocols 'ah',
'esp' and 'udplite'.

15 years agoFix daemon hook script initialization
Daniel Veillard [Tue, 30 Mar 2010 13:06:13 +0000 (15:06 +0200)]
Fix daemon hook script initialization

* daemon/libvirtd.c: we should error out only if virHookInitialize()
  return value is negative

15 years agoImplement the qemu-kvm backend of clock timer elements
Laine Stump [Tue, 30 Mar 2010 11:55:27 +0000 (13:55 +0200)]
Implement the qemu-kvm backend of clock timer elements

Since the timers are defined to cover all possible config cases for
several different hypervisors, many of these possibilities generate an
error on qemu. Here is what is currently supported:

RTC: If the -rtc commandline option is available, allow setting
"clock=host"
     or "clock=vm" based on the rtc timer clock='host|guest' value. Also
     add "driftfix=slew" if the tickpolicy is 'catchup', or add nothing
if
     tickpolicy is 'delay'. (Other tickpolicies will raise an error).

     If -rtc isn't available, but -rtc-td-hack is, add that option
     if the tickpolicy is 'catchup', add -rtc-td-hack, if it is 'delay'
     add nothing, and if it's anything else, raise an error.

PIT: If -no-kvm-pit-reinjection is available, and tickpolicy is
     'delay', add that option. if tickpolicy is 'catchup', do
     nothing. Anything else --> raise an error.

     If -no-kvm-pit-reinjection *isn't* available, but -tdf is, when
     tickpolicy is 'catchup' add -tdf. If it's 'delay', do
     nothing. Anything else --> raise an error.

     If neither of those commandline options is available, and
     tickpolicy is anything other than 'delay' (or unspecified), raise
     an error.

HPET: If -no-hpet flag is available and present='no', add -no-hpet.
      If -no-hpet is not available, and present='yes', raise an error.
      If present is unspecified, the default is to do whatever this
      particular qemu does by default, so don't raise an error.

All other timer types are unsupported by QEMU, so they will raise an
error.

* src/qemu/qemu_conf.c: extend qemuBuildClockArgStr() to generate the
  command line arguments for the new options

15 years agoAdd flags to indicate presence of timekeeping-related qemu options
Laine Stump [Tue, 30 Mar 2010 11:51:01 +0000 (13:51 +0200)]
Add flags to indicate presence of timekeeping-related qemu options

* src/qemu/qemu_conf.h: define 4 new flags
* src/qemu/qemu_conf.c: check the help text of qemu for presence of
                        features indicated by each flag.
* tests/qemuhelptest.c: add appropriate flags into the masks for each test

15 years agoAdd timer element to domain schema
Laine Stump [Tue, 30 Mar 2010 11:47:39 +0000 (13:47 +0200)]
Add timer element to domain schema

timers are sub-elements of clocks. A clock can have zero or more
instances of timer. Within the timer, only the name attribute is
required; all other attributes are optional.

A simpler representation of a timer element is:

  <timer name='platform|pit|rtc|hpet|tsc'
         wallclock='host|guest'
         tickpolicy='delay|catchup|merge|discard'
         frequency='123'
         mode='auto|native|emulate|paravirt'
         present='yes|no'/>

frequency is a ulong. All other attributes are simple enums.

15 years agoImplement XML parser/formatter for "timer" subelement of domain clock
Laine Stump [Tue, 30 Mar 2010 11:44:22 +0000 (13:44 +0200)]
Implement XML parser/formatter for "timer" subelement of domain clock

This extension is described in

http://www.redhat.com/archives/libvir-list/2010-March/msg00304.html

Currently all attributes are optional, except name.

* src/conf/domain_conf.h: add data definition for virDomainTimerDef
  and add a list of them to virDomainClockDef
* src/conf/domain_conf.c: XML parser and formatter for a timer inside a clock
* src/libvirt_private.syms: add new Timer enum helper functions to symbols

15 years agoFix QEMU cpu affinity at startup to include all threads
Daniel P. Berrange [Thu, 25 Mar 2010 17:25:20 +0000 (17:25 +0000)]
Fix QEMU cpu affinity at startup to include all threads

The QEMU cpu affinity is used in NUMA scenarios to ensure that
guest memory is allocated from a specific node. Normally memory
is allocate on demand in vCPU threads, but when using hugepages
the initial thread leader allocates memory upfront. libvirt was
not setting affinity of the thread leader, or I/O threads. This
patch changes the code to set the process affinity in between
the fork()/exec() of QEMU. This ensures that every single QEMU
thread gets the affinity

* src/qemu/qemu_driver.c: Set affinity on entire QEMU process
  at startup

15 years agoUpdating the commiters list
Daniel Veillard [Tue, 30 Mar 2010 09:32:06 +0000 (11:32 +0200)]
Updating the commiters list

Laine Stump, Stefan Berger, Eric Blake now have commit rights !

15 years agovirsh: support VISUAL, and allow metacharacters in EDITOR
Eric Blake [Fri, 12 Mar 2010 16:33:22 +0000 (09:33 -0700)]
virsh: support VISUAL, and allow metacharacters in EDITOR

Common Unix practice is to prefer VISUAL over EDITOR, particularly if
the editor of choice spawns a new window.  Thus, it is also common to
see settings like EDITOR='emacs -nw', with the expectation that the
shell will parse this as an argument to 'emacs' and not try to invoke
a file containing a space.

If a user puts junk in EDITOR, they deserve what they get (much more
than virsh will misbehave); furthermore, sudo scrubs EDITOR by
default.  So the blind use of metacharacters in EDITOR should not be
considered too much of a security issue.

* tools/virsh.c (editFile): Prefer VISUAL over EDITOR.  Don't
reject shell metacharacters in EDITOR.
* tools/virsh.pod (edit, net-edit, ENVIRONMENT): Document VISUAL.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=487738.

15 years agovirsh: improve man page
Eric Blake [Fri, 12 Mar 2010 16:25:37 +0000 (09:25 -0700)]
virsh: improve man page

* tools/virsh.pod: (DESCRIPTION): Improve grammar.  Mention other drivers.
(ENVIRONMENT): Document EDITOR.
(COPYRIGHT): Bump.

15 years agoAdd dummy nwfilter driver to test driver
Stefan Berger [Mon, 29 Mar 2010 21:09:20 +0000 (17:09 -0400)]
Add dummy nwfilter driver to test driver

This patch adds a dummy nwfilter driver to the test driver so that the
int-overflow test passes without modifications.

15 years agoFix "make check" run requesting authentication
Stefan Berger [Mon, 29 Mar 2010 17:23:53 +0000 (19:23 +0200)]
Fix "make check" run requesting authentication

This patch fixes the 'make check' runs for me which, under certain
circumstances and login configurations, did invoke popups requesting
authentication. I removed the parameter conn from being passed into the
error reporting function.

* src/conf/nwfilter_conf.h src/conf/nwfilter_conf.c: remove conn from
  error reporting parameters.

15 years agoFix a merge error leftover
Daniel Veillard [Mon, 29 Mar 2010 16:27:12 +0000 (18:27 +0200)]
Fix a merge error leftover

15 years agoAdd script hook support to the LXC driver
Daniel Veillard [Fri, 26 Mar 2010 15:02:05 +0000 (16:02 +0100)]
Add script hook support to the LXC driver

Right now this implements only 2 basic hooks:
- before the lxc control process is being launched
- after the lxc control process is terminated
the XML description of the domain is passed to the hook script stdin
/etc/libvirt/hook/lxc

* src/lxc/lxc_driver.c: implement synchronous script hooks for LXC
  at domain startup and end

15 years agoAdd script hook support to the QEmu driver
Daniel Veillard [Fri, 26 Mar 2010 14:57:58 +0000 (15:57 +0100)]
Add script hook support to the QEmu driver

Right now this implements only 2 basic hooks:
- before the qemu process is being launched
- after the qemu process is terminated
the XML description of the domain is passed to the hook script stdin
/etc/libvirt/hook/qemu

* src/qemu/qemu_driver.c: implement synchronous script hooks for QEmu
  at domain startup and end

15 years agoAdd the script hook support to the libvirt daemon
Daniel Veillard [Fri, 26 Mar 2010 14:53:32 +0000 (15:53 +0100)]
Add the script hook support to the libvirt daemon

It supports 3 kind of probing times, at daemon startup, when the
daemon reloads its drivers on SIGHUP and when the daemon exits

* daemon/libvirtd.c: daemon hooks for startup, reload and exit

15 years agoAdd hook utilities
Daniel Veillard [Fri, 26 Mar 2010 14:49:45 +0000 (15:49 +0100)]
Add hook utilities

This exports 3 basic routines:
  - virHookInitialize() initializing the hook support by looking for
    scripts availability
  - virHookPresent() used to test if there is a hook for a given driver
  - virHookCall() which actually calls a synchronous script hook with
    the needed parameters
Note that this doesn't expose any public API except for the locations
and arguments passed to the scripts

* src/Makefile.am: add the 2 new files
* src/util/hooks.h src/util/hooks.c: implements the 3 functions
* src/libvirt_private.syms: export the 3 symbols internally
* po/POTFILES.in: add src/util/hooks.c to translatables modules

15 years agoAdd an error module and message for the hooks subsystem
Daniel Veillard [Fri, 26 Mar 2010 10:53:19 +0000 (11:53 +0100)]
Add an error module and message for the hooks subsystem

* include/libvirt/virterror.h: add VIR_FROM_HOOK and VIR_ERR_HOOK_SCRIPT_FAILED
* src/util/virterror.c: associated strings

15 years agoExport virPipeReadUntilEOF internally
Daniel Veillard [Fri, 26 Mar 2010 10:50:10 +0000 (11:50 +0100)]
Export virPipeReadUntilEOF internally

used to read the data from virExec stdout/err file descriptors

* src/util/util.c src/util/util.h: not static anymore and export it
* src/libvirt_private.syms: allow access internally

15 years agoIntroduce UPDATE_CPU flag for virDomainGetXMLDesc
Jiri Denemark [Tue, 23 Mar 2010 08:34:19 +0000 (09:34 +0100)]
Introduce UPDATE_CPU flag for virDomainGetXMLDesc

This flag is used in migration prepare step to send updated XML
definition of a guest.

Also ``virsh dumpxml --update-cpu [--inactive] guest'' command can be
used to see the updated CPU requirements.

15 years agoHelper function for making a copy of virCPUDefPtr
Jiri Denemark [Tue, 23 Mar 2010 08:34:04 +0000 (09:34 +0100)]
Helper function for making a copy of virCPUDefPtr

15 years agocpuUpdate() for updating guest CPU according to host CPU
Jiri Denemark [Tue, 23 Mar 2010 08:32:50 +0000 (09:32 +0100)]
cpuUpdate() for updating guest CPU according to host CPU

Useful mainly for migration. cpuUpdate changes guest CPU requirements in
the following way:

- match == "strict" || match == "exact"
    - optional features which are supported by host CPU are changed into
      required features
    - optional features which are not supported by host CPU are disabled
    - all other features remain untouched
- match == "minimum"
    - match is changed into "exact"
    - optional features and all features not mentioned in guest CPU
      specification which are supported by host CPU become required
      features
    - other optional features are disabled
    - all other features remain untouched

This ensures that no feature will suddenly disappear from the guest
after migration.

15 years agoDon't replace persistent domain config with migrated config
Jiri Denemark [Wed, 24 Mar 2010 14:31:21 +0000 (15:31 +0100)]
Don't replace persistent domain config with migrated config

When a domain is defined on host1, migrated to host2 and then migrated
back to host1, its current configuration would overwrite the libvirtd's
in-memory copy of persistent configuration of that domain. This is not
desired as we want to preserve the persistent configuration untouched.

This patch introduces new 'live' parameter to virDomainAssignDef.
Passing 'true' for 'live' means the configuration passed to
virDomainAssignDef describes a configuration of live instance of the
domain. This applies for saved domains which are being restored or for
incoming domains during migration.

All callers have been changed to pass the appropriate value.

15 years agofilter new files through cppi, so syntax-check passes once again
Jim Meyering [Fri, 26 Mar 2010 18:29:54 +0000 (19:29 +0100)]
filter new files through cppi, so syntax-check passes once again

* src/conf/nwfilter_conf.h: Indent cpp directives.
* src/conf/nwfilter_params.h: Likewise.
* src/datatypes.h: Likewise.
* src/nwfilter/nwfilter_driver.h: Likewise.
* src/nwfilter/nwfilter_ebiptables_driver.h: Likewise.
* src/nwfilter/nwfilter_gentech_driver.h: Likewise.

15 years agoAdd disk error policy to domain XML
David Allan [Wed, 24 Mar 2010 15:32:10 +0000 (11:32 -0400)]
Add disk error policy to domain XML

* Fixes per feedback from Dan and Daniel
* Added test datafiles
* Re-disabled JSON flags
* Added code to print the error policy attribute when generating XML
* Re-add empty tag

15 years agobuild: don't lose prior configure args on autogen.sh
Eric Blake [Thu, 25 Mar 2010 23:37:32 +0000 (17:37 -0600)]
build: don't lose prior configure args on autogen.sh

My prior patch forced an autogen.sh run, and I was surprised that the
suggested './autogen.sh' lost the fact that I had previously used
'./autogen.sh -C' for speed.

* autogen.sh: Use config.status, if present and there were no arguments.

Signed-off-by: Eric Blake <eblake@redhat.com>
15 years agobuild: update gnulib
Eric Blake [Thu, 25 Mar 2010 23:37:31 +0000 (17:37 -0600)]
build: update gnulib

Picks up fixes for gethostname compilation problems on mingw.

* .gnulib: Update to latest.
* build-aux/.gitignore: Regenerate.
* cfg.mk (local-checks-to-skip): Avoid new test not relevent to
libvirt.

15 years agoAdd some examples filters
Stefan Berger [Thu, 25 Mar 2010 17:46:13 +0000 (13:46 -0400)]
Add some examples filters

This patch adds some example filters to libvirt. They are automatically
installed into the proper directory for libvirt to pick them up.

15 years agoExtensions for iptables rules
Stefan Berger [Thu, 25 Mar 2010 17:46:12 +0000 (13:46 -0400)]
Extensions for iptables rules

This patch adds support for L3/L4 filtering using iptables. This adds
support for 'tcp', 'udp', 'icmp', 'igmp', 'sctp' etc. filtering.

As mentioned in the introduction, a .c file provided by this patch
is #include'd into a .c file. This will need work, but should be alright
for review.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
15 years agoAdd IPv6 support for the ebtables layer
Stefan Berger [Thu, 25 Mar 2010 17:46:11 +0000 (13:46 -0400)]
Add IPv6 support for the ebtables layer

This patch adds IPv6 support for the ebtables layer. Since the parser
etc. are all parameterized, it was fairly easy to add this...

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
15 years agoAdd qemu support
Stefan Berger [Thu, 25 Mar 2010 17:46:08 +0000 (13:46 -0400)]
Add qemu support

Add support for Qemu to have firewall rules applied and removed on VM
startup and shutdown respectively. This  patch also provides support for
the updating of a filter that causes all VMs that reference the filter
to have their ebtables/iptables rules updated.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
15 years agoCore driver implementation with ebtables support
Stefan Berger [Thu, 25 Mar 2010 17:46:09 +0000 (13:46 -0400)]
Core driver implementation with ebtables support

This patch implements the core driver and provides
- management functionality for managing the filter XMLs
- compiling the internal filter representation into ebtables rules
- applying ebtables rules on a network (tap,macvtap) interface
- tearing down ebtables rules that were applied on behalf of an
interface
- updating of filters while VMs are running and causing the firewalls to
be rebuilt
- other bits and pieces

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
15 years agoAdd XML parser extensions for network filtering
Stefan Berger [Thu, 25 Mar 2010 17:46:07 +0000 (13:46 -0400)]
Add XML parser extensions for network filtering

This patch adds XML processing for the network filter schema
and extends the domain XML processing to parse the top level
referenced filter along with potentially provided parameters

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
Signed-off-by: Gerhard Stenzel <gerhard.stenzel@de.ibm.com>
15 years agoAdd virsh support for new CLI commands
Stefan Berger [Thu, 25 Mar 2010 17:46:06 +0000 (13:46 -0400)]
Add virsh support for new CLI commands

This patch adds virsh support for the five new CLI commands to manage
network filters.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
15 years agoDefinition of the wire format, RPC client & server
Stefan Berger [Thu, 25 Mar 2010 17:46:03 +0000 (13:46 -0400)]
Definition of the wire format, RPC client & server

This patch adds the definition of the wire format for RPC calls
and implementation of the RPC client & server code

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
15 years agoImplementation of the public API
Stefan Berger [Thu, 25 Mar 2010 17:46:02 +0000 (13:46 -0400)]
Implementation of the public API

This patch adds the implementation of the public API for the network
filtering (ACL) extensions to libvirt.c .

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
15 years agoAdd internal API
Stefan Berger [Thu, 25 Mar 2010 17:46:01 +0000 (13:46 -0400)]
Add internal API

This patch adds the internal API extensions for network filtering (ACL) support.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
15 years agoAdd public API
Stefan Berger [Thu, 25 Mar 2010 17:46:00 +0000 (13:46 -0400)]
Add public API

This patch adds extensions to libvirt's public API necessary for
controlling the new functionality from remote for example.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
15 years agoAdd recursive locks
Stefan Berger [Thu, 25 Mar 2010 17:45:59 +0000 (13:45 -0400)]
Add recursive locks

This patch adds recursive locks necessary due to the processing of
network filter XML that can reference other network filters, including
references that cause looks. Loops in the XML are prevented but their
detection requires recursive locks.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
15 years agoFix build break
David Allan [Fri, 26 Mar 2010 17:05:19 +0000 (13:05 -0400)]
Fix build break

* Add types to switch; the switch is only exectuted for known types because of a preceding conditional, so this fix is merely to placate the compiler.

15 years agoUse enum of virDomainNetType
Stefan Berger [Fri, 26 Mar 2010 16:01:35 +0000 (17:01 +0100)]
Use enum of virDomainNetType

To find out where the net type 'direct' needs to be handled I introduced
the 'enum virDomainNetType' in the virDomainNetDef structure and let the
compiler tell me where the case statement is missing. Then I added the
unhandled device statement to the UML driver.

* src/conf/domain_conf.h: change _virDomainNetDef type from int to
  virDomainNetType enum
* src/conf/domain_conf.c src/lxc/lxc_driver.c src/qemu/qemu_conf.c
  src/uml/uml_conf.c: make sure all enum cases are properly handled
  in switches

15 years agoSilence cppi syntax-check warning
Daniel Veillard [Fri, 26 Mar 2010 16:00:50 +0000 (17:00 +0100)]
Silence cppi syntax-check warning

15 years agoMention direct device support since 0.7.7 in docs
Stefan Berger [Fri, 26 Mar 2010 15:53:32 +0000 (16:53 +0100)]
Mention direct device support since 0.7.7 in docs

In the documentation mention that the direct device support is there
since libvirt 0.7.7. A Linux kernel 2.6.34 is required for macvtap to be
available as standard device.

15 years agoImplement VNC password change in QEMU
Daniel P. Berrange [Mon, 22 Mar 2010 18:44:58 +0000 (18:44 +0000)]
Implement VNC password change in QEMU

Use the new virDomainUpdateDeviceFlags API to allow the VNC password
to be changed on the fly

* src/internal.h: Define STREQ_NULLABLE() which is like STREQ()
  but does not crash if either argument is NULL, and treats two
  NULLs as equal.
* src/libvirt_private.syms: Export virDomainGraphicsTypeToString
* src/qemu/qemu_driver.c: Support VNC password change on a live
  machine
* src/qemu/qemu_monitor.c: Disable crazy debugging info. Treat a
  NULL password as "" (empty string), allowing passwords to be
  disabled in the monitor

15 years agoAllow parsing <graphics> in device XML
Daniel P. Berrange [Mon, 22 Mar 2010 13:22:48 +0000 (13:22 +0000)]
Allow parsing <graphics> in device XML

Expand the parser for the standalone <device> XML format to
allow inclusion of the <graphics> device type

* src/conf/domain_conf.h: Add virDomainGraphicsDef to
  the virDomainDeviceDef struct
* src/conf/domain_conf.c: Wire up parser for virDomainGraphicsDef
  to virDomainDeviceDefParse method

15 years agoIntroduce a update-device command in virsh
Daniel P. Berrange [Mon, 22 Mar 2010 18:45:09 +0000 (18:45 +0000)]
Introduce a update-device command in virsh

Support the new virDomainUpdateDeviceFlags API in virsh by adding
a new 'update-device' command. In the future this should be augmented
with an explicit 'change-disk' command for media change to make it
end user discoverable, as attach-disk is.

* tools/virsh.c: Add 'update-device' command

15 years agoImplement virDomainUpdateDeviceFlags API in all drivers with media change
Daniel P. Berrange [Mon, 22 Mar 2010 13:13:53 +0000 (13:13 +0000)]
Implement virDomainUpdateDeviceFlags API in all drivers with media change

To allow the new virDomainUpdateDeviceFlags() API to be universally
used with all drivers, this patch adds an impl to all the current
drivers which support CDROM or Floppy disk media change via the
current virDomainAttachDeviceFlags API

* src/qemu/qemu_driver.c, src/vbox/vbox_tmpl.c,
  src/xen/proxy_internal.c, src/xen/xen_driver.c,
  src/xen/xend_internal.c: Implement media change via the
  virDomainUpdateDeviceFlags API
* src/xen/xen_driver.h, src/xen/xen_hypervisor.c,
  src/xen/xen_inotify.c, src/xen/xm_internal.c,
  src/xen/xs_internal.c: Stubs for Xen driver entry points

15 years agoRemote protocol impl for virDomainUpdateDeviceFlags
Daniel P. Berrange [Mon, 22 Mar 2010 12:26:05 +0000 (12:26 +0000)]
Remote protocol impl for virDomainUpdateDeviceFlags

This defines the wire format for the new virDomainUpdateDeviceFlags()
API, and implements the server & client side of the marshalling code.

* daemon/remote.c: Server side dispatch for virDomainUpdateDeviceFlags
* src/remote/remote_driver.c: Client side serialization for
  virDomainUpdateDeviceFlags
* src/remote/remote_protocol.x: Define wire format for
  virDomainUpdateDeviceFlags
* daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h,
  daemon/remote_dispatch_table.h, src/remote/remote_protocol.c,
  src/remote/remote_protocol.h: Re-generate code

15 years agoIntroduce a new virDomainUpdateDeviceFlags public API
Daniel P. Berrange [Mon, 22 Mar 2010 12:23:41 +0000 (12:23 +0000)]
Introduce a new virDomainUpdateDeviceFlags public API

The current virDomainAttachDevice API can be (ab)used to change
the media of an existing CDROM/Floppy device. Going forward there
will be more devices that can be configured on the fly and overloading
virDomainAttachDevice for this is not too pleasant. This patch adds
a new virDomainUpdateDeviceFlags() explicitly just for modifying
existing devices.

* include/libvirt/libvirt.h.in: Add virDomainUpdateDeviceFlags
* src/driver.h: Internal API for virDomainUpdateDeviceFlags
* src/libvirt.c, src/libvirt_public.syms: Glue public API to
  driver 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: Add
  stubs for new driver entry point

15 years agoAdd domain events for graphics network clients
Daniel P. Berrange [Fri, 19 Mar 2010 13:27:45 +0000 (13:27 +0000)]
Add domain events for graphics network clients

This introduces a new event type

   VIR_DOMAIN_EVENT_ID_GRAPHICS

The same event can be emitted in 3 scenarios

  typedef enum {
      VIR_DOMAIN_EVENT_GRAPHICS_CONNECT = 0,
      VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE,
      VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT,
  } virDomainEventGraphicsPhase;

Connect/disconnect are triggered at socket accept/close.
The initialize phase is immediately after the protocol
setup and authentication has completed. ie when the
client is authorized and about to start interacting with
the graphical desktop

This event comes with *a lot* of potential information

 - IP address, port & address family of client
 - IP address, port & address family of server
 - Authentication scheme (arbitrary string)
 - Authenticated subject identity. A subject may have
   multiple identities with some authentication schemes.
   For example, vencrypt+sasl results in a x509dname
   and saslUsername identities.

This results in a very complicated callback :-(

   typedef enum {
      VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4,
      VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV6,
   } virDomainEventGraphicsAddressType;

   struct _virDomainEventGraphicsAddress {
       int family;
       const char *node;
       const char *service;
   };
   typedef struct _virDomainEventGraphicsAddress virDomainEventGraphicsAddress;
   typedef virDomainEventGraphicsAddress *virDomainEventGraphicsAddressPtr;

   struct _virDomainEventGraphicsSubject {
      int nidentity;
      struct {
          const char *type;
          const char *name;
      } *identities;
   };
   typedef struct _virDomainEventGraphicsSubject virDomainEventGraphicsSubject;
   typedef virDomainEventGraphicsSubject *virDomainEventGraphicsSubjectPtr;

   typedef void (*virConnectDomainEventGraphicsCallback)(virConnectPtr conn,
                                                         virDomainPtr dom,
                                                         int phase,
                                                         virDomainEventGraphicsAddressPtr local,
                                                         virDomainEventGraphicsAddressPtr remote,
                                                         const char *authScheme,
                                                         virDomainEventGraphicsSubjectPtr subject,
                                                         void *opaque);

The wire protocol is similarly complex

   struct remote_domain_event_graphics_address {
     int family;
     remote_nonnull_string node;
     remote_nonnull_string service;
   };

   const REMOTE_DOMAIN_EVENT_GRAPHICS_IDENTITY_MAX = 20;

   struct remote_domain_event_graphics_identity {
     remote_nonnull_string type;
     remote_nonnull_string name;
   };

   struct remote_domain_event_graphics_msg {
     remote_nonnull_domain dom;
     int phase;
     remote_domain_event_graphics_address local;
     remote_domain_event_graphics_address remote;
     remote_nonnull_string authScheme;
     remote_domain_event_graphics_identity subject<REMOTE_DOMAIN_EVENT_GRAPHICS_IDENTITY_MAX>;
   };

This is currently implemented in QEMU for the VNC graphics
protocol, but designed to be usable with SPICE graphics in
the future too.

* daemon/remote.c: Dispatch graphics events to client
* examples/domain-events/events-c/event-test.c: Watch for
  graphics events
* include/libvirt/libvirt.h.in: Define new graphics event ID
  and callback signature
* src/conf/domain_event.c, src/conf/domain_event.h,
  src/libvirt_private.syms: Extend API to handle graphics events
* src/qemu/qemu_driver.c: Connect to the QEMU monitor event
  for VNC events and emit a libvirt graphics event
* src/remote/remote_driver.c: Receive and dispatch graphics
  events to application
* src/remote/remote_protocol.x: Wire protocol definition for
  graphics events
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c: Watch for VNC_CONNECTED,
  VNC_INITIALIZED & VNC_DISCONNETED events from QEMU monitor

15 years agoAdd support for an explicit IO error event
Daniel P. Berrange [Thu, 18 Mar 2010 19:37:44 +0000 (19:37 +0000)]
Add support for an explicit IO error event

This introduces a new event type

   VIR_DOMAIN_EVENT_ID_IO_ERROR

This event includes the action that is about to be taken
as a result of the watchdog triggering

  typedef enum {
     VIR_DOMAIN_EVENT_IO_ERROR_NONE = 0,
     VIR_DOMAIN_EVENT_IO_ERROR_PAUSE,
     VIR_DOMAIN_EVENT_IO_ERROR_REPORT,
  } virDomainEventIOErrorAction;

In addition it has the source path of the disk that had the
error and its unique device alias. It does not include the
target device name (/dev/sda), since this would preclude
triggering IO errors from other file backed devices (eg
serial ports connected to a file)

Thus there is a new callback definition for this event type

typedef void (*virConnectDomainEventIOErrorCallback)(virConnectPtr conn,
                                                     virDomainPtr dom,
                                                     const char *srcPath,
                                                     const char *devAlias,
                                                     int action,
                                                     void *opaque);

This is currently wired up to the QEMU block IO error events

* daemon/remote.c: Dispatch IO error events to client
* examples/domain-events/events-c/event-test.c: Watch for
  IO error events
* include/libvirt/libvirt.h.in: Define new IO error event ID
  and callback signature
* src/conf/domain_event.c, src/conf/domain_event.h,
  src/libvirt_private.syms: Extend API to handle IO error events
* src/qemu/qemu_driver.c: Connect to the QEMU monitor event
  for block IO errors and emit a libvirt IO error event
* src/remote/remote_driver.c: Receive and dispatch IO error
  events to application
* src/remote/remote_protocol.x: Wire protocol definition for
  IO error events
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c: Watch for BLOCK_IO_ERROR event
  from QEMU monitor

15 years agoAdd support for an explicit watchdog event
Daniel P. Berrange [Thu, 18 Mar 2010 19:07:48 +0000 (19:07 +0000)]
Add support for an explicit watchdog event

This introduces a new event type

   VIR_DOMAIN_EVENT_ID_WATCHDOG

This event includes the action that is about to be taken
as a result of the watchdog triggering

 typedef enum {
     VIR_DOMAIN_EVENT_WATCHDOG_NONE = 0,
     VIR_DOMAIN_EVENT_WATCHDOG_PAUSE,
     VIR_DOMAIN_EVENT_WATCHDOG_RESET,
     VIR_DOMAIN_EVENT_WATCHDOG_POWEROFF,
     VIR_DOMAIN_EVENT_WATCHDOG_SHUTDOWN,
     VIR_DOMAIN_EVENT_WATCHDOG_DEBUG,
 } virDomainEventWatchdogAction;

Thus there is a new callback definition for this event type

 typedef void (*virConnectDomainEventWatchdogCallback)(virConnectPtr conn,
                                                       virDomainPtr dom,
                                                       int action,
                                                       void *opaque);

* daemon/remote.c: Dispatch watchdog events to client
* examples/domain-events/events-c/event-test.c: Watch for
  watchdog events
* include/libvirt/libvirt.h.in: Define new watchdg event ID
  and callback signature
* src/conf/domain_event.c, src/conf/domain_event.h,
  src/libvirt_private.syms: Extend API to handle watchdog events
* src/qemu/qemu_driver.c: Connect to the QEMU monitor event
  for watchdogs and emit a libvirt watchdog event
* src/remote/remote_driver.c: Receive and dispatch watchdog
  events to application
* src/remote/remote_protocol.x: Wire protocol definition for
  watchdog events
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c: Watch for WATCHDOG event
  from QEMU monitor

15 years agoAdd support for an explicit RTC change event
Daniel P. Berrange [Thu, 18 Mar 2010 18:28:15 +0000 (18:28 +0000)]
Add support for an explicit  RTC change event

This introduces a new event type

   VIR_DOMAIN_EVENT_ID_RTC_CHANGE

This event includes the new UTC offset measured in seconds.
Thus there is a new callback definition for this event type

 typedef void (*virConnectDomainEventRTCChangeCallback)(virConnectPtr conn,
                                                        virDomainPtr dom,
                                                        long long utcoffset,
                                                        void *opaque);

If the guest XML configuration for the <clock> is set to
offset='variable', then the XML will automatically be
updated with the new UTC offset value. This ensures that
during migration/save/restore the new offset is preserved.

* daemon/remote.c: Dispatch RTC change events to client
* examples/domain-events/events-c/event-test.c: Watch for
  RTC change events
* include/libvirt/libvirt.h.in: Define new RTC change event ID
  and callback signature
* src/conf/domain_event.c, src/conf/domain_event.h,
  src/libvirt_private.syms: Extend API to handle RTC change events
* src/qemu/qemu_driver.c: Connect to the QEMU monitor event
  for RTC changes and emit a libvirt RTC change event
* src/remote/remote_driver.c: Receive and dispatch RTC change
  events to application
* src/remote/remote_protocol.x: Wire protocol definition for
  RTC change events
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c: Watch for RTC_CHANGE event
  from QEMU monitor

15 years agoAdd support for an explicit guest reboot event
Daniel P. Berrange [Thu, 18 Mar 2010 15:25:38 +0000 (15:25 +0000)]
Add support for an explicit guest reboot event

The reboot event is not a normal lifecycle event, since the
virtual machine on the host does not change state. Rather the
guest OS is resetting the virtual CPUs. ie, the QEMU process
does not restart. Thus, this does not belong in the current
lifecycle events callback.

This introduces a new event type

    VIR_DOMAIN_EVENT_ID_REBOOT

It takes no parameters, besides the virDomainPtr, so it can
use the generic callback signature.

* daemon/remote.c: Dispatch reboot events to client
* examples/domain-events/events-c/event-test.c: Watch for
  reboot events
* include/libvirt/libvirt.h.in: Define new reboot event ID
* src/conf/domain_event.c, src/conf/domain_event.h,
  src/libvirt_private.syms: Extend API to handle reboot events
* src/qemu/qemu_driver.c: Connect to the QEMU monitor event
  for reboots and emit a libvirt reboot event
* src/remote/remote_driver.c: Receive and dispatch reboot
  events to application
* src/remote/remote_protocol.x: Wire protocol definition for
  reboot events

15 years agoRename domain lifecycle event message
Daniel P. Berrange [Fri, 19 Mar 2010 14:28:23 +0000 (14:28 +0000)]
Rename domain lifecycle event message

To avoid confusion, rename the current REMOTE_PROC_DOMAIN_EVENT
message to REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE. This does not
cause ABI problems, since the names are only relevant at the source
code level. On the wire they encoding is a plain integer whose
value does not change

* src/remote/remote_protocol.x: Rename REMOTE_PROC_DOMAIN_EVENT
  to REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE.
* daemon/remote.c, src/remote/remote_driver.c: Update code for
  renamed event

15 years agoConvert domain events example to new API
Daniel P. Berrange [Thu, 18 Mar 2010 17:47:02 +0000 (17:47 +0000)]
Convert domain events example to new API

Convert the domain events example program to use the new
events APIs for one of its callback registrations to demo the
new API and interoperability with the old API.

* examples/domain-events/events-c/event-test.c: Convert to
  new events API