]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
15 years agoone: Remove virConnectPtr from oneError
Matthias Bolte [Sat, 3 Apr 2010 13:39:01 +0000 (15:39 +0200)]
one: Remove virConnectPtr from oneError

15 years agouml: Remove virConnectPtr from umlReportError
Matthias Bolte [Sat, 3 Apr 2010 13:33:29 +0000 (15:33 +0200)]
uml: Remove virConnectPtr from umlReportError

15 years agoRemove virConnectPtr from eventReportError
Matthias Bolte [Sat, 3 Apr 2010 13:22:58 +0000 (15:22 +0200)]
Remove virConnectPtr from eventReportError

15 years agoRemove virConnectPtr from virLibConnError
Matthias Bolte [Sat, 3 Apr 2010 13:01:26 +0000 (15:01 +0200)]
Remove virConnectPtr from virLibConnError

15 years agoxen: Remove virConnectPtr from xenUnifiedError
Matthias Bolte [Sat, 3 Apr 2010 00:12:16 +0000 (02:12 +0200)]
xen: Remove virConnectPtr from xenUnifiedError

15 years agoRemove virConnectPtr from nodeReportError
Matthias Bolte [Sat, 3 Apr 2010 00:06:51 +0000 (02:06 +0200)]
Remove virConnectPtr from nodeReportError

15 years agonetcf: Remove virConnectPtr from interfaceReportError
Matthias Bolte [Fri, 2 Apr 2010 23:51:49 +0000 (01:51 +0200)]
netcf: Remove virConnectPtr from interfaceReportError

15 years agoxen: Remove virConnectPtr from virXenInotifyError
Matthias Bolte [Fri, 2 Apr 2010 23:50:56 +0000 (01:50 +0200)]
xen: Remove virConnectPtr from virXenInotifyError

15 years agoxen: Remove virConnectPtr from virXenStoreError
Matthias Bolte [Fri, 2 Apr 2010 23:50:19 +0000 (01:50 +0200)]
xen: Remove virConnectPtr from virXenStoreError

15 years agoxen: Remove virConnectPtr from virXenError/virXenErrorFunc
Matthias Bolte [Fri, 2 Apr 2010 23:41:55 +0000 (01:41 +0200)]
xen: Remove virConnectPtr from virXenError/virXenErrorFunc

15 years agoxen: Remove virConnectPtr from virXMError
Matthias Bolte [Fri, 2 Apr 2010 23:29:12 +0000 (01:29 +0200)]
xen: Remove virConnectPtr from virXMError

15 years agoxen: Remove virConnectPtr from virXendError
Matthias Bolte [Fri, 2 Apr 2010 23:10:49 +0000 (01:10 +0200)]
xen: Remove virConnectPtr from virXendError

15 years agoproxy: Remove virConnectPtr from virProxyError
Matthias Bolte [Fri, 2 Apr 2010 22:43:41 +0000 (00:43 +0200)]
proxy: Remove virConnectPtr from virProxyError

15 years agovbox: Remove virConnectPtr from vboxError
Matthias Bolte [Fri, 2 Apr 2010 22:38:57 +0000 (00:38 +0200)]
vbox: Remove virConnectPtr from vboxError

15 years agotest: Remove virConnectPtr from testError
Matthias Bolte [Fri, 2 Apr 2010 21:56:10 +0000 (23:56 +0200)]
test: Remove virConnectPtr from testError

15 years agoRemove unnecessary trailing \n in log messages
Matthias Bolte [Fri, 2 Apr 2010 19:44:04 +0000 (21:44 +0200)]
Remove unnecessary trailing \n in log messages

15 years agoFix compiler warning about non-literal format string
Matthias Bolte [Mon, 5 Apr 2010 23:38:53 +0000 (01:38 +0200)]
Fix compiler warning about non-literal format string

15 years agoThis patch removes the virConnectPtr parameter from all functions where it's not...
Stefan Berger [Mon, 5 Apr 2010 16:34:55 +0000 (12:34 -0400)]
This patch removes the virConnectPtr parameter from all functions where it's not necessary starting out with removing it as a parameter to the error reporting function.

15 years agoSnapshot virsh implementation.
Chris Lalancette [Wed, 31 Mar 2010 20:28:00 +0000 (16:28 -0400)]
Snapshot virsh implementation.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoSnapshots for VBox
Jiri Denemark [Fri, 26 Mar 2010 12:40:34 +0000 (13:40 +0100)]
Snapshots for VBox

15 years agoSnapshot QEMU driver.
Chris Lalancette [Fri, 2 Apr 2010 14:10:37 +0000 (10:10 -0400)]
Snapshot QEMU driver.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoOnly assign newDef when we have a new def.
Chris Lalancette [Fri, 2 Apr 2010 14:41:47 +0000 (10:41 -0400)]
Only assign newDef when we have a new def.

While playing around with def/newDef with the qemu code,
I noticed that newDef was *always* getting set to a value,
even when I didn't redefine the domain.  I think the problem
is the virDomainLoadConfig is always doing virDomainAssignDef
regardless of whether the domain already exists in the hashtable.
In turn, virDomainAssignDef is assigning the definition (which
is actually a duplicate) to newDef.  Fix this so that newDef stays
NULL until we actually have a new def.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoSnapshot internal methods.
Chris Lalancette [Fri, 2 Apr 2010 14:41:30 +0000 (10:41 -0400)]
Snapshot internal methods.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoSnapshot API framework.
Chris Lalancette [Wed, 31 Mar 2010 20:33:13 +0000 (16:33 -0400)]
Snapshot API framework.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoClarified error message
David Allan [Mon, 5 Apr 2010 14:17:31 +0000 (10:17 -0400)]
Clarified error message

* Since the file pattern matches RNG schemas as well as C sources, the error message should mention both.

15 years agoEliminate compiler warning about non-const format string
Laine Stump [Sun, 4 Apr 2010 03:21:12 +0000 (23:21 -0400)]
Eliminate compiler warning about non-const format string

15 years agoxenapi: Add managedsave entries to the driver struct
Matthias Bolte [Sun, 4 Apr 2010 16:23:52 +0000 (18:23 +0200)]
xenapi: Add managedsave entries to the driver struct

Commit 15c647a91e8c5bcfcb02ac4e755160c5c99a2a1e added the new
managedsave entries to all driver structs except the XenAPI one.

15 years agoGet rid of the regular expressions when evaluating variable names and
Stefan Berger [Sun, 4 Apr 2010 14:34:52 +0000 (10:34 -0400)]
Get rid of the regular expressions when evaluating variable names and
values. Rather use the strspn() function. Along with this cleanup the
initialization function for the code that used the regular expression
can also be removed.

15 years agonwfilter: Fix random index in virNWFilterRuleDefDetailsFormat
Matthias Bolte [Sat, 3 Apr 2010 22:51:57 +0000 (00:51 +0200)]
nwfilter: Fix random index in virNWFilterRuleDefDetailsFormat

An uninitialized int value was used to index an array. This can
result in a segfault in nwfilterxml2xmltest.

15 years agoxenapi: Fix uninitialized variable warning
Matthias Bolte [Fri, 2 Apr 2010 22:37:51 +0000 (00:37 +0200)]
xenapi: Fix uninitialized variable warning

15 years agoAdd a managedsave command to virsh
Daniel Veillard [Thu, 1 Apr 2010 16:05:38 +0000 (18:05 +0200)]
Add a managedsave command to virsh

This command implements the managed save operation

* tools/virsh.c: new command
* tools/virsh.pod: documentation

15 years agoImplement managed save operations for qemu driver
Daniel Veillard [Thu, 1 Apr 2010 15:57:32 +0000 (17:57 +0200)]
Implement managed save operations for qemu driver

The images are saved in /var/lib/libvirt/qemu/save/
and named $domainname.save . The directory is created appropriately
at daemon startup. When a domain is started while a saved image is
available, libvirt will try to load this saved image, and start the
domain as usual in case of failure. In any case the saved image is
discarded once the domain is created.

* src/qemu/qemu_conf.h: adds an extra save path to the driver config
* src/qemu/qemu_driver.c: implement the 3 new operations and handling
  of the image directory

15 years agoImplement remote protocol for managed save
Daniel Veillard [Thu, 1 Apr 2010 08:54:12 +0000 (10:54 +0200)]
Implement remote protocol for managed save

* src/remote/remote_protocol.x src/remote/remote_protocol.h
  src/remote/remote_protocol.c src/remote/remote_driver.c: add the entry
  points in the remote driver
* daemon/remote.c daemon/remote_dispatch_args.h
  daemon/remote_dispatch_prototypes.h daemon/remote_dispatch_table.h:
  and implement the daemon counterpart

15 years agoAdd managed save API entry points
Daniel Veillard [Thu, 1 Apr 2010 08:46:28 +0000 (10:46 +0200)]
Add managed save API entry points

virDomainManagedSave() is to be run on a running domain. Once the call
complete, as in virDomainSave() the domain is stopped upon completion,
but there is no restore counterpart as any order to start the domain
from the API would load the state from the managed file, similary if
the domain is autostarted when libvirtd starts.
Once a domain has restarted his managed save image is destroyed,
basically managed save image can only exist for a stopped domain,
for a running domain that would be by definition outdated data.

* include/libvirt/libvirt.h.in src/libvirt.c src/libvirt_public.syms:
  adds the new entry points virDomainManagedSave(),
  virDomainHasManagedSaveImage() and virDomainManagedSaveRemove()
* src/driver.h 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/vbox/vbox_tmpl.c
  src/remote/remote_driver.c src/test/test_driver.c src/uml/uml_driver.c
  src/xen/xen_driver.c: add corresponding new internal drivers entry
  points

15 years agobuild: improve check for out-of-date .gnulib submodule
Eric Blake [Fri, 2 Apr 2010 20:52:35 +0000 (14:52 -0600)]
build: improve check for out-of-date .gnulib submodule

git reset --hard 96e5a2d4d5b13bf2cc887562dc11d146b78d5950
./autogen.sh
make -s
git pull
make -s    <-- expecting auto-bootstrap here, doesn't happen

Use git diff to expose whether the submodule has untracked changes,
which are typical on an incremental pull if .gnulib was updated but
the user did not manually run 'git submodule update'.

After this patch is applied, I encountered a new problem when
following the reproducing pattern.  Basically, the change to .gnulib
between libvirt's commit 96e5a2d4 and this patch introduced a change
to sys_ioctl.in.h, but gnulib (intentionally) does not make the
replacement headers depend on Makefile changes.  Therefore, I ended up
with the generated replacement header being broken:
gnulib/lib/sys/ioctl.h complained about a use of @.  But that seems
like something that should be fixed upstream in gnulib's bootstrap
script (that is, when doing a gnulib update, all files created from
.in.h file should probably be deleted).  Without the benefit of that
proposed gnulib fix, I worked around the problem by manually removing
the stale gnulib/lib/sys/ioctl.h.

* autogen.sh (t): Also run bootstrap if the gnulib submodule needs
to be updated.
* cfg.mk (_autogen): Likewise.
Reported by Matthias Bolte.

15 years agoUse the virStrToLong_ui() function rather than the virStrToLong_i()
Stefan Berger [Fri, 2 Apr 2010 19:02:27 +0000 (15:02 -0400)]
Use the virStrToLong_ui() function rather than the virStrToLong_i()
where possible.

15 years agoThe attached patch optimizes the validation of the name of an interface.
Stefan Berger [Fri, 2 Apr 2010 18:57:01 +0000 (14:57 -0400)]
The attached patch optimizes the validation of the name of an interface.

15 years agoThis patch adds a couple of test cases for the XML parsing test suite covering variou...
Stefan Berger [Fri, 2 Apr 2010 17:28:28 +0000 (13:28 -0400)]
This patch adds a couple of test cases for the XML parsing test suite covering various filterable protocols. For each test case an input XML and an output XML is provided checking the input XML after parsing and converting back into XML against the exepcted output XML.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
15 years agoThe following issues are fixed in the patch below:
Stefan Berger [Fri, 2 Apr 2010 17:21:10 +0000 (13:21 -0400)]
The following issues are fixed in the patch below:

- ebtables requires that some of the command line parameters are passed as hex numbers; so have those attributes call a function that prints 16 and 8 bit integers as hex nunbers.

- ip6tables requires '--icmpv6-type' rather than '--icmp-type'

- ebtables complains about protocol identifiers lower than 0x600, so already discard anything lower than 0x600 in the parser

- make the protocol entry types more readable using a #define for its entries

- continue parsing a filtering rule even if a faulty entry is encountered; return an error value at the end and let the caller decide what to do with the rule's object

- fix an error message

15 years agobuild: import latest gnulib
Eric Blake [Wed, 31 Mar 2010 23:02:10 +0000 (17:02 -0600)]
build: import latest gnulib

A lot of syntax check rules have to be rewritten, but the
result is easier to maintain.  I tested each syntax rule
by intentionally introducing a temporary violation of the rule.
Additionally, some false positives for unmarked_diagnostics
crept in, and an improved copyright_format test caught some bugs.

* .gnulib: Update to latest.
* cfg.mk (sc_prohibit_test_minus_ao): Delete, it was moved into
gnulib's maint.mk.
(sc_avoid_write, sc_prohibit_strcmp_and_strncmp)
(sc_prohibit_asprintf, sc_prohibit_strncpy, sc_prohibit_readlink)
(sc_prohibit_gethostname, sc_prohibit_gettext_noop)
(sc_prohibit_VIR_ERR_NO_MEMORY, sc_prohibit_nonreentrant)
(sc_prohibit_ctype_h, sc_TAB_in_indentation)
(sc_avoid_ctype_macros)
(sc_prohibit_virBufferAdd_with_string_literal)
(sc_prohibit_gethostby, sc_copyright_format): Rewrite in terms of
new maint.mk macros.
(sc_libvirt_unmarked_diagnostics): Fix whitespace.
* .x-sc_unmarked_diagnostics: New file.
* tests/object-locking.ml: Fix copyright.
* tools/virt-pki-validate.in: Likewise.
* tools/virt-xml-validate.in: Likewise.

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