Commit Graph

4604 Commits

Author SHA1 Message Date
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
Eric Blake
ec724071e9 remote: react to failures on wakeupFD
* src/remote/remote_driver.c (remoteIO, remoteIOEventLoop): Report
failures on pipe used for wakeup.
Reported by Chris Lalancette.
2010-04-15 11:40:08 -06:00
Eric Blake
f9f6c34c5c util: ensure safe{read,write,zero} return is checked
Based on a warning from coverity.  The safe* functions
guarantee complete transactions on success, but don't guarantee
freedom from failure.

* src/util/util.h (saferead, safewrite, safezero): Add
ATTRIBUTE_RETURN_CHECK.
* src/remote/remote_driver.c (remoteIO, remoteIOEventLoop): Ignore
some failures.
(remoteIOReadBuffer): Adjust error messages on read failure.
* daemon/event.c (virEventHandleWakeup): Ignore read failure.
2010-04-15 11:40:08 -06:00
Eric Blake
cf4dee3615 maint: another preprocessor fix
Regression introduced in commit 62170b995.

* src/util/memory.h: Placate cppi, and fit 80 columns.
2010-04-15 11:39:10 -06:00
Daniel P. Berrange
c4896d378b Fix CDROM media change for QEMU when using -device syntax
Disk devices in QEMU have two parts, the guest device and the host
backend driver. Historically these two parts have had the same
"unique" name. With the switch to using -device though, they now
have separate names. Thus when changing CDROM media, for guests
using -device syntax, we need to prepend the QEMU_DRIVE_HOST_PREFIX
constant

* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Add helper function
  qemuDeviceDriveHostAlias() for building a host backend alias
* src/qemu/qemu_driver.c: Use qemuDeviceDriveHostAlias() to determine
  the host backend alias for performing eject/change commands in the
  monitor
2010-04-15 18:09:42 +01:00
Daniel P. Berrange
db336caa58 Update QEMU device_add command in JSON mode
The device_add command was added in JSON mode in a way I didn't
expect. Instead of passing the normal device string to the JSON
command:

    { "execute": "device_add", "arguments": { "device": "ne2k_pci,id=nic.1,netdev=net.1" } }

We need to split up the device string into a full JSON object

    { "execute": "device_add", "arguments": { "driver": "ne2k_pci", "id": "nic.1", "netdev": "net.1" } }

* src/qemu/qemu_conf.h, src/qemu/qemu_conf.c: Rename the
  qemuCommandLineParseKeywords method to qemuParseKeywords
  and export it to monitor
* src/qemu/qemu_monitor_json.c: Split up device string into
  a JSON object for device_add command
2010-04-15 18:08:04 +01:00
Daniel P. Berrange
fde060b8f5 Rename parameter in qemuMonitorDeviceDel
The parameter for the qemuMonitorDeviceDel() is a device alias,
not a device config string. Rename the parameter reflect this
and avoid confusion to readers.

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
  src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
  Rename devicestr to devalias in qemuMonitorDeviceDel()
2010-04-15 17:57:59 +01:00
Daniel P. Berrange
efd4ee7871 Remove code from JSON monitor for commands that won't be ported
The QEMU developers have stated that they will not be porting
the commands 'pci_add', 'pci_del', 'usb_add', 'usb_del' to the
JSON mode monitor, since they're obsoleted by 'device_add'
and 'device_del'. libvirt has (untested) code that would have
supported those commands in theory, but since we already use
device_add/del where available, there's no need to keep the
legacy stuff anymore.

The text mode monitor keeps support for all commands for sake
of historical compatability.

* src/qemu/qemu_monitor_json.c: Remove 'pci_add', 'pci_del',
  'usb_add', 'usb_del' commands
2010-04-15 17:57:50 +01:00
Daniel P. Berrange
f6770e8665 Run test suite as part of RPM build process
To ensure that patches in the RPM don't break any functionality
it is neccessary to run the test suites during build. It currently
has 3 tests disabled

 - daemon-conf: this is totally broken, since it relies on
   being able to resolve the 'libvirt' group & being able to
   resolve hostnames at daemon startup. This isn't possible
   in a mock build root
 - seclabeltest: fails to initialize selinux in the mock
   build root. Possibly fixable
 - nodeinfotest: broken on s390 + ppc - this is a real bug

* libvirt.spec.in: Add a %check section, with 3 tests
   temporarily disabled
2010-04-15 17:56:06 +01:00
Daniel P. Berrange
4f81919ad2 Fix QEMU memory stats JSON mode
The QEMU driver is mistakenly calling directly into the text
mode monitor for the domain memory stats query.

* src/qemu/qemu_driver.c: Replace qemuMonitorTextGetMemoryStats with
  qemuMonitorGetMemoryStats
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add the new
  wrapper for qemuMonitorGetMemoryStats
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h: Add
  qemuMonitorJSONGetMemoryStats implementation
2010-04-15 17:55:58 +01:00
Daniel P. Berrange
3fb992c659 Fix QEMU command building errors to reflect unsupported configuration
Instead of reporting VIR_ERR_INTERNAL_ERROR use the more specific
VIR_ERR_CONFIG_UNSUPPORTED

* src/qemu/qemu_conf.c: Report VIR_ERR_CONFIG_UNSUPPORTED for
  unsupported video adapters
2010-04-15 17:55:38 +01:00