Commit Graph

4469 Commits

Author SHA1 Message Date
Daniel Veillard
22de841a76 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
2010-04-12 18:03:35 +02:00
Chris Lalancette
e2e000cf1b Rename virsh "revert-to-snapshot" to "snapshot-revert"
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-12 10:09:55 -04:00
Luiz Capitulino
3b106cead5 Small fixes to virsh man page
* tools/virsh.pod: add two missing 's' and section about 'dominfo' is
  duplicated
2010-04-12 14:23:18 +02:00
Stefan Berger
c5337e8e43 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.
2010-04-12 08:19:11 -04:00
Stefan Berger
55d444cc10 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.
2010-04-09 15:54:29 -04:00
David Allan
cddd3ac8b0 Add enospace option to qemu disk error policy
* Dan Kenigsberg requested explicit support for the qemu default disk error policy which is enospace
2010-04-09 03:35:47 -04:00
Daniel P. Berrange
631c4ce855 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
2010-04-09 16:24:28 +01:00
Stefan Berger
1670df676a Undoing 2nd application of the patch... 2010-04-09 10:05:59 -04:00
Stefan Berger
39367b5674 Fix error in nwfilter test driver
Trivial fix for the c&p error in the nwfilter test driver.
2010-04-09 09:55:22 -04:00
Stefan Berger
f21c6c6890 Fix error in nwfilter test driver
Trivial fix for the c&p error in the nwfilter test driver.
2010-04-09 09:53:47 -04:00
Daniel Veillard
c7f70f4357 Fix some cppi prepocessor indentation issues
* src/conf/nwfilter_conf.c src/util/hooks.c: added spaces to avoid
  "make syntax-check" failures
2010-04-09 15:10:46 +02:00
Ryan Harper
4a2dd00e76 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
2010-04-09 15:07:16 +02:00
redshift
aed4c08d4c 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'
2010-04-09 14:38:12 +02:00
Stefan Berger
b5cc01ef2e nwfilter: More XML parser test cases
This patch adds a couple more nwfilter test cases for the XML parser tests.
2010-04-09 07:25:02 -04:00
Matthias Bolte
98caf6db76 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.
2010-04-09 02:34:25 +02:00
Matthias Bolte
ddf877cd9e remote: Replace some virRaiseError with remoteError 2010-04-09 02:23:40 +02:00
Matthias Bolte
9455323530 remote: Remove virConnectPtr from error/errorf
Also unify error/errorf to remoteError and update cfg.mk accordingly.
2010-04-09 01:56:27 +02:00
Matthias Bolte
564f4c2f9a Remove undefined symbols from symbols file 2010-04-08 22:08:01 +02:00
Matthias Bolte
1aaa909116 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.
2010-04-08 21:54:43 +02:00
Matthias Bolte
1787fdff57 Generate libvirt.def from libvirt.syms
The MinGW linker needs the libvirt.def file.
2010-04-08 20:12:09 +02:00
Jiri Denemark
7ea025aed0 Fix unterminated B<...> in virsh man page 2010-04-08 14:51:46 +02:00
Daniel P. Berrange
6df7d55d39 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
2010-04-08 12:41:40 +01:00
Daniel P. Berrange
df62337289 Add missing nwfilter_learnipaddr.c to POTFILES.in
* po/POTFILES.in: Add src/nwfilter/nwfilter_learnipaddr.c
2010-04-08 12:01:57 +01:00
Daniel P. Berrange
3d3af08879 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
2010-04-08 12:01:57 +01:00
Stefan Berger
9fd54a78dc 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>
2010-04-08 06:25:38 -04:00
Matthias Bolte
4acab37f56 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.
2010-04-08 12:05:51 +02:00
Matthias Bolte
fba503c368 esx: Report an error for invalid arguments in esxList(Defined)Domains 2010-04-08 11:58:33 +02:00
Diego Elio Pettenò
9cea2af3fc 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
2010-04-08 11:52:46 +02:00
Stefan Berger
edb9d54bd1 Executable does not belong into repository.
Removing the tests/nwfilterxml2xmltest executable that got in with a previous patch.
2010-04-07 19:52:25 -04:00
Stefan Berger
3bf24abc8c 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
2010-04-07 23:12:21 +02:00
Jim Meyering
7be5c26d74 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.
2010-04-07 21:49:15 +02:00
Jim Meyering
2cdf29eda9 createRawFileOpHook: avoid dead stores
* src/storage/storage_backend.c (createRawFileOpHook): Remove dead
stores and declaration of each stored-to variable.
2010-04-07 21:49:07 +02:00
Jim Meyering
5874c6de5c qemudDomainGetSecurityLabel: avoid dead store to "type"
* src/qemu/qemu_driver.c (qemudDomainGetSecurityLabel): Remove store
and declaration.
2010-04-07 21:48:55 +02:00
Jiri Denemark
e26997f62b 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.
2010-04-07 21:33:04 +02:00
Jiri Denemark
ce4c82f116 Cleanup x86Compute()
No change in semantics.
2010-04-07 21:32:57 +02:00
Jiri Denemark
71d5686f78 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.
2010-04-07 21:32:46 +02:00
Jiri Denemark
f599156641 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.
2010-04-07 21:32:46 +02:00
Jiri Denemark
6c5450646c Document all options of virsh dumpxml 2010-04-07 21:32:46 +02:00
Jim Meyering
60466abbd6 qemuDomainSnapshotLoad: avoid dead store
* src/qemu/qemu_driver.c (qemuDomainSnapshotLoad): Remove dead store
into "snap", as well as its declaration.
2010-04-07 20:39:50 +02:00
Eric Blake
dd1a186f77 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.
2010-04-07 09:48:07 -06:00
Jim Meyering
3c8877e743 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.
2010-04-07 16:20:28 +02:00
Stefan Berger
f8352e221f 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.
2010-04-07 06:28:16 -04:00
Jim Meyering
d33b87268d 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.
2010-04-07 11:19:16 +02:00
Daniel Veillard
2a788c6439 Fix a typo in comment 2010-04-07 10:30:28 +02:00
Jamie Strandboge
ef962afb74 Update of the apparmore regression tests
* tests/virt-aa-helper-test: test augmented with hostdev and sdl display
  checks
2010-04-06 23:01:24 +02:00
Jamie Strandboge
2df320609a Improve the apparmor example
* examples/apparmor/libvirt-qemu examples/apparmor/usr.sbin.libvirtd
  examples/apparmor/usr.lib.libvirt.virt-aa-helper: Update the examples
2010-04-06 23:01:24 +02:00
Jamie Strandboge
1a253b38e2 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
2010-04-06 23:01:23 +02:00
Jamie Strandboge
1efb623674 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
2010-04-06 23:01:23 +02:00
Jamie Strandboge
2aca94bfd3 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.
2010-04-06 23:01:23 +02:00
Jamie Strandboge
a331b909c5 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
2010-04-06 23:01:23 +02:00