]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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

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.