]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
15 years agoImprove the apparmor example
Jamie Strandboge [Tue, 6 Apr 2010 20:56:07 +0000 (22:56 +0200)]
Improve the apparmor example

* examples/apparmor/libvirt-qemu examples/apparmor/usr.sbin.libvirtd
  examples/apparmor/usr.lib.libvirt.virt-aa-helper: Update the examples

15 years agoImprove virt-aa-helper to handle SDL graphics and cleanups
Jamie Strandboge [Tue, 6 Apr 2010 20:53:43 +0000 (22:53 +0200)]
Improve virt-aa-helper to handle SDL graphics and cleanups

* src/security/virt-aa-helper.c: add support for SDL devices and 3
  code cleanups

15 years agoAdjust virt-aa-helper to handle pci devices
Jamie Strandboge [Tue, 6 Apr 2010 15:57:36 +0000 (17:57 +0200)]
Adjust virt-aa-helper to handle pci devices

* src/security/virt-aa-helper.c: adjust virt-aa-helper to handle pci
  devices. Update valid_path() to have an override array to check against,
  and add "/sys/devices/pci" to it. Then rename file_iterate_cb() to
  file_iterate_hostdev_cb() and create file_iterate_pci_cb() based on it

15 years agoAdd backingstore support to apparmor
Jamie Strandboge [Tue, 6 Apr 2010 15:22:39 +0000 (17:22 +0200)]
Add backingstore support to apparmor

adjust virt-aa-helper to handle backing store
* src/security/virt-aa-helper.c: look for backing store metadata
  for disk definitions.

15 years agoAdd VIR_DOMAIN_XML_INACTIVE flag when parsing domain XML
Jamie Strandboge [Tue, 6 Apr 2010 14:47:33 +0000 (16:47 +0200)]
Add VIR_DOMAIN_XML_INACTIVE flag when parsing domain XML

To avoid an error when hitting the <seclabel...> definition
* src/security/virt-aa-helper.c: add VIR_DOMAIN_XML_INACTIVE flag
  to virDomainDefParseString

15 years agovirt-aa-helper should not fail if profile was removed
Jamie Strandboge [Tue, 6 Apr 2010 14:17:08 +0000 (16:17 +0200)]
virt-aa-helper should not fail if profile was removed

Don't exit with error if the user unloaded the profile outside of
 libvirt
* src/security/virt-aa-helper.c: check the exit error from apparmor_parser
  before exiting with a failure

15 years agoDo nor clear caps when invoking virt-aa-helper
Jamie Strandboge [Tue, 6 Apr 2010 14:05:47 +0000 (16:05 +0200)]
Do nor clear caps when invoking virt-aa-helper

The calls to virExec() in security_apparmor.c when
invoking virt-aa-helper use VIR_EXEC_CLEAR_CAPS. When compiled without
libcap-ng, this is not a problem (it's effectively a no-op) but with
libcap-ng this causes MAC_ADMIN to be cleared. MAC_ADMIN is needed by
virt-aa-helper to manipulate apparmor profiles and without it VMs will
not start[1]. This patch calls virExec with the default VIR_EXEC_NONE
instead.
* src/security/security_apparmor.c: fallback to VIR_EXEC_NONE flags for
  virExec of virt_aa_helper

15 years agoFix 'avialable' typo
Matthias Bolte [Tue, 6 Apr 2010 19:44:11 +0000 (21:44 +0200)]
Fix 'avialable' typo

Reported by Paul Jenner

15 years agobuild: avoid autogen on 'make clean'
Eric Blake [Tue, 6 Apr 2010 19:08:01 +0000 (13:08 -0600)]
build: avoid autogen on 'make clean'

Tested by running 'git submodule foreach git pull origin master' and
'git add .gnulib', then seeing that 'make clean' skips autogen
although 'make' properly runs it.

* cfg.mk (_clean_requested): New check, to speed up 'make clean'
even if gnulib submodule is outdated.
Suggested by Daniel P. Berrange.

15 years agoFix for nwfilter: Add filter schema for nwfilter XML, extend domain XML schema
Stefan Berger [Tue, 6 Apr 2010 20:40:49 +0000 (16:40 -0400)]
Fix for nwfilter: Add filter schema for nwfilter XML, extend domain XML schema

Fixing the regular expressions for variables where the first letter must be a $.

15 years agomacvtap: Remove virConnectPtr from ReportError
Matthias Bolte [Sat, 3 Apr 2010 15:31:24 +0000 (17:31 +0200)]
macvtap: Remove virConnectPtr from ReportError

Also rename ReportError to macvtapError.

15 years agophyp: Remove virConnectPtr from PHYP_ERROR
Matthias Bolte [Sat, 3 Apr 2010 00:49:39 +0000 (02:49 +0200)]
phyp: Remove virConnectPtr from PHYP_ERROR

15 years agovirterror.c: avoid erroneous case "fall-through"
Jim Meyering [Tue, 6 Apr 2010 17:07:14 +0000 (19:07 +0200)]
virterror.c: avoid erroneous case "fall-through"

* src/util/virterror.c (virErrorMsg): Insert missing "break;"

15 years agoesx: Mark error messages for translation
Matthias Bolte [Fri, 2 Apr 2010 19:34:31 +0000 (21:34 +0200)]
esx: Mark error messages for translation

Also define ESX_ERROR and ESX_VI_ERROR in a central place, instead of
defining them in each source file.

Add ESX_ERROR and ESX_VI_ERROR to the msg_gen_function list in cfg.mk.

Update po/POTFILES.in accordingly.

15 years agovbox: Mark all error messages for translation
Matthias Bolte [Sat, 3 Apr 2010 19:17:00 +0000 (21:17 +0200)]
vbox: Mark all error messages for translation

Add vboxError to the msg_gen_function list in cfg.mk.

15 years agonwfilter: Add filter schema for nwfilter XML, extend domain XML schema
Stefan Berger [Tue, 6 Apr 2010 15:09:46 +0000 (11:09 -0400)]
nwfilter: Add filter schema for nwfilter XML, extend domain XML schema

This patch adds a relaxng nwfilter schema along with a test that
verifies all the test output XML against the schema. The input XMLs
contain a lot of intentional out-of-range values that make them fail the
schema verification, so I am not verifying against those.

15 years agonwfilter: Fix instantiated layer 2 rules for 'inout' direction
Stefan Berger [Tue, 6 Apr 2010 14:40:35 +0000 (10:40 -0400)]
nwfilter: Fix instantiated layer 2 rules for 'inout' direction

With Eric Blake's suggestions applied.

The following rule for direction 'in'

<rule direction='in' action='drop'>
  <mac srcmacaddr='1:2:3:4:5:6'/>
</rule>

drops all traffic from the given mac address.
The following rule for direction 'out'

<rule direction='out' action='drop'>
  <mac dstmacaddr='1:2:3:4:5:6'/>
</rule>

drops all traffic to the given mac address.
The following rule in direction 'inout'

<rule direction='inout' action='drop'>
  <mac srcmacaddr='1:2:3:4:5:6'/>
</rule>

now drops all traffic from and to the given MAC address.
So far it would have dropped traffic from the given MAC address
and outgoing traffic with the given source MAC address, which is not useful
since the packets will always have the VM's MAC address as source
MAC address. The attached patch fixes this.

This is the last bug I currently know of and want to fix.

15 years agovirsh: improve documentation
Eric Blake [Mon, 5 Apr 2010 23:21:02 +0000 (17:21 -0600)]
virsh: improve documentation

Document several missing commands.  There's more work that could be
done, but incremental improvements is better than no patch at all.

* tools/virsh.pod (autostart, connect): Improve grammar.
(create): Improve example.
(domjobabort, domjobinfo, domxml-from-native, domxml-to-native):
Document.
(storage pool commands): New section.

15 years agoClarify an error message in setmem.
Chris Lalancette [Fri, 12 Mar 2010 17:14:48 +0000 (12:14 -0500)]
Clarify an error message in setmem.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix up comments for isEncrypted, isSecure, domainIsActive,
Chris Lalancette [Tue, 23 Mar 2010 18:00:38 +0000 (14:00 -0400)]
Fix up comments for isEncrypted, isSecure, domainIsActive,
and domainIsPersistent.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoDocument snapshot virsh commands in the man page.
Chris Lalancette [Mon, 5 Apr 2010 15:17:42 +0000 (11:17 -0400)]
Document snapshot virsh commands in the man page.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoBetter error reporting in virsh.
Chris Lalancette [Sat, 3 Apr 2010 01:24:50 +0000 (21:24 -0400)]
Better error reporting in virsh.

When hitting failures in virsh, a common idiom is
to jump to a cleanup label, free some resources, and
then return a FALSE error code to vshCommandRun.
In theory, vshCommandRun is then supposed to print
out the last error.  The problem is that many of
the cleanup paths have library calls to free resources,
and all of those library calls clear out the last error.
This is leading to situations where no error is being
reported at all.

This patch remedies the situation somewhat by
printing out the errors inside the command methods
themselves when we know it will go through a cleanup
path that will lose the error.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoWebsite documentation for the snapshot XML.
Chris Lalancette [Mon, 5 Apr 2010 17:27:41 +0000 (13:27 -0400)]
Website documentation for the snapshot XML.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoIncrease the number of available VNC ports.
Chris Lalancette [Tue, 23 Mar 2010 13:25:31 +0000 (09:25 -0400)]
Increase the number of available VNC ports.

When starting up qemu VNC autoport guests, we were
only looking through ports 5900 to 6000, meaning we
were limited to 100 total clients.  Increase that
limit to 65535 (the last available port), so we can
have up to 59635 VNC autoport guests.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoThis patch fixes some compilation issues for the RHEL5 build. I am also removing...
Stefan Berger [Tue, 6 Apr 2010 10:29:00 +0000 (06:29 -0400)]
This patch fixes some compilation issues for the RHEL5 build. I am also removing the IPV6 constant where it appears in the wrong place.

15 years agoFix compiler warning about unused conn parameter
Matthias Bolte [Tue, 6 Apr 2010 09:47:28 +0000 (11:47 +0200)]
Fix compiler warning about unused conn parameter

This only affects builds without NUMA support.

15 years agoopenvz: Remove virConnectPtr from openvzError
Matthias Bolte [Sat, 3 Apr 2010 14:23:45 +0000 (16:23 +0200)]
openvz: Remove virConnectPtr from openvzError

Also remove unused enum values OPENVZ_WARN and OPENVZ_ERR.

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 '_'.