Commit Graph

202 Commits

Author SHA1 Message Date
Eric Blake
72181978d5 maint: avoid empty regex in syntax checker
We were defining 'func_or' as '|VIR_ERROR|...', which when put
inside 'func_re' resulted in a regex that matches everything in
isolation.  Thankfully, we always used func_re with a leading
anchor \<, and since the empty regex does not start a word, we
happened to get the result we wanted; but it's better to define
func_or without a leading space converted into a leading empty
alternation.

* cfg.mk (func_or): Strip leading space.
2012-07-26 12:22:02 -06:00
Eric Blake
f12e139621 build: update to latest gnulib, for secure tarball
Pick up some build fixes in the latest gnulib.  In particular,
we want to ensure that official tarballs are secure, but don't
want to penalize people who don't run 'make dist', since fixed
automake still hasn't hit common platforms like Fedora 17.

* .gnulib: Update to latest, for Automake CVE-2012-3386 detection.
* bootstrap: Resync from gnulib.
* bootstrap.conf (gnulib_extra_files): Drop missing, since gnulib
has dropped it in favor of Automake's version.
* cfg.mk (local-checks-to-skip): Conditionally skip the security
check in cases where it doesn't matter.
2012-07-26 07:50:59 -06:00
Osier Yang
49989d7025 virsh: Split cmds in node device group from virsh.c
Commands in node device group moved from virsh.c to virsh-nodedev.c,

* virsh.c: Remove commands in node device group.
* virsh-nodedev.c: New file, filled with commands in node device group
* po/POTFILES.in: Add virsh-nodedev.c
* cfg.mk: Skip to check config.h including for virsh-nodedev.c
2012-07-26 12:00:43 +08:00
Osier Yang
290eb0d9f2 virsh: Split cmds in host group from virsh.c
Commands in host group moved from virsh.c to virsh-host.c,

* virsh.c: Remove commands in host group.
* virsh-host.c: New file, filled with commands in host group
* po/POTFILES.in: Add virsh-host.c
* cfg.mk: Skip to check config.h including for virsh-host.c
2012-07-26 12:00:43 +08:00
Osier Yang
648ad2471b virsh: Split cmds to manage domain snapshot from virsh.c
Commands to manage domain snapshot are moved from virsh.c to
virsh-snapshot.c.

* virsh.c: Remove domain snapshot commands.
* virsh-snapshot.c: New file, filled with domain snapshot commands.
* po/POTFILES.in: Add virsh-snapshot.c
* cfg.mk: Skip strcase and config.h including checking for
          virsh-snapshot.c
2012-07-26 12:00:43 +08:00
Osier Yang
d7acdcf093 virsh: Split cmds to manage secret from virsh.c
Commands to manage secret are moved from virsh.c to virsh-secret.c,
with a few helpers for secret command use.

* virsh.c: Remove secret commands and a few helpers.
           (vshCommandOptSecret, and vshCommandOptSecretBy)
* virsh-secret.c: New file, filled with secret commands and its helpers.
* po/POTFILES.in: Add virsh-secret.c
* cfg.mk: Skip to check config.h including for virsh-secret.c
2012-07-26 12:00:43 +08:00
Osier Yang
e9d10055df virsh: Split cmds to manage network filter from virsh.c
Commands to manage network filter are moved from virsh.c to virsh-nwfilter.c,
with a few helpers for network filter command use.

* virsh.c: Remove network filter commands and a few helpers.
           (vshCommandOptNWFilter, and vshCommandOptNWFilterBy)
* virsh-nwfilter.c: New file, filled with network filter commands and its helpers.

* po/POTFILES.in: Add virsh-nwfilter.c

* cfg.mk: Skip to check config.h including for virsh-nwfilter.c
2012-07-26 12:00:42 +08:00
Osier Yang
0c39ea2fa5 virsh: Split cmds to manage host interface from virsh.c
Commands to manage host interface are moved from virsh.c to
virsh-interface.c, with a few helpers for interface command use.

* virsh.c: Remove interface commands and a few helpers.
           (vshCommandOptInterface, vshCommandOptInterfaceBy)
* virsh-interface.c: New file, filled with interface commands and
                     its helpers.
* cfg.mk: Skip to check config.h including for virsh-interface.c
* po/POTFILES.in: Add virsh-interface.c
2012-07-26 12:00:27 +08:00
Osier Yang
0510f97e73 virsh: Split cmds to manage network from virsh.c
Commands to manage network are moved from virsh.c to virsh-network.c,
with a few helpers for network command use.

* virsh.c: Remove network commands and a few helpers.
* virsh-network.c: New file, filled with network commands and its
                   helpers.
* po/POTFILES.in: Add virsh-network.c
* cfg.mk: Skip to check config.h including for virsh-network.c
2012-07-26 11:57:58 +08:00
Osier Yang
2f033890c6 virsh: Split cmds of storage pool group from virsh.c
This splits commands of storage pool group into virsh-pool.c,
The helpers not for common use are moved too. Standard copyright
is added for the new file.

* tools/virsh.c:
  Remove commands for storage storage pool and a few helpers.
  (vshCommandOptVol, vshCommandOptVolBy).

* tools/virsh-pool.c:
  New file, filled with commands of storage pool group and its
  helpers.

* po/POTFILES.in:
  Add virsh-pool.c

* cfg.mk:
  Skip to check config.h including for virsh-pool.c
2012-07-26 11:57:51 +08:00
Osier Yang
9fbb344f6e virsh: Split cmds of storage volume group from virsh.c
This splits commands of storage volume group into virsh-volume.c,
The helpers not for common use are moved too. Standard copyright
is added for the new file.

* tools/virsh.c:
  Remove commands for storage storage volume and a few helpers.
  (vshCommandOptVol, vshCommandOptVolBy).

* tools/virsh-volume.c:
  New file, filled with commands of storage volume group and its
  helpers.

* po/POTFILES.in:
  Add virsh-volume.c

* cfg.mk:
  Skip to check config.h including for virsh-volume.c
2012-07-26 11:57:42 +08:00
Osier Yang
73b89ed838 virsh: Split cmds of domain group from virsh.c
This splits commands to manage domain into virsh-domain.c,The helpers
not for common use are moved into them too. Standard copyright is added
for the new file.

* tools/virsh.c:
  - Remove commands for domain group, and one helper
    (vshDomainVcpuStateToString)
  - vshStreamSink is moved before commands's definition for it's
    also used by commands not of domain group, such as volUpload.

* tools/virsh-domain.c:
  - New file, commands for domain group and the one helper are
    moved into it.

* po/POTFILES.in:
  - Add virsh-domain.c

* cfg.mk:
  - Skip to check config.h including for virsh-domain.c
2012-07-26 11:57:18 +08:00
Osier Yang
9f4baa222e virsh: Split cmds for domain monitoring from virsh.c
This splits commands commands to monitor domain status into
virsh-domain-monitor.c. The helpers not for common use are moved too.
Standard copyright is added.

* tools/virsh.c:
  - Remove commands for domain monitoring group and a few helpers (
    vshDomainIOErrorToString, vshGetDomainDescription,
    vshDomainControlStateToString, vshDomainStateToString) not for
    common use.
  - Remove (incldue "intprops.h").

* tools/virsh-domain-monitor.c:
  - New file, filled with commands of domain monitor group.
  - Add "intprops.h".

* cfg.mk:
  - Skip strcase checking for virsh-domain-monitor.c
  - Skip to check config.h including for virsh-domain-monitor.c

* po/POTFILES.in
  - Add virsh-domain-monitor.c
2012-07-26 11:56:36 +08:00
Daniel P. Berrange
e48daff7bb Replace use of custom macros with virReportError in the Xen drivers
Update the legacy Xen drivers to use virReportError instead of
the statsError, virXenInotifyError, virXenStoreError,
virXendError, xenUnifiedError, xenXMError custom macros

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-20 15:10:54 +01:00
Daniel P. Berrange
c7af2c125e Replace use of VMX_ERROR with virReportError
Update the VMX shared code to use virReportError instead of
the VMX_ERROR custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-20 14:40:28 +01:00
Daniel P. Berrange
edb768c9ce Replace use of virConfError with virReportError
Update the libvirtd config handling code to use virReportError
instead of the virConfError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-20 14:39:47 +01:00
Daniel P. Berrange
47ab34e232 Replace use of nodeReportError with virReportError
Update the nodeinfo helper code to use virReportError instead
of the nodeReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-20 14:04:08 +01:00
Daniel P. Berrange
b8605b22e5 Replace use of virSecurityReportError with virReportError
Update the security drivers to use virReportError instead of
the virSecurityReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-20 13:59:58 +01:00
Daniel P. Berrange
0653554bc5 Replace use of PHYP_ERROR with virReportError
Update the Power-Hypervisor driver to use virReportError
instead of the PHYP_ERROR custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-20 13:52:20 +01:00
Daniel P. Berrange
d9de122052 Replace use of HYPERV_ERROR with virReportError
Update the Hyper-V driver to use virReportError instead
of the HYPERV_ERROR custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-20 13:52:06 +01:00
Daniel P. Berrange
cf8cff035c Replace use of ESX_ERROR & ESX_VI_ERROR with virReportError
Update the ESX driver to use virReportError instead of
the ESX_ERROR & ESX_VI_ERROR custom macros

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-20 13:51:57 +01:00
Daniel P. Berrange
3445a3ec2f Replace use of libxlError with virReportError
Update the libxl driver to use virReportError instead of
the libxlError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-20 13:18:49 +01:00
Daniel P. Berrange
0e9047ced5 Replace use of streamsReportError with virReportError
Update the streams code to use virReportError instead of
the streamsReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-20 12:42:53 +01:00
Daniel P. Berrange
4e28b322d4 Replace use of remoteError with virReportError
Update the remote driver to use virReportError instead of
the remoteError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-20 12:42:03 +01:00
Daniel P. Berrange
76a0ecd2cd Replace use of XENXS_ERROR with virReportError
Update the XenXS shared code to use virReportError instead
of the XENXS_ERROR custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-20 12:41:52 +01:00
Daniel P. Berrange
29bf82593c Replace use of openvzError with virReportError
Update the OpenVZ driver to use virReportError instead of
the openvzError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-20 12:41:47 +01:00
Daniel P. Berrange
a8483d425e Fix Xen driver to have sensible error messages
The Xen driver had a number of error reports which passed a
constant string without format specifiers and was missing
"%s". Furthermore the errors were related to failing system
calls, but virReportSystemError was not used. So the only
useful piece of info (the errno) was being discarded
2012-07-20 12:40:10 +01:00
Daniel P. Berrange
cb78198aa6 Replace use of vmwareError with virReportError
Update the VMWare driver to use virReportError instead of
the vmwareError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-19 16:20:28 +01:00
Daniel P. Berrange
e578bc2683 Replace use of virCPUReportError with virReportError
Update the CPU helper APIs to use virReportError instead
of the virCPUReportError custom macor

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-19 16:20:01 +01:00
Daniel P. Berrange
51f6e5a6ef Replace use of vboxError with virReportError
Update the VirtualBox driver to use virReportError instead of
the vboxError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-19 16:19:40 +01:00
Daniel P. Berrange
3b7399b5c9 Replace use of qemuReportError with virReportError
Update the QEMU driver to use virReportError instead of
the qemuReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-19 14:42:28 +01:00
Daniel P. Berrange
e2038d2d30 Replace use of umlReportError with virReportError
Update the UML driver to use virReportError instead of the
umlReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-19 14:41:49 +01:00
Daniel P. Berrange
19f128eef3 Replace use of networkReportError with virReportError
Update the linux bridge driver to use virReportError instead
of the networkReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-19 10:15:38 +01:00
Daniel P. Berrange
4423f3bece Replace use of interfaceReportError with virReportError
Update the netcf driver to use virReportError instead of the
interfaceReportError custom macro
2012-07-18 21:27:30 +01:00
Daniel P. Berrange
fa7ebc174f Replace use of virNWFilterReportError with virReportError
Update the network filter driver to use virReportError instead
of the virNWFilterReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 21:16:25 +01:00
Daniel P. Berrange
df5232f554 Replace use of virNodeDeviceReportError with virReportError
Update the node device driver to use virReportError instead of
the virNodeDeviceReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 19:34:26 +01:00
Daniel P. Berrange
54e520d3aa Replace use of virSecretReportError with virReportError
Update the secret driver to use virReportError instead of the
virSecretReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 19:34:21 +01:00
Daniel P. Berrange
d8a1c4c49f Replace use of virStorageReportError with virReportError
Update the storage driver to use virReportError instead of
the virStorageReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 19:34:16 +01:00
Daniel P. Berrange
1e0bb184a7 Convert all files in src/conf/ to use virReportError()
This removes all the per-file error reporting macros
from the code in src/conf/

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 19:01:50 +01:00
Daniel P. Berrange
f6d4405e3c Convert (nearly) all files in src/util/ to use virReportError()
This removes nearly all the per-file error reporting macros
from the code in src/util/. A few custom macros remain for the
case, where the file needs to report errors with a variety of
different codes or parameters

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 16:31:35 +01:00
Daniel P. Berrange
7e94acd4fc Introduce virReportError macro for general error reporting
Nearly every source file does something like

  #define VIR_FROM_THIS VIR_FROM_FOO
  #define virFooReportErorr(code, ...) \
     virReportErrorHelper(VIR_FROM_THIS, code,  __FILE__,    \
                          __FUNCTION__, __LINE__, \
                          __VA_ARGS__)

This creates needless duplication and inconsistent error
reporting function names in each file. It is trivial to
just have virterror_internal.h provide a virReportError
macro that is equivalent

* src/util/virterror_internal.h: Define virReportError(code, ...)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-18 14:01:10 +01:00
Eric Blake
0867a87721 build: detect all improper uses of _("%s")
The only useful translation of "%s" as a format string is "%s" (I
suppose you could claim "%1$s" is also valid, but why bother).  So
it is not worth translating; fixing this exposes some instances
where we were failing to translate real error messages.  This makes
the fix of commit 097da1ab more generic, as well as ensuring no
future regressions.

* cfg.mk (sc_prohibit_useless_translation): New rule.
* src/lxc/lxc_driver.c (lxcSetVcpuBWLive): Fix offender.
* src/openvz/openvz_conf.c (openvzReadFSConf): Likewise.
* src/qemu/qemu_cgroup.c (qemuSetupCgroupForVcpu): Likewise.
* src/qemu/qemu_driver.c (qemuSetVcpusBWLive): Likewise.
* src/xenapi/xenapi_utils.c (xenapiSessionErrorHandle): Likewise.
2012-07-10 15:49:41 -06:00
Eric Blake
85815b6a40 build: fix sc_prohibit_readlink
I noticed this during 'make syntax-check':

prohibit_readlink
grep: Unmatched ( or \(

* cfg.mk (exclude_file_name_regexp--sc_prohibit_readlink): Fix
mismatched '('.
2012-06-04 09:29:21 -06:00
Michal Privoznik
0766783abb virsh: Switch from generated cmd*Edit commands to nongenerated
Currently, we either generate some cmd*Edit commands (cmdPoolEdit
and cmdNetworkEdit) via sed script or copy the body of cmdEdit
(e.g. cmdInterfaceEdit, cmdNWFilterEdit, etc.). This fact makes
it harder to implement any new feature to our editing system.
Therefore switch to new implementation - define macros to:
- dump XML (EDIT_GET_XML)
- take an action if XML wasn't changed,
  usually just vshPrint() (EDIT_NOT_CHANGED)
- define new object (EDIT_DEFINE) - the edited XML is in @doc_edited
- free object defined by EDIT_DEFINE (EDIT_FREE)
and #include "virsh-edit.c"
2012-06-02 10:40:51 +02:00
Eric Blake
dc4301c726 virsh: avoid strncpy
strncpy is generally evil - it runs the risk of missing NUL
termination, and more often than not wastes time zeroing way
more bytes than strictly necessary.  We've avoided this evil
in our virStrncpy wrapper, except for places where we forgot
to use the wrapper; meanwhile, we have also added an even
higher layer wrapper for setting virTypedParameter values.

* tools/virsh.c (cmdMemtune, cmdBlkdeviotune): Use modern API.
* cfg.mk (exclude_file_name_regexp--sc_prohibit_strncpy): Tighten.
2012-05-29 09:24:48 -06:00
Eric Blake
e925ea3156 build: update to latest gnulib
Gnulib finally relaxed the isatty license, needed as first mentioned here:
https://www.redhat.com/archives/libvir-list/2012-February/msg01022.html

Other improvements include better syntax-check rules (we can delete one
of ours now that it is a duplicate) and better compiler warning usage.

* .gnulib: Update to latest, for isatty.
* cfg.mk (sc_prohibit_strncpy): Drop a now-redundant rule.
* bootstrap.conf (gnulib_modules): Add isatty.
* bootstrap: Resync from gnulib.
2012-05-29 08:43:55 -06:00
Daniel P. Berrange
ebbcc02639 Remove last usage of PATH_MAX and ban its future use
Remove a number of pointless checks against PATH_MAX and
add a syntax-check rule to prevent its use in future

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-05-28 10:43:01 +01:00
Eric Blake
3337ba6dc7 build: fix recent syntax-check breakage
The use of readlink() in lxc_container.c is intentional; we don't
want an absolute pathname there.

* src/util/cgroup.h (VIR_CGROUP_SYSFS_MOUNT): Indent properly.
* cfg.mk (exclude_file_name_regexp--sc_prohibit_readlink): Add
exemption.
2012-05-16 09:52:44 -06:00
Jiri Denemark
63b4243624 qemu: Add support for -no-user-config
Thanks to this new option we are now able to use modern CPU models (such
as Westmere) defined in external configuration file.

The qemu-1.1{,-device} data files for qemuhelptest are filled in with
qemu-1.1-rc2 output for now. I will update those files with real
qemu-1.1 output once it is released.
2012-05-15 20:29:12 +02:00
Eric Blake
891a7f9e23 nodeinfo: add some more tests
Test 2 data grabbed from a 2-core 1-node laptop.
Test 3 data grabbed from a 48-cpu AMD Magny Cours box.

* tests/nodeinfodata/linux-nodeinfo-sysfs-test-2*: New test data.
* tests/nodeinfodata/linux-nodeinfo-sysfs-test-3*: Likewise.
* tests/nodeinfotest.c (mymain): Run them.
* cfg.mk
(exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF): Exempt
new test files.
2012-05-14 11:18:26 -06:00