]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
15 years agovirStorageBackendFileSystemMount: prefer strdup over virAsprintf
Jim Meyering [Wed, 14 Apr 2010 08:03:03 +0000 (10:03 +0200)]
virStorageBackendFileSystemMount: prefer strdup over virAsprintf

* src/storage/storage_backend_fs.c (virStorageBackendFileSystemMount):
Use virAsprintf only when needed.  In this case, strdup works fine.

15 years agovirStorageBackendFileSystemMount: placate clang
Jim Meyering [Wed, 14 Apr 2010 08:00:53 +0000 (10:00 +0200)]
virStorageBackendFileSystemMount: placate clang

* src/storage/storage_backend_fs.c (virStorageBackendFileSystemMount):
Clang was not smart enough, and mistakenly reported that "options"
could be used uninitialized.  Initialize it.

15 years agoImplement forgotten backend of virInterfaceIsActive()
Laine Stump [Tue, 13 Apr 2010 17:22:56 +0000 (13:22 -0400)]
Implement forgotten backend of virInterfaceIsActive()

Somehow the backend of this function was never implemented in
libvirt's netcf driver, and nobody noticed until now. (The required
netcf function was already in place, so nothing needs to change
there.)
* src/interface/netcf_driver.c: add in the backend function, and point
                                to it from the table of driver functions.

15 years agoopenvzGetProcessInfo: address clang-detected low-probability flaw
Jim Meyering [Wed, 14 Apr 2010 07:09:57 +0000 (09:09 +0200)]
openvzGetProcessInfo: address clang-detected low-probability flaw

* src/openvz/openvz_driver.c (openvzGetProcessInfo): Reorganize
so that unexpected /proc/vz/vestat content cannot make us use
uninitialized variables.  Without this change, an input line with
a matching "readvps", but fewer than 4 numbers would result in our
using at least "systime" uninitialized.

15 years agovshCommandRun: avoid used-uninitialized timing-related report from clang
Jim Meyering [Wed, 14 Apr 2010 07:04:28 +0000 (09:04 +0200)]
vshCommandRun: avoid used-uninitialized timing-related report from clang

* tools/virsh.c (vshCommandRun): Test only the initial value of
ctl->timing, so that static analyzers don't have to consider that
it might be changed by cmd->def->handler.

15 years agonwfilter: use virFindFileInPath for needed CLI tools
Stefan Berger [Wed, 14 Apr 2010 10:29:55 +0000 (06:29 -0400)]
nwfilter: use virFindFileInPath for needed CLI tools

I am getting rid of determining the path to necessary CLI tools at
compile time. Instead, now the firewall driver has an initialization
function that uses virFindFileInPath() to determine the path to
necessary CLI tools and a shutdown function to free allocated memory.
The rest of the patch mostly deals with availability of the CLI tools
and to not call certain code blocks if a tool is not available and that
strings now have to be built slightly differently.

15 years agoesx: Extend esx_vi_generator.py to cover methods too
Matthias Bolte [Tue, 13 Apr 2010 12:25:52 +0000 (14:25 +0200)]
esx: Extend esx_vi_generator.py to cover methods too

Generate almost all SOAP method mapping code.

Update the driver code to use the complete paramater list of some methods
that had parameters skipped before.

Improve the ESX_VI__METHOD marco to do automatic output deserialization
based on output occurrence. Also incorporate automatic _this binding and
output pointer check.

15 years agoesxVMX_GatherSCSIControllers: avoid NULL dereference
Jim Meyering [Wed, 14 Apr 2010 08:18:20 +0000 (10:18 +0200)]
esxVMX_GatherSCSIControllers: avoid NULL dereference

* src/esx/esx_vmx.c (esxVMX_GatherSCSIControllers): Do not dereference
a NULL disk->driverName.  We already detect this condition in another
case.  Check for it here, too.

15 years agoFix build of openvz on RHEL-5.
Chris Lalancette [Tue, 6 Apr 2010 19:33:32 +0000 (15:33 -0400)]
Fix build of openvz on RHEL-5.

When building libvirt on RHEL-5, I saw this error:

cc1: warnings being treated as errors
openvz/openvz_conf.c: In function 'openvzGetVPSUUID':
openvz/openvz_conf.c:835: warning: 'saveptr' may be used uninitialized in this function
make[3]: *** [libvirt_driver_openvz_la-openvz_conf.lo] Error 1

gcc in RHEL-5 gets upset about this usage of strtok_r (even though
it is perfectly valid).  Just set *saveptr to NULL at the
start to quiet it down.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix up formatting of remote protocol stuff.
Chris Lalancette [Wed, 7 Apr 2010 15:23:11 +0000 (11:23 -0400)]
Fix up formatting of remote protocol stuff.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix messsage -> message.
Chris Lalancette [Thu, 8 Apr 2010 12:19:35 +0000 (08:19 -0400)]
Fix messsage -> message.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix up a debug typo.
Chris Lalancette [Thu, 8 Apr 2010 12:47:02 +0000 (08:47 -0400)]
Fix up a debug typo.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoRemove some debugging leftovers.
Chris Lalancette [Thu, 8 Apr 2010 14:29:46 +0000 (10:29 -0400)]
Remove some debugging leftovers.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoConsolidate interface related functions in interface.c
Stefan Berger [Tue, 13 Apr 2010 14:57:11 +0000 (10:57 -0400)]
Consolidate interface related functions in interface.c

Changes from v1 to v2:
- changed function name prefixes to 'iface' from previous 'Iface'

- Further to make make syntax-check pass:
 - indentation fix in interface.h
 - added entry to POTFILES.in

I am consolidating network interface related functions used in nwfilter
and macvtap code in utils/interface.c. All function names are prefixed
with 'Iface'. The following functions are now available through
interface.h:

int ifaceCtrl(const char *name, bool up);
int ifaceUp(const char *name);
int ifaceDown(const char *name);

int ifaceCheck(bool reportError, const char *ifname,
               const unsigned char *macaddr, int ifindex);

int ifaceGetIndex(bool reportError, const char *ifname, int *ifindex);

I added 'int ifindex' as parameter to ifaceCheck to the original
function and modified the code accordingly.

15 years agoFix nodeinfotest on NUMA machines
Daniel P. Berrange [Tue, 13 Apr 2010 10:39:16 +0000 (11:39 +0100)]
Fix nodeinfotest on NUMA machines

The nodeinfotest was reliant on the host NUMA topology, but all
the test data files assumed 1 single NUMA node. This test thus
failed on any NUMA machine with > 1 node

* tests/nodeinfotest.c: Hardcode 1 single numa node

15 years agobuild: include usleep gnulib module
Eric Blake [Mon, 12 Apr 2010 21:56:19 +0000 (15:56 -0600)]
build: include usleep gnulib module

Without this module, attempts to sleep for 1 or more seconds
on mingw instead become a no-delay no-op.

* bootstrap.conf (gnulib_modules): Add usleep.

15 years agoFix spec file for builds without lxc
Daniel Berteaud [Tue, 13 Apr 2010 08:40:21 +0000 (10:40 +0200)]
Fix spec file for builds without lxc

* libvirt.spec.in: fix a cut and paste error

15 years agobuild: fix syntax-check problems
Eric Blake [Mon, 12 Apr 2010 22:43:05 +0000 (16:43 -0600)]
build: fix syntax-check problems

* .x-sc_prohibit_gettext_noop: Add new exemption.
* .x-sc_prohibit_test_minus_ao: Likewise.
* Makefile.am (EXTRA_DIST): Distribute new files.
* .gitignore: Ignore built file.

15 years agoadd nwfilter functions to virsh man page
Stefan Berger [Mon, 12 Apr 2010 21:50:31 +0000 (17:50 -0400)]
add nwfilter functions to virsh man page

With Eric Blake's spelling corrections applied.

Unfortunately after the 0.8.0 release, but here's a beginning of the
documentation of the nwfilter functionality.

15 years agoRelease of libvirt-0.8.0
Daniel Veillard [Mon, 12 Apr 2010 17:39:20 +0000 (19:39 +0200)]
Release of libvirt-0.8.0

* configure.ac docs/news.html.in libvirt.spec.in src/libvirt_public.syms:
  updates for release of 0.8.0
* po/*.po po/libvirt.pot: updated a lar set of localizations, and merge
  the messages

15 years agoAdd documentation for synchronous hooks
Daniel Veillard [Mon, 12 Apr 2010 15:13:32 +0000 (17:13 +0200)]
Add documentation for synchronous hooks

* docs/sitemap.html.in: add in navigation under
  Documentation/Deployment/Hooks
* docs/hooks.html.in: new doc describing current support for 0.8.0

15 years agoRename virsh "revert-to-snapshot" to "snapshot-revert"
Chris Lalancette [Mon, 12 Apr 2010 13:36:13 +0000 (09:36 -0400)]
Rename virsh "revert-to-snapshot" to "snapshot-revert"

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoSmall fixes to virsh man page
Luiz Capitulino [Mon, 12 Apr 2010 12:22:02 +0000 (14:22 +0200)]
Small fixes to virsh man page

* tools/virsh.pod: add two missing 's' and section about 'dominfo' is
  duplicated

15 years agonwfilter: Fix memory leak on daemon init and shutdown
Stefan Berger [Mon, 12 Apr 2010 12:19:11 +0000 (08:19 -0400)]
nwfilter: Fix memory leak on daemon init and shutdown

This patch fixes a memory leak on daemon init and shutdown. The module
was initialized twice and not shut down.

15 years agonwfilter: Process DHCP option to determine whether packet is a DHCP_OFFER
Stefan Berger [Fri, 9 Apr 2010 19:54:29 +0000 (15:54 -0400)]
nwfilter: Process DHCP option to determine whether packet is a DHCP_OFFER

I mistakenly took the op field in the DHCP message as the DHCP_OFFER
type. Rather than basing the decision to read the VM's IP address on
that field, process the appended DHCP options where option 53 indicates
the actual type of the packet. I am also reading the broadcast address
of the VM, but don't use it so far.

15 years agoAdd enospace option to qemu disk error policy
David Allan [Thu, 8 Apr 2010 20:05:50 +0000 (16:05 -0400)]
Add enospace option to qemu disk error policy

* Dan Kenigsberg requested explicit support for the qemu default disk error policy which is enospace

15 years agoMore event callback fixes
Daniel P. Berrange [Thu, 8 Apr 2010 15:01:00 +0000 (16:01 +0100)]
More event callback fixes

In a couple of cases typos meant we were firing the wrong type
of event. In the python code my previous commit accidentally
missed some chunks of the code.

* python/libvirt-override-virConnect.py: Add missing python glue
  accidentally left out of previous commit
* src/conf/domain_event.c, src/qemu/qemu_monitor_json.c: Fix typos
  in event name / method name to invoke

15 years agoUndoing 2nd application of the patch...
Stefan Berger [Fri, 9 Apr 2010 14:05:59 +0000 (10:05 -0400)]
Undoing 2nd application of the patch...

15 years agoFix error in nwfilter test driver
Stefan Berger [Fri, 9 Apr 2010 13:55:22 +0000 (09:55 -0400)]
Fix error in nwfilter test driver

Trivial fix for the c&p error in the nwfilter test driver.

15 years agoFix error in nwfilter test driver
Stefan Berger [Fri, 9 Apr 2010 13:53:47 +0000 (09:53 -0400)]
Fix error in nwfilter test driver

Trivial fix for the c&p error in the nwfilter test driver.

15 years agoFix some cppi prepocessor indentation issues
Daniel Veillard [Fri, 9 Apr 2010 13:10:46 +0000 (15:10 +0200)]
Fix some cppi prepocessor indentation issues

* src/conf/nwfilter_conf.c src/util/hooks.c: added spaces to avoid
  "make syntax-check" failures

15 years agoqemu: catch cdrom change error
Ryan Harper [Fri, 9 Apr 2010 13:07:16 +0000 (15:07 +0200)]
qemu: catch cdrom change error

Currently when we attempt to change the cdrom in a qemu VM the monitor
doesn't generate an error if the target filename doesn't exist.  I've
submitted a patch[1] for this.  This patch is the libvirt qemu-driver
side which catches the error message from the monitor and reportes the
error to libvirt.  This means that virsh attach-disk cdrom commands
won't appear to succeed when qemu change command actually failed.

* src/qemu/qemu_monitor_text.c: in qemuMonitorTextChangeMedia() look
  for failure to access the new data

15 years agoAvoid using multicast addresses for Ethernet MAC examples
redshift [Fri, 9 Apr 2010 12:38:12 +0000 (14:38 +0200)]
Avoid using multicast addresses for Ethernet MAC examples

* docs/formatdomain.html.in: use '00:11:22:33:44:55' instead of
  '11:22:33:44:55:66'

15 years agonwfilter: More XML parser test cases
Stefan Berger [Fri, 9 Apr 2010 11:25:02 +0000 (07:25 -0400)]
nwfilter: More XML parser test cases

This patch adds a couple more nwfilter test cases for the XML parser tests.

15 years agoCleanup the msg_gen_function list in cfg.mk
Matthias Bolte [Fri, 9 Apr 2010 00:29:11 +0000 (02:29 +0200)]
Cleanup the msg_gen_function list in cfg.mk

Remove symbols that don't exist anymore (e.g. ERROR0) or aren't
message generating functions (e.g. VIR_FREE) or are now reported
as unmarked because the grep command is different, but that should
not be marked at all (e.g. DEBUG0).

Also don't restrict one of the grep lines in the
libvirt_unmarked_diagnostics rule to match exactly one space
between function name and opening parenthesis.

15 years agoremote: Replace some virRaiseError with remoteError
Matthias Bolte [Sat, 3 Apr 2010 17:17:53 +0000 (19:17 +0200)]
remote: Replace some virRaiseError with remoteError

15 years agoremote: Remove virConnectPtr from error/errorf
Matthias Bolte [Sat, 3 Apr 2010 12:55:42 +0000 (14:55 +0200)]
remote: Remove virConnectPtr from error/errorf

Also unify error/errorf to remoteError and update cfg.mk accordingly.

15 years agoRemove undefined symbols from symbols file
Matthias Bolte [Thu, 8 Apr 2010 18:45:38 +0000 (20:45 +0200)]
Remove undefined symbols from symbols file

15 years agoesx: Add domain snapshot support
Matthias Bolte [Wed, 7 Apr 2010 09:23:53 +0000 (11:23 +0200)]
esx: Add domain snapshot support

Fix invalid code generating in esx_vi_generator.py regarding deep copy
types that contain enum properties.

Add strptime and timegm to bootstrap.conf. Both are used to convert a
xsd:dateTime to calendar time.

Add a testcase of the xsd:dateTime conversion.

15 years agoGenerate libvirt.def from libvirt.syms
Matthias Bolte [Mon, 22 Mar 2010 01:25:36 +0000 (02:25 +0100)]
Generate libvirt.def from libvirt.syms

The MinGW linker needs the libvirt.def file.

15 years agoFix unterminated B<...> in virsh man page
Jiri Denemark [Thu, 8 Apr 2010 12:44:48 +0000 (14:44 +0200)]
Fix unterminated B<...> in virsh man page

15 years agoFix up python bindings for new event callbacks
Daniel P. Berrange [Fri, 26 Mar 2010 13:22:06 +0000 (13:22 +0000)]
Fix up python bindings for new event callbacks

The generator was disabled for the new event callbacks, since they
need to be hand written. This patch  adds the C and python glue to
expose the new APIs in the python binding. The python example
program is extended to demonstrate of the code

* python/libvirt-override.c: Registration and dispatch of events
   at the C layer
* python/libvirt-override-virConnect.py: Python glue for events
* examples/domain-events/events-python/event-test.py: Demo use
  of new event callbacks

15 years agoAdd missing nwfilter_learnipaddr.c to POTFILES.in
Daniel P. Berrange [Thu, 8 Apr 2010 11:01:00 +0000 (12:01 +0100)]
Add missing nwfilter_learnipaddr.c to POTFILES.in

* po/POTFILES.in: Add src/nwfilter/nwfilter_learnipaddr.c

15 years agoFix Win32 portability problems
Daniel P. Berrange [Wed, 7 Apr 2010 15:06:43 +0000 (16:06 +0100)]
Fix Win32 portability problems

The network filter / snapshot / hooks code introduced some
non-portable pices that broke the win32 build

* configure.ac: Check for net/ethernet.h required by nwfile config
   parsing code
* src/conf/nwfilter_conf.c: Define ethernet protocol  constants
  if net/ethernet.h is missing
* src/util/hooks.c: Disable hooks build on Win32 since it lacks
  fork/exec/pipe
* src/util/threads-win32.c: Fix unchecked return value
* tools/virsh.c: Disable SIGPIPE on Win32 since it doesn't exist.
  Fix non-portable strftime() formats

15 years agonwfilter: fix for directionality of ICMP traffic
Stefan Berger [Thu, 8 Apr 2010 10:25:38 +0000 (06:25 -0400)]
nwfilter: fix for directionality of ICMP traffic

Changes from V1 to V2 of this patch
- I had reversed the logic thinking that icmp type 0 is a echo
request,but it's reply -- needed to reverse the logic
- Found that ebtables takes the --ip-tos argument only as a hex number

This patch enables the skipping of some of the ICMP traffic rules on the
iptables level under certain circumstances so that the following filter
properly enables unidirectional pings:

<filter name='testcase'>
    <uuid>d6b1a2af-def6-2898-9f8d-4a74e3c39558</uuid>
    <!-- allow incoming ICMP Echo Request -->
    <rule action='accept' direction='in' priority='500'>
        <icmp type='8'/>
    </rule>
    <!-- allow outgoing ICMP Echo Reply -->
    <rule action='accept' direction='out' priority='500'>
        <icmp type='0'/>
    </rule>
    <!-- drop all other ICMP traffic -->
    <rule action='drop' direction='inout' priority='600'>
        <icmp/>
    </rule>
</filter>

15 years agoesx: Allow 'lsisas1068' as SCSI controller type
Matthias Bolte [Fri, 12 Mar 2010 19:08:47 +0000 (20:08 +0100)]
esx: Allow 'lsisas1068' as SCSI controller type

Extend tests to cover all SCSI controller types and document the
new type.

The lsisas1068 SCSI controller type was added in ESX 4.0. The VMX
parser reports an error when this controller type is present. This
makes virsh dumpxml fail for every domain that uses this controller
type.

This patch fixes this and adds lsisas1068 to the list of accepted
SCSI controller types.

Reported by Jonathan Kelley.

15 years agoesx: Report an error for invalid arguments in esxList(Defined)Domains
Matthias Bolte [Wed, 7 Apr 2010 08:55:00 +0000 (10:55 +0200)]
esx: Report an error for invalid arguments in esxList(Defined)Domains

15 years agoAvoid searching for windres when not building for Windows
Diego Elio Pettenò [Thu, 8 Apr 2010 09:52:46 +0000 (11:52 +0200)]
Avoid searching for windres when not building for Windows

Just checking for a windres tool might hit even on Linux systems when
building for Linux (e.g.: when using Gentoo and having built binutils
with multitarget support), and will then fail to link properly at the
end of the build.

* configure.ac: Avoid searching for windres on non windows target

15 years agoExecutable does not belong into repository.
Stefan Berger [Wed, 7 Apr 2010 23:52:25 +0000 (19:52 -0400)]
Executable does not belong into repository.

Removing the tests/nwfilterxml2xmltest executable that got in with a previous patch.

15 years agonwfilter: Support for learning a VM's IP address
Stefan Berger [Wed, 7 Apr 2010 21:02:18 +0000 (23:02 +0200)]
nwfilter: Support for learning a VM's IP address

This patch implements support for learning a VM's IP address. It uses
the pcap library to listen on the VM's backend network interface (tap)
or the physical ethernet device (macvtap) and tries to capture packets
with source or destination MAC address of the VM and learn from DHCP
Offers, ARP traffic, or first-sent IPv4 packet what the IP address of
the VM's interface is. This then allows to instantiate the network
traffic filtering rules without the user having to provide the IP
parameter somewhere in the filter description or in the interface
description as a parameter. This only supports to detect the parameter
IP, which is for the assumed single IPv4 address of a VM. There is not
support for interfaces that may have multiple  IP addresses (IP
aliasing) or IPv6 that may then require more than one valid IP address
to be detected. A VM can have multiple independent interfaces that each
uses a different IP address and in that case it will be attempted to
detect each one of the address independently.

So, when for example an interface description in the domain XML has
looked like this up to now:

    <interface type='bridge'>
      <source bridge='mybridge'/>
      <model type='virtio'/>
      <filterref filter='clean-traffic'>
        <parameter name='IP' value='10.2.3.4'/>
      </filterref>
    </interface>

you may omit the IP parameter:

    <interface type='bridge'>
      <source bridge='mybridge'/>
      <model type='virtio'/>
      <filterref filter='clean-traffic'/>
    </interface>

Internally I am walking the 'tree' of a VM's referenced network filters
and determine with the given variables which variables are missing. Now,
the above IP parameter may be missing and this causes a libvirt-internal
thread to be started that uses the pcap library's API to listen to the
backend interface  (in case of macvtap to the physical interface) in an
attempt to determine the missing IP parameter. If the backend interface
disappears the thread terminates assuming the VM was brought down. In
case of a macvtap device a timeout is being used to wait for packets
from the given VM (filtering by VM's interface MAC address). If the VM's
macvtap device disappeared the thread also terminates. In all other
cases it tries to determine the IP address of the VM and will then apply
the rules late on the given interface, which would have happened
immediately if the IP parameter had been explicitly given. In case an
error happens while the firewall rules are applied, the VM's backend
interface is 'down'ed preventing it to communicate. Reasons for failure
for applying the network firewall rules may that an ebtables/iptables
command failes or OOM errors. Essentially the same failure reasons may
occur as when the firewall rules are applied immediately on VM start,
except that due to the late application of the filtering rules the VM
now is already running and cannot be hindered anymore from starting.
Bringing down the whole VM would probably be considered too drastic.
While a VM's IP address is attempted to be determined only limited
updates to network filters are allowed. In particular it is prevented
that filters are modified in such a way that they would introduce new
variables.

A caveat: The algorithm does not know which one is the appropriate IP
address of a VM. If the VM spoofs an IP address in its first ARP traffic
or IPv4 packets its filtering rules will be instantiated for this IP
address, thus 'locking' it to the found IP address. So, it's still
'safer' to explicitly provide the IP address of a VM's interface in the
filter description if it is known beforehand.

* configure.ac: detect libpcap
* libvirt.spec.in: require libpcap[-devel] if qemu is built
* src/internal.h: add the new ATTRIBUTE_PACKED define
* src/Makefile.am src/libvirt_private.syms: add the new modules and symbols
* src/nwfilter/nwfilter_learnipaddr.[ch]: new module being added
* src/nwfilter/nwfilter_driver.c src/conf/nwfilter_conf.[ch]
  src/nwfilter/nwfilter_ebiptables_driver.[ch]
  src/nwfilter/nwfilter_gentech_driver.[ch]: plu the new functionality in
* tests/nwfilterxml2xmltest: extend testing

15 years agoxenXMDomainDefineXML: remove dead store and useless/leaky virGetDomain
Jim Meyering [Wed, 7 Apr 2010 18:17:44 +0000 (20:17 +0200)]
xenXMDomainDefineXML: remove dead store and useless/leaky virGetDomain

* src/xen/xm_internal.c (xenXMDomainDefineXML): Remove useless and
leak-inducing call to virGetDomain, as well as decl of now-unused local.

15 years agocreateRawFileOpHook: avoid dead stores
Jim Meyering [Wed, 7 Apr 2010 16:30:55 +0000 (18:30 +0200)]
createRawFileOpHook: avoid dead stores

* src/storage/storage_backend.c (createRawFileOpHook): Remove dead
stores and declaration of each stored-to variable.

15 years agoqemudDomainGetSecurityLabel: avoid dead store to "type"
Jim Meyering [Wed, 7 Apr 2010 15:51:56 +0000 (17:51 +0200)]
qemudDomainGetSecurityLabel: avoid dead store to "type"

* src/qemu/qemu_driver.c (qemudDomainGetSecurityLabel): Remove store
and declaration.

15 years agoFix CPU comparison for x86 arch
Jiri Denemark [Wed, 7 Apr 2010 12:58:15 +0000 (14:58 +0200)]
Fix CPU comparison for x86 arch

When comparing a CPU to host CPU, the result would be
VIR_CPU_COMPARE_SUPERSET (or even VIR_CPU_COMPARE_INCOMPATIBLE if strict
match was required) even though the two CPUs were identical.

15 years agoCleanup x86Compute()
Jiri Denemark [Wed, 7 Apr 2010 12:57:16 +0000 (14:57 +0200)]
Cleanup x86Compute()

No change in semantics.

15 years agoProperly advertise cpuselection guest capability
Jiri Denemark [Wed, 7 Apr 2010 14:49:04 +0000 (16:49 +0200)]
Properly advertise cpuselection guest capability

There's no sense in advertising cpuselection capability when host CPU
is not properly detected and advertised in host capabilities.

15 years agoDon't ignore guest CPU selection when unsupported by HV
Jiri Denemark [Tue, 6 Apr 2010 14:26:36 +0000 (16:26 +0200)]
Don't ignore guest CPU selection when unsupported by HV

When qemu libvirt driver doesn't support guest CPU selection with given
qemu binary, guests requiring specific CPU should fail to start instead
of being silently supplied with a default CPU.

15 years agoDocument all options of virsh dumpxml
Jiri Denemark [Tue, 6 Apr 2010 13:51:41 +0000 (15:51 +0200)]
Document all options of virsh dumpxml

15 years agoqemuDomainSnapshotLoad: avoid dead store
Jim Meyering [Wed, 7 Apr 2010 18:22:20 +0000 (20:22 +0200)]
qemuDomainSnapshotLoad: avoid dead store

* src/qemu/qemu_driver.c (qemuDomainSnapshotLoad): Remove dead store
into "snap", as well as its declaration.

15 years agomaint: s/initialis/initializ/
Eric Blake [Wed, 7 Apr 2010 15:12:02 +0000 (09:12 -0600)]
maint: s/initialis/initializ/

git grep found 12 of the former but 100 of the latter in src/.

* src/remote/remote_driver.c (initialise_gnutls): Rename...
(initialize_gnutls): ...to this.
(doRemoteOpen): Adjust caller.
* src/xen/xen_driver.c (xenUnifiedOpen): Adjust output string.
* src/util/network.c: Adjust comments.
Suggested by Matthias Bolte.

15 years agodomain_event.c: don't deref NULL on an OOM error path
Jim Meyering [Mon, 29 Mar 2010 15:43:01 +0000 (17:43 +0200)]
domain_event.c: don't deref NULL on an OOM error path

* src/conf/domain_event.c (virDomainEventGraphicsNewFromDom):
Return NULL when handling out-of-memory error, rather than
falling through with ev=NULL and then assigning to ev->member.
(virDomainEventGraphicsNewFromObj): Likewise.

15 years agonwfiler: fix due to non-symmetric src mac address match in iptables
Stefan Berger [Wed, 7 Apr 2010 10:28:16 +0000 (06:28 -0400)]
nwfiler: fix due to non-symmetric src mac address match in iptables

The attached patch fixes a problem due to the mac match in iptables only
supporting --mac-source and no --mac-destination, thus it not being
symmetric. Therefore a rule like this one

<rule action='drop' direction='out'>
  <all match='no' srcmacaddr='$MAC'/>
</rule>

should only have the MAC match on traffic leaving the VM and not test
for the same source MAC address on traffic that the VM receives.

15 years agoqemu_driver.c: don't close an arbitrary file descriptor
Jim Meyering [Wed, 7 Apr 2010 07:17:27 +0000 (09:17 +0200)]
qemu_driver.c: don't close an arbitrary file descriptor

* src/qemu/qemu_driver.c (qemudStartVMDaemon): Initialize "logfile"
to ensure that we don't use it uninitialized -- thus closing an
arbitrary file descriptor -- in the cleanup block.

15 years agoFix a typo in comment
Daniel Veillard [Wed, 7 Apr 2010 08:30:28 +0000 (10:30 +0200)]
Fix a typo in comment

15 years agoUpdate of the apparmore regression tests
Jamie Strandboge [Tue, 6 Apr 2010 20:59:31 +0000 (22:59 +0200)]
Update of the apparmore regression tests

* tests/virt-aa-helper-test: test augmented with hostdev and sdl display
  checks

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