Commit Graph

5414 Commits

Author SHA1 Message Date
Daniel P. Berrange
98bd5e6c5a Fix crash in nwfilter driver check
The nwfilterDriverActive() could de-reference a NULL pointer
if it hadn't be started at the point it was called. It was
also not thread safe, since it lacked locking around data
accesses.

* src/nwfilter/nwfilter_driver.c: Fix locking & NULL checks
  in nwfilterDriverActive()
2010-04-23 11:06:30 +01:00
Eric Blake
3022375da3 addrToString: give better error message
The user probably doesn't care what the gai error numbers are, as
much as what the failed conversion IP address was.

* src/remote/remote_driver.c (addrToString): Mention which address
could not be converted.
* daemon/remote.c (addrToString): Likewise.
2010-04-22 14:46:55 -06:00
Eric Blake
2a82a33ee4 maint: update AUTHORS with recent contributors
git shortlog $(git log -1 --format=%H AUTHORS).. | grep -v "^ "

then add missing entries to AUTHORS.

* AUTHORS: Update.
2010-04-22 14:13:03 -06:00
Spencer Shimko
c85c9b3a26 qemu: fix security context references in DAC code
* The error messages coming from qemu's DAC support contain strings
  from the original SELinux security driver code.  This just removes
  references to "security context" and other SELinux-isms from the DAC
  code.

Signed-off-by: Spencer Shimko <sshimko@tresys.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2010-04-22 13:54:41 -06:00
Stefan Berger
647c26c886 Changes from V1 to V2:
- using INT_BUFSIZE_BOUND() to determine the length of the buffersize
for printing and integer into

 - not explicitly initializing static var threadsTerminate to false
anymore, since that's done automatically

Changes after V2:
  - removed while looks in case of OOM error
  - removed on ifaceDown() call
  - preceding one ifaceDown() call with an ifaceCheck() call

Since the name of an interface can be the same between stops and starts
of different VMs I have to switch the IP address learning thread to use
the index of the interface to determine whether an interface is still
available or not - in the case of macvtap the thread needs to listen for
traffic on the physical interface, thus having to time out periodically
to check whether the VM's macvtap device is still there as an indication
that the VM is still alive. Previously the following sequence of 2 VMs
with macvtap device

virsh start testvm1; virsh destroy testvm1 ; virsh start testvm2

would not terminate the thread upon testvm1's destroy since the name of
the interface on the host could be the same (i.e, macvtap0) on testvm1
and testvm2, thus it was easily race-able. The thread would then
determine the IP address parameter for testvm2 but apply the rule set
for testvm1. :-(
I am also introducing a lock for the interface (by name) that the thread
must hold while it listens for the traffic and releases when it
terminates upon VM termination or 0.5 second thereafter. Thus, the new
thread for a newly started VM with the same interface name will not
start while the old one still holds the lock. The only other code that I
see that also needs to grab the lock to serialize operation is the one
that tears down the firewall that were established on behalf of an
interface.

I am moving the code applying the 'basic' firewall rules during the IP
address learning phase inside the thread but won't start the thread
unless it is ensured that the firewall driver has the ability to apply
the 'basic' firewall rules.
2010-04-22 14:58:57 -04:00
David Allan
68529bc596 Properly indent encryption tags
* Fix for the bug reported at:

https://bugzilla.redhat.com/show_bug.cgi?id=573908
2010-04-22 14:26:55 -04:00
Jiri Denemark
96ac18591a Fix locking in qemudDomainCoreDump
The hang fix in d376b7d63e was incomplete
since it left quite a few {Enter,Exit}Monitor calls which require driver
to be unlocked. Since the driver is locked throughout the whole
function, {Enter,Exit}MonitorWithDriver need to be used instead to
ensure driver is not locked when issuing monitor commands.
2010-04-22 19:41:24 +02:00
Jiri Denemark
e2c059485c Poll for migration end every 50ms instead of 50us
The comment in qemuDomainWaitForMigrationComplete says we are polling
every 50ms but the code sleeps only for 50us. This was already discussed
during review but apparently forgotten when the series was pushed.
2010-04-22 19:41:18 +02:00
Spencer Shimko
e5c668a021 configure.ac SELinux fixes
* Fix a logic error in configure.ac that prevented --with-selinux=no
  from being used with --with-secdriver-selinux=no.

* Fix some strings to clarify the difference between --with-selinux
  and --with-secdriver-selinux.

Signed-off-by: Spencer Shimko <sshimko@tresys.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2010-04-22 10:50:49 -06:00
Daniel P. Berrange
9772bebab7 Fix QEMU text monitor command error checking
The text monitor code was checking for a '\n' prefix on several
places. Previously this would work, but since the monitor code
re-write the '\n' is already stripped off, so mustn't be checked
for.

* src/qemu/qemu_monitor_text.c: Fix monitor error checking
2010-04-22 17:15:48 +01:00
Daniel P. Berrange
a980d123b5 Fix CPU hotplug command names
Probably as a result of a merge error, the CPU hotplug command
names were completely wrong.

* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Fix
  the CPU hotplug command names
2010-04-22 17:15:48 +01:00
Daniel P. Berrange
de8ecb12cb Fix printing of event detail in python events demo program
The events demo program is slightly misleading printing

  myDomainEventCallback1 EVENT: Domain f14i686(-1) Added

which is not distinguishing Add vs Update events. It should have
been doing

  myDomainEventCallback1 EVENT: Domain f14i686(-1) Defined Updated

* examples/domain-events/events-python/event-test.py: Fully print
  event detail info string
2010-04-22 17:15:48 +01:00
Dustin Kirkland
cb06a9bfe5 portability fixes to tools/virt-pki-validate.in
A few fixes will help make tools/virt-pki-validate.in useful on Debian
and Ubuntu.  And one fix should be useful to everyone (see #3).

 1) note our gnutls-bin package (in addition to your gnutls-utils
package) in the no-certtool error text

 2) fix a bashism, == should be = in the case where /bin/sh is a symlink
to dash

 3) $(SYSCONFDIR) cannot evaluate; set a single shell SYSCONFDIR
variable to the autoconf @SYSCONFDIR@ value, and use $SYSCONFDIR
everywhere

Bug report:
 * https://bugs.edge.launchpad.net/ubuntu/+source/libvirt/+bug/562266

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2010-04-22 09:06:30 -06:00
Eric Blake
1f7560e25d maint: enforce whitespace on shell scripts
Noticed because virt-pki-validate was very inconsistent on
using tabs vs. 8 spaces, sometimes mixing both paradigms on
a single line.

'git diff -b' shows significant changes only in cfg.mk.

* cfg.mk (sc_TAB_in_indentation): Add a few files.
* daemon/libvirtd.init.in: Avoid tabs.
* tools/virt-pki-validate.in: Likewise.
2010-04-22 09:06:30 -06:00
Eric Blake
2788f4d1d4 testutilsqemu: avoid uninitialized variable
* tests/testutilsqemu.c (testQemuCapsInit): Initialize variables.
2010-04-22 09:00:30 -06:00
Jiri Denemark
b34e082079 Fake host CPU for qemu tests 2010-04-22 10:21:05 +02:00
Jiri Denemark
b9a2552d2a Use configured CPU model if possible
Adds ability to provide a preferred CPU model for CPUID data decoding.
Such model would be considered as the best possible model (if it's
supported by hypervisor) regardless on number of features which have to
be added or removed for describing required CPU.
2010-04-22 10:20:50 +02:00
Jiri Denemark
53c4f9fa1c Support removing features when converting data to CPU
So far, when CPUID data were converted into CPU model and features, the
features can only be added to the model. As a result, when a guest asked
for something like "qemu64,-svm" it would get a qemu32 plus a bunch of
additional features instead.

This patch adds support for removing feature from the base model.
Selection algorithm remains the same: the best CPU model is the model
which requires lowest number of features to be added/removed from it.
2010-04-22 10:20:41 +02:00
Jiri Denemark
60aef9e467 Move MIN macro to util.h so that others can use it 2010-04-22 10:20:32 +02:00
Jiri Denemark
e07314f4c1 Deal with CPU models in []
Qemu committed a patch which list some CPU names in [] when asked for
supported CPUs (qemu -cpu ?). Yet, it needs such CPUs to be passed
without those square braces. When probing for supported CPU models, we
can just strip the square braces and pretend we have never seen them.
2010-04-22 10:20:25 +02:00
Jiri Denemark
9fbb810cf4 Fix initial VCPU pinning in qemu driver
First, inital VCPU pinning is set correctly but then it is reset by
assigning qemu process to a new cgroup (which contains all CPUs). It's
easily fixed by swapping these two actions.
2010-04-22 09:30:34 +02:00
Eric Blake
871aa6e3c1 maint: ignore 'make syntax-check' failure files
* .gitignore: Add exemption.
* cfg.mk (local-checks-to-skip): Ignore a test to silence a skip
warning.
2010-04-21 14:32:08 -06:00
Chris Lalancette
8274993f29 Make avahi startup more robust.
If the hostname of the current virtualization machine
could not be resolved, then libvirtd would fail to
start.  However, for disconnected operation (on a laptop,
for instance) the hostname may very legitimately not
be resolvable.  This patch makes it so that if we can't
resolve the hostname, avahi doesn't fail, it just uses
a less useful MDNS string.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-21 16:16:36 -04:00
Guido Günther
ce380b8e6f Ignore empty type attribute in driver element of virtual disks
Fixes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=578347
2010-04-21 20:49:47 +02:00
Eric Blake
84bc7ac06b build: fix preprocessor indentation
* src/esx/esx_vi.h: Placate cppi.
2010-04-21 10:05:01 -06:00
Chris Wong
b1fab0c21c esx: Don't treat an empty root snapshot list as error
An empty root snapshot list was considered as error condition. Creating a
new snapshot would fail if the domain didn't have snapshots yet, because
the snapshot-create function tries to lookup the list of existing snapshots
in order to verify that the snapshot name is unique. This fails if the
domain doesn't have snapshots yet.

Removing the NULL check from esxVI_LookupRootSnapshotTreeList fixes this.
2010-04-21 11:47:15 +02:00
Matthias Bolte
3f52921d43 esx: Gather some XML generation macros in esx_vi.h 2010-04-21 00:44:24 +02:00
Matthias Bolte
7a056d0648 esx: Fix FindByIp response handling
FindByIp may return nothing if there is no host or virtual machine
with the given IP address. Handle that case properly.
2010-04-21 00:44:18 +02:00
Matthias Bolte
1d8099f4b6 esx: Fix virtualHW.version generation
The supported virtualHW.version doesn't depend on the API version,
but on the product version.
2010-04-21 00:37:46 +02:00
Stefan Berger
abce152a49 nwfilter: add support for connlimit match
This patch adds support for the connlimit match in iptables that is used
to limit the number of outgoing directions.
2010-04-20 17:14:38 -04:00
Stefan Berger
c8f4dcca6a Extend fwall-drv interface and call functions via interface
I am moving some of the eb/iptables related functions into the interface
of the firewall driver and am making them only accessible via the driver's
interface. Otherwise exsiting code is adapted where needed. I am adding one
new function to the interface that checks whether the 'basic' rules can be
applied,  which will then be used by a subsequent patch.
2010-04-20 17:07:15 -04:00
Eric Blake
8f342c6f9a build: avoid compiler warning
According to GCC, ATTRIBUTE_UNUSED means that an attribute _might_
be unused, not _must_ be unused.  Therefore, it is easier to
blindly mark a variable, than to try and do preprocessor limiting
of when we know it is unused.

* src/remote/remote_driver.c (remoteAuthenticate): Mark attribute
as potentially unused.
Reported by Gustovo Morozowski.
2010-04-20 13:44:31 -06:00
Matthias Bolte
8138ec8693 Explicitly set virStoragePoolTypeInfo FS and NETFS defaults
No semantic change, the now explicitly set default are all zero and
that's what GCC sets unspecified struct members to.
2010-04-20 21:22:51 +02:00
Matthias Bolte
c6375aa796 esx: Add support for the VMXNET 2 (Enhanced) NIC model
Add a test case and document it.
2010-04-20 20:58:24 +02:00
Matthias Bolte
cad913060c Mark in_open parameter of remoteAuthenticate as unused when it's unused
Otherwise compiling with -Werror will fail.
2010-04-20 20:35:23 +02:00
Philipp Hahn
8b3a89c486 Install nwfilter xml files from source directory.
During an out-of-tree build, the current working directory is the build
directory. Since the FILTERS are static and not modified or
auto-generated during the build process, they need to be explicitly
fetched from the source directory during install.

Prefix the files with $(srcdir), which gets expanded to the absolute or
relative path to the source directory, even when duing out-of-tree
builds.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2010-04-20 08:14:23 -06:00
Philipp Hahn
5d4009b0d1 Don't ship generated python/libvirt.? files.
libvirt.c and libvirt.h are auto-generated files. Mentioning their names
in *_SOURCES includes them in the distribution. During an out-of-tree
build these shipped files are included instead of the auto-generated
version, potentially breaking the build (as it happend in 0.8.0, because
the shipped libvirt.h was missing the declaration for
'libvirt_virDomainUpdateDeviceFlags')

Use the nodist_*_SOURCES automake variable instead.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2010-04-20 08:13:06 -06:00
Daniel P. Berrange
90302e7f8d Fixup python binding for virDomainSnapshot APIs
The generator code was totally wrong for the virDomainSnapshot
APIs, not generating the wrapper class, and giving methods the
wrong names

* generator.py: Set metadata for virDomainSnapshot type & APIs
* libvirt-override-api.xml, libvirt-override.c: Hand-code the
  virDomainSnapshotListNames glue layer
2010-04-20 11:49:27 +02:00
Daniel P. Berrange
f3e098f3d8 Fix network hotplug to use device_add in QEMU
The initial boot of VMs uses -device for NICs where available. The
corresponding monitor command is device_add, but the network hotplug
code was still using device_del by mistake.

* src/qemu/qemu_driver.c: Use device_add for NIC hotplug where
  available
2010-04-19 12:11:30 +01:00
Daniel P. Berrange
9417eb0337 Fix error reporting for getfd + host_net_add in QEMU
If either of the getfd or host_net_add monitor commands return
any text, this indicates an error condition. Don't ignore this!

* src/qemu/qemu_monitor_text.c: Report errors for getfd and
  host_net_add
2010-04-19 12:11:24 +01:00
Daniel P. Berrange
e699a82474 Fix device_del in JSON mode for QEMU
The 'device_del' command expects a parameter called 'id' but we
were passing 'config'.

* src/qemu/qemu_monitor_json.c: Fix device_del command parameter
2010-04-19 12:11:17 +01:00
Matthias Bolte
c35b5269af nwfilter: Free nwfilter hash of virConnectPtr
And close the driver on connection close.
2010-04-17 18:20:15 +02:00
Matthias Bolte
051df19e0e Replace printf with logging macros 2010-04-17 15:02:28 +02:00
Jiri Denemark
39f3fee4a4 Mark internal.h for translation 2010-04-16 19:21:10 +02:00
Jiri Denemark
7a2c6222a9 Use virCheckFlags for APIs added in 0.8.0 2010-04-16 14:05:50 +02:00
Jiri Denemark
070da02fb5 Introduce virCheckFlags for consistent flags checking
The idea is that every API implementation in driver which has flags
parameter should first call virCheckFlags() macro to check the function
was called with supported flags:

    virCheckFlags(VIR_SUPPORTED_FLAG_1 |
                  VIR_SUPPORTED_FLAG_2 |
                  VIR_ANOTHER_SUPPORTED_FLAG, -1);

The error massage which is printed when unsupported flags are passed
looks like:

    invalid argument in virFooBar: unsupported flags (0x2)

Where the unsupported flags part only prints those flags which were
passed but are not supported rather than all flags passed.
2010-04-16 14:05:50 +02:00
Stefan Berger
d2327278fb nwfilter: Clear all state tracking from a drop rule
Don't use state-matching in a drop rule.
2010-04-16 07:34:36 -04:00
Matthias Bolte
3a7f2fc3b2 esx: Replace scanf with STRSKIP and strtok_r
This also fixes a portability problem with the %a format modifier.
%a is not portable and made esxDomainDumpXML fail at runtime in
MinGW builds.
2010-04-15 19:52:38 +02:00
Matthias Bolte
7ca6a0996d Update to latest gnulib to get strtok_r relaxed to LGPLv2+
strtok_r will be used in the ESX driver to replace scanf-based code.

MinGW lacks strtok_r, so we need gnulib to provide it, but until now
strtok_r was licensed LGPL3.
2010-04-15 19:52:38 +02:00
Matthias Bolte
77408cc0e1 esx: Add nwfilter driver stub
This stops libvirt trying to connect to a non-existing libvirtd on the
ESX server in order to find a nwfilter driver.
2010-04-15 19:52:38 +02:00