]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
14 years agoFix up confusing indentation in qemudDomainAttachHostPciDevice.
Chris Lalancette [Tue, 27 Jul 2010 16:58:48 +0000 (12:58 -0400)]
Fix up confusing indentation in qemudDomainAttachHostPciDevice.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agomaint: turn on gcc logical-op checking
Eric Blake [Fri, 23 Jul 2010 20:28:31 +0000 (14:28 -0600)]
maint: turn on gcc logical-op checking

This would have detected the bug in commit 38ad33931 (Aug 09), which
we missed until commit f828ca35 (Jul 10); over 11 months later.

However, on Fedora 13, it also triggers LOTS of warnings from
the libcurl-devel header for two files:

esx/esx_vi.c: In function 'esxVI_CURL_Perform':
esx/esx_vi.c:232: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
esx/esx_vi.c:232: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
esx/esx_vi.c:232: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
...
xenapi/xenapi_driver.c: In function 'call_func':
xenapi/xenapi_driver.c:1872: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
xenapi/xenapi_driver.c:1872: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
xenapi/xenapi_driver.c:1872: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
...

libcurl allows to disable the type-checking code that triggers those
warnings, along with the reduction in type-safety of calls to some
libcurl functions. I figure this is worth the improved compiler
checking throughout the rest of libvirt.

* acinclude.m4 (--enable-compile-warnings=error): Add -Wlogical-op.
* configure.ac: Add -DCURL_DISABLE_TYPECHECK to LIBCURL_CFLAGS to
avoid compilation warning.

Suggested by Daniel P. Berrange.
Tweaked by Matthias Bolte.

14 years agolibvirt-guests: add reload, condrestart
Eric Blake [Tue, 27 Jul 2010 18:21:31 +0000 (12:21 -0600)]
libvirt-guests: add reload, condrestart

Optional per LSB, but required by Fedora:
https://fedoraproject.org/wiki/Packaging/SysVInitScript

* daemon/libvirt-guests.init.in (main): Add more required
commands.

14 years agolibvirt-guests: enhance status
Eric Blake [Tue, 27 Jul 2010 19:50:35 +0000 (13:50 -0600)]
libvirt-guests: enhance status

LSB and https://fedoraproject.org/wiki/Packaging/SysVInitScript
require status to output something useful, rather than just use
the exit code.

* daemon/libvirt-guests.init.in (rh_status): Break into new routine,
and provide output.
(usage): Document status.

14 years agolibvirt-guests: detect invalid arguments
Eric Blake [Tue, 27 Jul 2010 18:05:27 +0000 (12:05 -0600)]
libvirt-guests: detect invalid arguments

Reject extra arguments.
Return the correct status for unknown arguments, as mandated by
https://fedoraproject.org/wiki/Packaging/SysVInitScript
Add --help, as a permitted extension.

* daemon/libvirt-guests.init.in (usage): New function.  Use it in
more places, and return correct value.

14 years agoInvert logic for checking for QEMU disk cache options
Daniel P. Berrange [Tue, 27 Jul 2010 10:21:10 +0000 (11:21 +0100)]
Invert logic for checking for QEMU disk cache options

QEMU has had two different syntax for disk cache options

 Old: on|off
 New: writeback|writethrough|none

QEMU recently added another 'unsafe' option which broke the
libvirt check. We can avoid this & future breakage, if we
do a negative check for the old syntax, instead of a positive
check for the new syntax

* src/qemu/qemu_conf.c: Invert cache option check

14 years agoqemu: Allow setting boot menu on/off
Cole Robinson [Mon, 26 Jul 2010 14:28:58 +0000 (10:28 -0400)]
qemu: Allow setting boot menu on/off

Add a new element to the <os> block:

  <bootmenu enable="yes|no"/>

Which maps to -boot,menu=on|off on the QEMU command line.

I decided to use an explicit 'enable' attribute rather than just make the
bootmenu element boolean. This allows us to treat lack of a bootmenu element
as 'use hypervisor default'.

14 years agodocs: Link wiki FAQ to main page
Cole Robinson [Mon, 26 Jul 2010 14:32:42 +0000 (10:32 -0400)]
docs: Link wiki FAQ to main page

Since DV recommended keeping the build instructions distributed with the
source, move them from the old FAQ to the downloads page.

14 years agoqemu: Error on unsupported graphics config
Cole Robinson [Mon, 26 Jul 2010 14:30:01 +0000 (10:30 -0400)]
qemu: Error on unsupported graphics config

Throw an explicit error if multiple graphics devices are specified, or
an unsupported type is specified (rdp).

14 years agolibvirt-guests: Don't throw errors if libvirtd is not installed
Jiri Denemark [Tue, 27 Jul 2010 12:21:51 +0000 (14:21 +0200)]
libvirt-guests: Don't throw errors if libvirtd is not installed

When only client parts of libvirt are installed (i.e., no libvirtd
daemon), libvirt-guests init script in its default configuration would
throw seriously looking errors during host shutdown:

Running guests on default URI: error: unable to connect to
'/var/run/libvirt/libvirt-sock', libvirtd may need to be started: No
such file or directory
error: failed to connect to the hypervisor

This patch changes the script to print rather harmless message in that
situation:

Running guests on default URI: libvirtd not installed; skipping this
URI.

14 years agoForce FLR on for buggy SR-IOV devices.
Chris Lalancette [Fri, 23 Jul 2010 19:03:29 +0000 (15:03 -0400)]
Force FLR on for buggy SR-IOV devices.

Some buggy PCI devices actually support FLR, but
forget to advertise that fact in their PCI config space.
However, Virtual Functions on SR-IOV devices are
*required* to support FLR by the spec, so force has_flr
on if this is a virtual function.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agobuild: fix VPATH builds
Eric Blake [Mon, 26 Jul 2010 16:38:30 +0000 (10:38 -0600)]
build: fix VPATH builds

After the recent libvirt-qemu library addition, VPATH builds fail with:

  CC     libvirt_qemu_la-libvirt-qemu.lo
In file included from ../../src/libvirt-qemu.c:29:
../../include/libvirt/libvirt-qemu.h:17:22: error: libvirt.h: No such file or directory
...
  CCLD   libvirt-qmeu.la
/usr/bin/ld: cannot open linker script file libvirt_qemu.syms: No such file or directory

This fixes both issues (there are still some documentation VPATH issues,
but those don't show up with 'make check').

* configure.ac (LIBVIRT_QEMU_SYMBOL_FILE): While libvirt.syms is
generated and lives in $(builddir), libvirt_qemu.syms is static
and lives in $(srcdir).
* include/libvirt/libvirt-qemu.h (includes): Pull in libvirt.h via
the public location, since this is a public header.

14 years agopciResetDevice: use inactive devices to determine safe reset
Chris Wright [Mon, 26 Jul 2010 16:43:04 +0000 (18:43 +0200)]
pciResetDevice: use inactive devices to determine safe reset

When doing a PCI secondary bus reset, we must be sure that there are no
active devices on the same bus segment.  The active device tracking is
designed to only track host devices that are active in use by guests.
This ignores host devices that are actively in use by the host.  So the
current logic will reset host devices.

Switch this logic around and allow sbus reset when we are assigning all
devices behind a bridge to the same guest at guest startup or as a result
of a single attach-device command.

* src/util/pci.h: change signature of pciResetDevice to add an
  inactive devices list
* src/qemu/qemu_driver.c src/xen/xen_driver.c: use (or not) the new
  functionality of pciResetDevice() depending on the place of use
* src/util/pci.c: implement the interface and logic changes

14 years agoqemudDomainAttachHostPciDevice refactor to use new helpers
Chris Wright [Mon, 26 Jul 2010 16:34:24 +0000 (18:34 +0200)]
qemudDomainAttachHostPciDevice refactor to use new helpers

- src/qemu/qemu_driver.c: Eliminate code duplication by using the new
  helpers qemuPrepareHostdevPCIDevices and qemuDomainReAttachHostdevDevices.
  This reduces the number of open coded calls to pciResetDevice.

14 years agoAdd helpers qemuPrepareHostdevPCIDevice and qemuDomainReAttachHostdevDevices
Chris Wright [Mon, 26 Jul 2010 16:23:17 +0000 (18:23 +0200)]
Add helpers qemuPrepareHostdevPCIDevice and qemuDomainReAttachHostdevDevices

- src/qemu/qemu_driver.c: These new helpers take hostdev list and count
  directly rather than getting them indirectly from domain definition.
  This will allow reuse for the attach-device case.

14 years agoqemuGetPciHostDeviceList take hostdev list directly
Chris Wright [Mon, 26 Jul 2010 16:17:20 +0000 (18:17 +0200)]
qemuGetPciHostDeviceList take hostdev list directly

- src/qemu/qemu_driver.c: Update qemuGetPciHostDeviceList to take a
  hostdev list and count directly, rather than getting this indirectly
  from domain definition. This will allow reuse for the attach-device case.

14 years agoesx: Support vSphere 4.1
Matthias Bolte [Wed, 21 Jul 2010 23:19:04 +0000 (01:19 +0200)]
esx: Support vSphere 4.1

Also accept version > 4.1, but output a warning.

14 years agoesx: Add vpx:// scheme to allow direct connection to a vCenter
Matthias Bolte [Sun, 18 Jul 2010 15:27:05 +0000 (17:27 +0200)]
esx: Add vpx:// scheme to allow direct connection to a vCenter

Add a pointer to the primary context of a connection and use it in all
driver functions that don't dependent on the context type. This includes
almost all functions that deal with a virDomianPtr. Therefore, using
a vpx:// connection allows you to perform all the usual domain related
actions like start, destroy, suspend, resume, dumpxml etc.

Some functions that require an explicitly specified ESX server don't work
yet. This includes the host UUID, the hostname, the general node info, the
max vCPU count and the free memory. Also not working yet are migration and
defining new domains.

14 years agoesx: Don't ignore the vcenter query parameter
Matthias Bolte [Tue, 13 Jul 2010 20:44:07 +0000 (22:44 +0200)]
esx: Don't ignore the vcenter query parameter

Since 070f61002f47b602c15d1e4950a122ac9edefe1b the vcenter query
parameter has been ignored, because the refactoring to use
esxUtil_ParseQuery was incomplete. This effectively broke migration,
because the vcenter query parameter is essential for a migration.

14 years agoesx: Add autodetection for the SCSI controller model
Matthias Bolte [Tue, 6 Jul 2010 17:02:48 +0000 (19:02 +0200)]
esx: Add autodetection for the SCSI controller model

This works for file-backed SCSI disk device with a datastore
related source path.

14 years agoesx: Allow 'vmpvscsi' as SCSI controller model
Matthias Bolte [Thu, 24 Jun 2010 14:58:54 +0000 (16:58 +0200)]
esx: Allow 'vmpvscsi' as SCSI controller model

14 years agosecaatest: Fix compilation
Matthias Bolte [Fri, 23 Jul 2010 16:49:48 +0000 (18:49 +0200)]
secaatest: Fix compilation

Since 68719c4bddb85fbcc931a5b7d99ac7c8a0af09b0 virSecurityDriverStartup
takes and additional parameter to control disk format probing.

Pass false as third parameter.

14 years agovirt-aa-helper-test: Fix failure due to the new disk format probing option
Matthias Bolte [Fri, 23 Jul 2010 16:43:37 +0000 (18:43 +0200)]
virt-aa-helper-test: Fix failure due to the new disk format probing option

Commit 68719c4bddb85fbcc931a5b7d99ac7c8a0af09b0 added the disk format
probing option. This makes virt-aa-helper-test fail because the domain
config didn't specifiy the disk format and it didn't pass '-p 1' to
virt-aa-helper to allow disk format probing.

Specify the disk format in the domain config. Pass the '-p 1' option
to virt-aa-helper for the test case with two disks. This way this test
also covers this new option.

14 years agovirt-aa-helper: Make getopt accept the p option
Matthias Bolte [Fri, 23 Jul 2010 16:41:42 +0000 (18:41 +0200)]
virt-aa-helper: Make getopt accept the p option

Commit 68719c4bddb85fbcc931a5b7d99ac7c8a0af09b0 added the
p option to control disk format probing, but it wasn't added
to the getopt_long optstring parameter.

Add the p option to the getopt_long optstring parameter.

14 years agovirt-aa-helper: Fix return value of add_file_path
Matthias Bolte [Fri, 23 Jul 2010 16:27:43 +0000 (18:27 +0200)]
virt-aa-helper: Fix return value of add_file_path

Commit a8853344994a7c6aaca882a5e949ab5536821ab5 added this
function and wrapped vah_add_file in it. vah_add_file may
return -1, 0, 1. It returns 1 in case the call to valid_path
detects a restricted file. The original code treated a return
value != 0 as error. The refactored code treats a return
value < 0 as error. This triggers segfault in virt-aa-helper
and breaks virt-aa-helper-test for the restricted file tests.

Make sure that add_file_path returns -1 on error.

14 years agovirt-aa-helper: Ignore open errors again
Matthias Bolte [Fri, 23 Jul 2010 16:09:46 +0000 (18:09 +0200)]
virt-aa-helper: Ignore open errors again

virt-aa-helper used to ignore errors when opening files.
Commit a8853344994a7c6aaca882a5e949ab5536821ab5 refactored
the related code and changed this behavior. virt-aa-helper
didn't ignore open errors anymore and virt-aa-helper-test
fails.

Make sure that virt-aa-helper ignores open errors again.

14 years agoqemu-api: avoid build failure
Eric Blake [Fri, 23 Jul 2010 23:01:10 +0000 (17:01 -0600)]
qemu-api: avoid build failure

* src/remote_protocol-structs: Tweak to match intentional type
change (with no ABI change) in remote protocol.

14 years agoAdd tests for the new Qemu namespace XML.
Chris Lalancette [Tue, 20 Apr 2010 21:22:49 +0000 (17:22 -0400)]
Add tests for the new Qemu namespace XML.

Thanks to DV for knocking together the Relax-NG changes
quickly for me.

Changes since v1:
 - Change the domain.rng to correspond to the new schema
 - Don't allocate caps->ns in testQemuCapsInit since it is a static table

Changes since v2:
 - Change domain.rng to add restrictions on allowed environment names

Changes since v3:
 - Remove a bogus comment in the tests

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoQemu remote protocol.
Chris Lalancette [Sat, 17 Apr 2010 02:09:25 +0000 (22:09 -0400)]
Qemu remote protocol.

Since we are adding a new "per-hypervisor" protocol, we
make it so that the qemu remote protocol uses a new
PROTOCOL and PROGRAM number.  This allows us to easily
distinguish it from the normal REMOTE protocol.

This necessitates changing the proc in remote_message_header
from a "remote_procedure" to an "unsigned", which should
be the same size (and thus preserve the on-wire protocol).

Changes since v1:
 - Fixed up a couple of script problems in remote_generate_stubs.pl
 - Switch an int flag to a bool in dispatch.c

Changes since v2:
 - None

Changes since v3:
 - Change unsigned proc to signed proc, to conform to spec

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoQemu arbitrary monitor commands.
Chris Lalancette [Sat, 17 Apr 2010 02:12:45 +0000 (22:12 -0400)]
Qemu arbitrary monitor commands.

Implement the qemu driver's virDomainQemuMonitorCommand
and hook it into the API entry point.

Changes since v1:
 - Rename the (external) qemuMonitorCommand to qemuDomainMonitorCommand
 - Add virCheckFlags to qemuDomainMonitorCommand

Changes since v2:
 - Drop ATTRIBUTE_UNUSED from the flags

Changes since v3:
 - Add a flag to priv so we only print out monitor command warning once.  Note
   that this has not been plumbed into qemuDomainObjPrivateXMLFormat or
   qemuDomainObjPrivateXMLParse, which means that if you run a monitor command,
   restart libvirtd, and then run another monitor command, you may get an
   an erroneous VIR_INFO.  It's a pretty minor matter, and I didn't think it
   warranted the additional code.
 - Add BeginJob/EndJob calls around EnterMonitor/ExitMonitor

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoQemu Monitor API entry point.
Chris Lalancette [Tue, 13 Apr 2010 18:02:46 +0000 (14:02 -0400)]
Qemu Monitor API entry point.

Add the library entry point for the new virDomainQemuMonitorCommand()
entry point.  Because this is not part of the "normal" libvirt API,
it gets its own header file, library file, and will eventually
get its own over-the-wire protocol later in the series.

Changes since v1:
 - Go back to using the virDriver table for qemuDomainMonitorCommand, due to
   linking issues
 - Added versioning information to the libvirt-qemu.so

Changes since v2:
 - None

Changes since v3:
 - Add LGPL header to libvirt-qemu.c
 - Make virLibConnError and virLibDomainError macros instead of function calls

Changes since v4:
 - Move exported symbols to libvirt_qemu.syms

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoHandle arbitrary qemu command-lines in qemuParseCommandLine.
Chris Lalancette [Mon, 19 Apr 2010 20:34:00 +0000 (16:34 -0400)]
Handle arbitrary qemu command-lines in qemuParseCommandLine.

Now that we have the ability to specify arbitrary qemu
command-line parameters in the XML, use it to handle unknown
command-line parameters when doing a native-to-xml conversion.

Changes since v1:
 - Rename num_extra to num_args
 - Fix up a memory leak on an error path

Changes since v2:
 - Add a VIR_WARN when adding the argument via qemu:arg

Changes since v3:
 - None

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoQemu arbitrary command-line arguments.
Chris Lalancette [Sat, 17 Apr 2010 01:49:31 +0000 (21:49 -0400)]
Qemu arbitrary command-line arguments.

Implement the qemu hooks for XML namespace data.  This
allows us to specify a qemu XML namespace, and then
specify:

<qemu:commandline>
 <qemu:arg value='arg'/>
 <qemu:env name='name' value='value'/>
</qemu:commandline>

In the domain XML.

Changes since v1:
 - Change the <qemu:arg>arg</qemu:arg> XML to <qemu:arg value='arg'/> XML
 - Fix up some memory leaks in qemuDomainDefNamespaceParse
 - Rename num_extra and extra to num_args and args, respectively
 - Fixed up some error messages
 - Make sure to escape user-provided data in qemuDomainDefNamespaceFormatXML

Changes since v2:
 - Add checking to ensure environment variable names are valid
 - Invert the logic in qemuDomainDefNamespaceFormatXML to return early

Changes since v3:
 - Change strspn() to c_isalpha() check of first letter of environment variable

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoAdd namespace callback hooks to domain_conf.
Chris Lalancette [Sat, 17 Apr 2010 03:08:29 +0000 (23:08 -0400)]
Add namespace callback hooks to domain_conf.

This patch adds namespace XML parsers to be hooked into
the main domain parser.  This allows for individual hypervisor
drivers to add per-namespace XML into the main domain XML.

Changes since v1:
 - Use a statically declared table for caps->ns, removing the need to
   allocate/free it.

Changes since v2:
 - None

Changes since v3:
 - None

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoFix SEGV on exit after domainEventDeregister()
Philipp Hahn [Tue, 13 Jul 2010 08:54:26 +0000 (10:54 +0200)]
Fix SEGV on exit after domainEventDeregister()

When the last callback is removed using domainEventDeregister(), the
events dispatcher is deregistered from the C-library, but
domainEventsCallbacks is still an empty list.
On shutdown __del__() deregisters the dispatacher again, which SEGVs

# You need the event-loop implementation from the Python examples;
# give the file a name which is importable by Python.
ln examples/domain-events/events-python/event-test.py eloop.py
python -c 'from eloop import *
import sys

def dump(*args): print " ".join(map(str, args))

virEventLoopPureStart()
c = libvirt.open("xen:///")
c.domainEventRegister(dump, None)
c.domainEventDeregister(dump)
sys.exit(0)'

domainEventDeregister() needs to delete domainEventCallbacks so subsequent
calls to __del__() and domainEventRegister() choose the right code paths.
Setting it to None is not enough, since calling domainEventRegiser() again
would trigger an TypeError.

Signed-off-by: Philipp Hahn <hahn@univention.de>
14 years agoFix .mailmap after accidental wrong committer address
Daniel P. Berrange [Fri, 23 Jul 2010 09:43:45 +0000 (10:43 +0100)]
Fix .mailmap after accidental wrong committer address

14 years agopciSharesBusWithActive fails to find multiple devices on bus
Chris Wright [Fri, 23 Jul 2010 09:25:24 +0000 (11:25 +0200)]
pciSharesBusWithActive fails to find multiple devices on bus

The first conditional is always true which means the iterator will
never find another device on the same bus.

    if (dev->domain != check->domain ||
        dev->bus != check->bus ||
  ----> (check->slot == check->slot &&
         check->function == check->function)) <-----

The goal of that check is to verify that the device is either:

  in a different pci domain
  on a different bus
  is the same identical device

This means libvirt may issue a secondary bus reset when there are
devices
on that bus that actively in use by the host or another guest.

* src/util/pci.c: fix a bogus test in pciSharesBusWithActive()

14 years agoFix incorrect use of private data in remote driver
Daniel P. Berrange [Thu, 22 Jul 2010 09:34:21 +0000 (05:34 -0400)]
Fix incorrect use of private data in remote driver

The remote driver is using the wrong privateData field in
a couple of functions. THis is harmless for stateful
drivers like QEMU/UML/LXC, but will crash with Xen

* src/remote/remote_driver.c: Fix use of privateData field

14 years agoSet a stable & high MAC addr for guest TAP devices on host
Daniel P. Berrange [Wed, 21 Jul 2010 10:08:52 +0000 (11:08 +0100)]
Set a stable & high MAC addr for guest TAP devices on host

A Linux software bridge will assume the MAC address of the enslaved
interface with the numerically lowest MAC addr. When the bridge
changes MAC address there is a period of network blackout, so a
change should be avoided. The kernel gives TAP devices a completely
random MAC address. Occassionally the random TAP device MAC is lower
than that of the physical interface (eth0, eth1etc) that is enslaved,
causing the bridge to change its MAC.

This change sets an explicit MAC address for all TAP devices created
using the configured MAC from the XML, but with the high byte set
to 0xFE. This should ensure TAP device MACs are higher than any
physical interface MAC.

* src/qemu/qemu_conf.c, src/uml/uml_conf.c: Pass in a MAC addr
  for the TAP device with high byte set to 0xFE
* src/util/bridge.c, src/util/bridge.h: Set a MAC when creating
  the TAP device to override random MAC

14 years agoFix PCI address assignment if no IDE controller is present
Daniel P. Berrange [Wed, 21 Jul 2010 11:40:21 +0000 (12:40 +0100)]
Fix PCI address assignment if no IDE controller is present

The PCI slot 1 must be reserved at all times, since PIIX3 is
always present, even if no IDE device is in use for guest disks

* src/qemu/qemu_conf.c: Always reserve slot 1 for PIIX3

14 years agolxc: force kill of init process by sending SIGKILL if needed
Ryota Ozaki [Thu, 22 Jul 2010 16:57:43 +0000 (18:57 +0200)]
lxc: force kill of init process by sending SIGKILL if needed

Init process may remain after sending SIGTERM for some reason.
For example, if original init program is used, it is definitely
not killed by SIGTERM.

* src/lxc/lxc_controller.c: kill with SIGKILL if SIGTERM wasn't
  sufficient

14 years agoRemove erroneous setting of return value to errno.
Laine Stump [Mon, 19 Jul 2010 23:52:57 +0000 (19:52 -0400)]
Remove erroneous setting of return value to errno.

One error exit in virStorageBackendCreateBlockFrom was setting the
return value to errno. The convention for volume build functions is to
return 0 on success or -1 on failure. Not only was it not necessary to
set the return value (it defaults to -1, and is set to 0 when
everything has been successfully completed), in the case that some
caller were checking for < 0 rather than != 0, they would incorrectly
believe that it completed successfully.

14 years agoChange virDirCreate to return -errno on failure.
Laine Stump [Mon, 19 Jul 2010 23:48:59 +0000 (19:48 -0400)]
Change virDirCreate to return -errno on failure.

virDirCreate also previously returned 0 on success and errno on
failure. This makes it fit the recommended convention of returning 0
on success, -errno (ie a negative number) on failure.

14 years agoMake virStorageBackendCopyToFD return -errno.
Laine Stump [Mon, 19 Jul 2010 23:35:30 +0000 (19:35 -0400)]
Make virStorageBackendCopyToFD return -errno.

Previously virStorageBackendCopyToFD would simply return -1 on
error. This made the error return from one of its callers inconsistent
(createRawFileOpHook is supposed to return -errno, but if
virStorageBackendCopyToFD failed, createRawFileOpHook would just
return -1). Since there is a useful errno in every case of error
return from virStorageBackendCopyToFD, and since the other uses of
that function ignore the return code (beyond simply checking to see if
it is < 0), this is a safe change.

14 years agoChange virFileOperation to return -errno (ie < 0) on error.
Laine Stump [Mon, 19 Jul 2010 23:25:58 +0000 (19:25 -0400)]
Change virFileOperation to return -errno (ie < 0) on error.

virFileOperation previously returned 0 on success, or the value of
errno on failure. Although there are other functions in libvirt that
use this convention, the preferred (and more common) convention is to
return 0 on success and -errno (or simply -1 in some cases) on
failure. This way the check for failure is always (ret < 0).

* src/util/util.c - change virFileOperation and virFileOperationNoFork to
                    return -errno on failure.

* src/storage/storage_backend.c, src/qemu/qemu_driver.c
  - change the hook functions passed to virFileOperation to return
    -errno on failure.

14 years agoDocument the memory balloon device
Daniel P. Berrange [Wed, 21 Jul 2010 10:53:56 +0000 (11:53 +0100)]
Document the memory balloon device

* formatdomain.html.in: Document <memballoon> element

14 years agoRe-arrange PCI device address assignment to match QEMU's default
Daniel P. Berrange [Tue, 20 Jul 2010 11:57:11 +0000 (12:57 +0100)]
Re-arrange PCI device address assignment to match QEMU's default

To try and ensure that people upgrading from old QEMU get guests
with the same PCI device ordering, change the way we assign addrs
to match QEMU's default order. This should make Windows less
annoyed.

* src/qemu/qemu_conf.c: Follow QEMU's default PCI ordering
  logic when assigning addresses
* tests/*.args: Update for changed PCI addresses

14 years agoExplicitly represent balloon device in XML and handle PCI address
Daniel P. Berrange [Thu, 15 Jul 2010 13:02:42 +0000 (14:02 +0100)]
Explicitly represent balloon device in XML and handle PCI address

To allow compatibility with older QEMU PCI device slot assignment
it is necessary to explicitly track the balloon device in the
XML. This introduces a new device

   <memballoon model='virtio|xen'/>

It can also have a PCI address, auto-assigned if necessary.

The memballoon will be automatically added to all Xen and QEMU
guests by default.

* docs/schemas/domain.rng: Add <memballoon> element
* src/conf/domain_conf.c, src/conf/domain_conf.h: parsing
  and formatting for memballoon device. Always add a memory
  balloon device to Xen/QEMU if none exists in XML
* src/libvirt_private.syms: Export memballoon model APIs
* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Honour the
  PCI device address in memory balloon device
* tests/*: Update to test new functionality

14 years agoRearrange VGA/IDE controller address reservation
Daniel P. Berrange [Thu, 15 Jul 2010 13:44:18 +0000 (14:44 +0100)]
Rearrange VGA/IDE controller address reservation

The first VGA and IDE devices need to have fixed PCI address
reservations. Currently this is handled inline with the other
non-primary VGA/IDE devices. The fixed virtio balloon device
at slot 3, ensures auto-assignment skips the slots 1/2. The
virtio address will shortly become configurable though. This
means the reservation of fixed slots needs to be done upfront
to ensure that they don't get re-used for other devices.

This is more or less reverting the previous changeset:

  commit 83acdeaf173b2a1206b755c1ab317cac36facd90
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Wed Feb 3 16:11:29 2010 +0000

  Fix restore of QEMU guests with PCI device reservation

The difference is that this time, instead of unconditionally
reserving the address, we only reserve the address if it was
initially type=none. Addresses of type=pci were handled
earlier in process by qemuDomainPCIAddressSetCreate(). This
ensures restore step doesn't have problems

* src/qemu/qemu_conf.c: Reserve first VGA + IDE address
  upfront

14 years agoRemove inappropriate use of VIR_ERR_NO_SUPPORT
Daniel P. Berrange [Thu, 15 Jul 2010 13:27:27 +0000 (14:27 +0100)]
Remove inappropriate use of VIR_ERR_NO_SUPPORT

The VIR_ERR_NO_SUPPORT refers to an API which is not implemented.
There is a separate VIR_ERR_CONFIG_UNSUPPORTED for XML config
options that are not available with the current hypervisor.

* src/qemu/qemu_conf.c, src/qemu/qemu_driver.c: Remove
  many VIR_ERR_NO_SUPPORT replace with VIR_ERR_CONFIG_UNSUPPORTED

14 years agoFix a NULL dereference in the case that the arg in question
Chris Lalancette [Tue, 20 Jul 2010 16:51:12 +0000 (12:51 -0400)]
Fix a NULL dereference in the case that the arg in question
didn't exist.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoRemove bogus free of static strings
Daniel P. Berrange [Mon, 19 Jul 2010 17:59:34 +0000 (18:59 +0100)]
Remove bogus free of static strings

Remove bogus free of statically allocated strings introduced
in 03ca42046a54c5cfadb2e69194896abf06f6a10f

* src/conf/capabilities.c: Don't free static strings for
  default disk driver type/name

14 years agoFix a deadlock in bi-directional p2p concurrent migration.
Chris Lalancette [Thu, 15 Jul 2010 14:12:35 +0000 (10:12 -0400)]
Fix a deadlock in bi-directional p2p concurrent migration.

If you try to execute two concurrent migrations p2p
from A->B and B->A, the two libvirtd's will deadlock
trying to perform the migrations.  The reason for this is
that in p2p migration, the libvirtd's are responsible for
making the RPC Prepare, Migrate, and Finish calls.  However,
they are currently holding the driver lock while doing so,
which basically guarantees deadlock in this scenario.

This patch fixes the situation by adding
qemuDomainObjEnterRemoteWithDriver and
qemuDomainObjExitRemoteWithDriver helper methods.  The Enter
take an additional object reference, then drops both the
domain object lock and the driver lock.  The Exit takes
both the driver and domain object lock, then drops the
reference.  Adding calls to these Enter and Exit helpers
around remote calls in the various migration methods
seems to fix the problem for me in testing.

This should make the situation safe. The additional domain
object reference ensures that the domain object won't disappear
while this operation is happening.  The BeginJob that is called
inside of qemudDomainMigratePerform ensures that we can't execute a
second migrate (or shutdown, or save, etc) job while the
migration is active.  Finally, the additional check on the state
of the vm after we reacquire the locks ensures that we can't
be surprised by an external event (domain crash, etc).

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoMake virsh setmaxmem balloon only when successful.
Chris Lalancette [Tue, 30 Mar 2010 13:03:26 +0000 (09:03 -0400)]
Make virsh setmaxmem balloon only when successful.

After playing around with virsh setmaxmem for a bit,
I ran into some surprising behavior; if a hypervisor does
not support the virDomainSetMaxMemory() API, but the value
specified for setmaxmem is less than the current amount
of memory in the domain, the domain would be ballooned
down *before* an error was reported.

To make this more consistent, run virDomainSetMaxMemory()
before trying to shrink; that way, if an error is thrown,
no changes to the running domain are made.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoUse unsigned long in cmdSetmem.
Chris Lalancette [Thu, 17 Jun 2010 19:36:36 +0000 (15:36 -0400)]
Use unsigned long in cmdSetmem.

The virsh command "setmem" takes as input a number that
should represent an unsigned long number of kilobytes.  Fix
cmdSetmem to properly parse this as an unsigned long instead
of an int.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agofsync new storage volumes even if new volume was copied.
Laine Stump [Mon, 19 Jul 2010 22:59:07 +0000 (18:59 -0400)]
fsync new storage volumes even if new volume was copied.

Originally the storage volume files were opened with O_DSYNC to make
sure they were flushed to disk immediately. It turned out that this
was extremely slow in some cases, so the O_DSYNC was removed in favor
of just calling fsync() after all the data had been written. However,
this call to fsync was inside the block that is executed to zero-fill
the end of the volume file. In cases where the new volume is copied
from an old volume, and they are the same length, this fsync would
never take place.

Now the fsync is *always* done, unless there is an error (in which
case it isn't important, and is most likely inappropriate.

14 years agoDon't skip zero'ing end of volume file when inputvol is shorter than newvol
Laine Stump [Mon, 19 Jul 2010 22:53:38 +0000 (18:53 -0400)]
Don't skip zero'ing end of volume file when inputvol is shorter than newvol

A missing set of braces around an error condition caused us to skip
zero'ing out the remainder of a new volume file if the new volume was
longer than the original (the goto was supposed to be taken only in
the case of error, but was always being taken).

14 years agoAlways clear out the last_error in virshReportError.
Chris Lalancette [Fri, 18 Jun 2010 14:14:04 +0000 (10:14 -0400)]
Always clear out the last_error in virshReportError.

Otherwise you can get bogus "unknown error" printouts on
subsequent commands.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoFix up inconsistent virsh option error reporting.
Chris Lalancette [Thu, 17 Jun 2010 18:58:55 +0000 (14:58 -0400)]
Fix up inconsistent virsh option error reporting.

The virsh option error reporting was not being used
consistently; some commands would spit out errors on
missing required options while others would just silently fail.
However, vshCommandOptString knows which ones are required
and which ones aren't, so make it spit out an error where
appropriate.  The rest of the patch is just cleaning up
the uses of vshCommandOptString to deal with the new error
reporting.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoUse the extract backing store format in storage volume lookup
Daniel P. Berrange [Fri, 9 Jul 2010 10:28:40 +0000 (11:28 +0100)]
Use the extract backing store format in storage volume lookup

The storage volume lookup code was probing for the backing store
format, instead of using the format extracted from the file
itself. This meant it could report in accurate information. If
a format is included in the file, then use that in preference,
with probing as a fallback.

* src/storage/storage_backend_fs.c: Use extracted backing store
  format

14 years agoRewrite qemu-img backing store format handling
Daniel P. Berrange [Wed, 16 Jun 2010 13:14:05 +0000 (14:14 +0100)]
Rewrite qemu-img backing store format handling

When creating qcow2 files with a backing store, it is important
to set an explicit format to prevent QEMU probing. The storage
backend was only doing this if it found a 'kvm-img' binary. This
is wrong because plenty of kvm-img binaries don't support an
explicit format, and plenty of 'qemu-img' binaries do support
a format. The result was that most qcow2 files were not getting
a backing store format.

This patch runs 'qemu-img -h' to check for the two support
argument formats

  '-o backing_format=raw'
  '-F raw'

and use whichever option it finds

* src/storage/storage_backend.c: Query binary to determine
  how to set the backing store format

14 years agoAdd ability to set a default driver name/type when parsing disks
Daniel P. Berrange [Mon, 14 Jun 2010 15:08:55 +0000 (16:08 +0100)]
Add ability to set a default driver name/type when parsing disks

Record a default driver name/type in capabilities struct. Use this
when parsing disks if value is not set in XML config.

* src/conf/capabilities.h: Record default driver name/type for disks
* src/conf/domain_conf.c: Fallback to default driver name/type
  when parsing disks
* src/qemu/qemu_driver.c: Set default driver name/type to raw

14 years agoDisable all disk probing in QEMU driver & add config option to re-enable
Daniel P. Berrange [Tue, 15 Jun 2010 16:58:58 +0000 (17:58 +0100)]
Disable all disk probing in QEMU driver & add config option to re-enable

Disk format probing is now disabled by default. A new config
option in /etc/qemu/qemu.conf will re-enable it for existing
deployments where this causes trouble

14 years agoPass security driver object into all security driver callbacks
Daniel P. Berrange [Tue, 15 Jun 2010 16:44:19 +0000 (17:44 +0100)]
Pass security driver object into all security driver callbacks

The implementation of security driver callbacks often needs
to access the security driver object. Currently only a handful
of callbacks include the driver object as a parameter. Later
patches require this is many more places.

* src/qemu/qemu_driver.c: Pass in the security driver object
  to all callbacks
* src/qemu/qemu_security_dac.c, src/qemu/qemu_security_stacked.c,
  src/security/security_apparmor.c, src/security/security_driver.h,
  src/security/security_selinux.c: Add a virSecurityDriverPtr
  param to all security callbacks

14 years agoConvert all disk backing store loops to shared helper API
Daniel P. Berrange [Tue, 15 Jun 2010 15:40:47 +0000 (16:40 +0100)]
Convert all disk backing store loops to shared helper API

Update the QEMU cgroups code, QEMU DAC security driver, SELinux
and AppArmour security drivers over to use the shared helper API
virDomainDiskDefForeachPath().

* src/qemu/qemu_driver.c, src/qemu/qemu_security_dac.c,
  src/security/security_selinux.c, src/security/virt-aa-helper.c:
  Convert over to use virDomainDiskDefForeachPath()

14 years agoAdd an API for iterating over disk paths
Daniel P. Berrange [Mon, 14 Jun 2010 17:09:15 +0000 (18:09 +0100)]
Add an API for iterating over disk paths

There is duplicated code which iterates over disk backing stores
performing some action. Provide a convenient helper for doing
this to eliminate duplication & risk of mistakes with disk format
probing

* src/conf/domain_conf.c, src/conf/domain_conf.h,
  src/libvirt_private.syms: Add virDomainDiskDefForeachPath()

14 years agoRequire format to be passed into virStorageFileGetMetadata
Daniel P. Berrange [Tue, 15 Jun 2010 15:15:51 +0000 (16:15 +0100)]
Require format to be passed into virStorageFileGetMetadata

Require the disk image to be passed into virStorageFileGetMetadata.
If this is set to VIR_STORAGE_FILE_AUTO, then the format will be
resolved using probing. This makes it easier to control when
probing will be used

* src/qemu/qemu_driver.c, src/qemu/qemu_security_dac.c,
  src/security/security_selinux.c, src/security/virt-aa-helper.c:
  Set VIR_STORAGE_FILE_AUTO when calling virStorageFileGetMetadata.
* src/storage/storage_backend_fs.c: Probe for disk format before
  calling virStorageFileGetMetadata.
* src/util/storage_file.h, src/util/storage_file.c: Remove format
  from virStorageFileMeta struct & require it to be passed into
  method.

14 years agoRefactor virStorageFileGetMetadataFromFD to separate functionality
Daniel P. Berrange [Tue, 15 Jun 2010 13:58:10 +0000 (14:58 +0100)]
Refactor virStorageFileGetMetadataFromFD to separate functionality

The virStorageFileGetMetadataFromFD did two jobs in one. First
it probed for storage type, then it extracted metadata for the
type. It is desirable to be able to separate these jobs, allowing
probing without querying metadata, and querying metadata without
probing.

To prepare for this, split out probing code into a new pair of
methods

  virStorageFileProbeFormatFromFD
  virStorageFileProbeFormat

* src/util/storage_file.c, src/util/storage_file.h,
  src/libvirt_private.syms: Introduce virStorageFileProbeFormat
  and virStorageFileProbeFormatFromFD

14 years agoRemove 'type' field from FileTypeInfo struct
Daniel P. Berrange [Mon, 14 Jun 2010 15:39:32 +0000 (16:39 +0100)]
Remove 'type' field from FileTypeInfo struct

Instead of including a field in FileTypeInfo struct for the
disk format, rely on the array index matching the format.
Use verify() to assert the correct number of elements in the
array.

* src/util/storage_file.c: remove type field from FileTypeInfo

14 years agoExtract the backing store format as well as name, if available
Daniel P. Berrange [Mon, 14 Jun 2010 14:53:59 +0000 (15:53 +0100)]
Extract the backing store format as well as name, if available

When QEMU opens a backing store for a QCow2 file, it will
normally auto-probe for the format of the backing store,
rather than assuming it has the same format as the referencing
file. There is a QCow2 extension that allows an explicit format
for the backing store to be embedded in the referencing file.
This closes the auto-probing security hole in QEMU.

This backing store format can be useful for libvirt users
of virStorageFileGetMetadata, so extract this data and report
it.

QEMU does not require disk image backing store files to be in
the same format the file linkee. It will auto-probe the disk
format for the backing store when opening it. If the backing
store was intended to be a raw file this could be a security
hole, because a guest may have written data into its disk that
then makes the backing store look like a qcow2 file. If it can
trick QEMU into thinking the raw file is a qcow2 file, it can
access arbitrary files on the host by adding further backing
store links.

To address this, callers of virStorageFileGetMeta need to be
told of the backing store format. If no format is declared,
they can make a decision whether to allow format probing or
not.

14 years agoCVE-2010-2242 Apply a source port mapping to virtual network masquerading
Daniel P. Berrange [Thu, 10 Jun 2010 16:50:38 +0000 (12:50 -0400)]
CVE-2010-2242 Apply a source port mapping to virtual network masquerading

IPtables will seek to preserve the source port unchanged when
doing masquerading, if possible. NFS has a pseudo-security
option where it checks for the source port <= 1023 before
allowing a mount request. If an admin has used this to make the
host OS trusted for mounts, the default iptables behaviour will
potentially allow NAT'd guests access too. This needs to be
stopped.

With this change, the iptables -t nat -L -n -v rules for the
default network will be

Chain POSTROUTING (policy ACCEPT 95 packets, 9163 bytes)
 pkts bytes target     prot opt in     out     source               destination
   14   840 MASQUERADE  tcp  --  *      *       192.168.122.0/24    !192.168.122.0/24    masq ports: 1024-65535
   75  5752 MASQUERADE  udp  --  *      *       192.168.122.0/24    !192.168.122.0/24    masq ports: 1024-65535
    0     0 MASQUERADE  all  --  *      *       192.168.122.0/24    !192.168.122.0/24

* src/network/bridge_driver.c: Add masquerade rules for TCP
  and UDP protocols
* src/util/iptables.c, src/util/iptables.c: Add source port
  mappings for TCP & UDP protocols when masquerading.

14 years agoman pages: update authors and copyright notice for libvirtd and virsh
Justin Clift [Mon, 12 Jul 2010 19:33:35 +0000 (05:33 +1000)]
man pages: update authors and copyright notice for libvirtd and virsh

This patch removes the individual author names from the libvirtd and virsh
man pages, instead referring to the main AUTHORS file distributed with
libvirt.  This approach is needed, as we can't guarantee unicode support
across all versions of pod2man used with libvirt.

Additionally, this patch includes the libvirtd man page in the spec file
used with "make rpm".  Without this patch "make rpm" is broken.

14 years agoFix compile on i686.
Chris Lalancette [Fri, 16 Jul 2010 13:14:53 +0000 (09:14 -0400)]
Fix compile on i686.

When printing out size_t, we need to use %zu to make sure it
will continue to compile on both 32-bit and 64-bit platforms.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoRemove unused and bitrotting vshCommandOptStringList
Chris Lalancette [Thu, 17 Jun 2010 15:25:35 +0000 (11:25 -0400)]
Remove unused and bitrotting vshCommandOptStringList

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoRemove error checking after using vshMalloc.
Chris Lalancette [Thu, 17 Jun 2010 15:24:01 +0000 (11:24 -0400)]
Remove error checking after using vshMalloc.

vshMalloc and friends always exit() on allocation failure,
so there is no reason to do checking for NULL in the code
that uses it.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoRemove the "showerror" parameter from vshConnectionUsability.
Chris Lalancette [Thu, 17 Jun 2010 14:47:06 +0000 (10:47 -0400)]
Remove the "showerror" parameter from vshConnectionUsability.

Nobody was using it anyway.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoRFC: Canonicalize block device paths
David Allan [Thu, 8 Jul 2010 22:04:26 +0000 (18:04 -0400)]
RFC: Canonicalize block device paths

There are many naming conventions for partitions associated with a
block device.  Some of the major ones are:

/dev/foo -> /dev/foo1
/dev/foo1 -> /dev/foo1p1
/dev/mapper/foo -> /dev/mapper/foop1
/dev/disk/by-path/foo -> /dev/disk/by-path/foo-part1

The universe of possible conventions isn't clear.  Rather than trying
to understand all possible conventions, this patch divides devices
into two groups, device mapper devices and everything else.  Device
mapper devices seem always to follow the convention of device ->
devicep1; everything else is canonicalized.

14 years agodaemon: dispatch.c should include stdio.h (and stdarg.h)
Ryota Ozaki [Thu, 8 Jul 2010 11:42:22 +0000 (20:42 +0900)]
daemon: dispatch.c should include stdio.h (and stdarg.h)

dispatch.c requires stdio.h (and stdarg.h), however, currently
dispatch.c implicitly relys on rpc/xdr.h to include stdio.h.
If rpc/xdr.h unxpectedly does not include stdio.h, the compilation
of dispatch.c fails.

This can happen, for example, when portablexdr is installed
under /usr/local; because portablexdr's rpc/xdr.h does not
include stdio.h and gcc looks up it not /usr/include/rpc/xdr.h.

Note that stdarg.h is also included according to man va_start,
although stdio.h seems including it anyway.

14 years agouml_driver: correct logic error in umlMonitorCommand
Jim Meyering [Tue, 13 Jul 2010 20:28:35 +0000 (15:28 -0500)]
uml_driver: correct logic error in umlMonitorCommand

* src/uml/uml_driver.c (umlMonitorCommand): Correct flaw that would
cause unconditional "incomplete reply ..." failure, since "nbytes"
was always 0 or 1.

14 years agoqemuConnectMonitor: fix a bug that would have masked SELinux failure
Jim Meyering [Tue, 13 Jul 2010 20:15:04 +0000 (15:15 -0500)]
qemuConnectMonitor: fix a bug that would have masked SELinux failure

* src/qemu/qemu_driver.c (qemuConnectMonitor): Correct erroneous
parenthesization in two expressions.  Without this fix, failure
to set or clear SELinux security context in the monitor would go
undiagnosed.  Also correct a diagnostic and split some long lines.

14 years agopython: Fix IOErrorReasonCallback bindings
Cole Robinson [Tue, 13 Jul 2010 22:07:19 +0000 (18:07 -0400)]
python: Fix IOErrorReasonCallback bindings

A copy and paste error was causing us to dispatch the incorrect
routine. Spotted by Dan Kenigsberg.

14 years ago.gitignore: Ignore generated libvirtd docs
Cole Robinson [Tue, 13 Jul 2010 22:10:49 +0000 (18:10 -0400)]
.gitignore: Ignore generated libvirtd docs

14 years agoesx: Make esxVI_*_Deserialize dynamically dispatched
Matthias Bolte [Tue, 6 Jul 2010 15:27:05 +0000 (17:27 +0200)]
esx: Make esxVI_*_Deserialize dynamically dispatched

This will be used to deserialize the response from a call
to esxVI_SearchDatastore_Task properly.

14 years agoAdd openauth example to demonstrate a custom auth callback
Matthias Bolte [Tue, 6 Jul 2010 12:59:50 +0000 (14:59 +0200)]
Add openauth example to demonstrate a custom auth callback

14 years agoEliminate compiler warning due to gettext string with no format args
Laine Stump [Tue, 13 Jul 2010 03:35:43 +0000 (23:35 -0400)]
Eliminate compiler warning due to gettext string with no format args

14 years agodocs: fix so generated .html files are removed with make clean
Justin Clift [Sat, 10 Jul 2010 12:49:26 +0000 (22:49 +1000)]
docs: fix so generated .html files are removed with make clean

14 years agocpuCompare: Fix crash on unexpected CPU XML
Jiri Denemark [Mon, 12 Jul 2010 15:30:23 +0000 (17:30 +0200)]
cpuCompare: Fix crash on unexpected CPU XML

When comparing a CPU without <model> element, such as

    <cpu>
        <topology sockets='1' cores='1' threads='1'/>
    </cpu>

libvirt would happily crash without warning.

14 years agocpu: Fail when CPU type cannot be detected from XML
Jiri Denemark [Mon, 12 Jul 2010 14:08:00 +0000 (16:08 +0200)]
cpu: Fail when CPU type cannot be detected from XML

When autodetecting whether XML describes guest or host CPU, the presence
of <arch> element is checked. If it's present, we treat the XML as host
CPU definition. Which is right, since guest CPU definitions do not
contain <arch> element. However, if at the same time the root <cpu>
element contains `match' attribute, we would silently ignore it and
still treat the XML as host CPU. We should rather refuse such invalid
XML.

14 years agocpuCompare: Fix comparison of two host CPUs
Jiri Denemark [Mon, 12 Jul 2010 12:41:36 +0000 (14:41 +0200)]
cpuCompare: Fix comparison of two host CPUs

When a CPU to be compared with host CPU describes a host CPU instead of
a guest CPU, the result is incorrect. This is because instead of
treating additional features in host CPU description as required, they
were treated as if they were mentioned with all possible policies at the
same time.

14 years agoqemu: Use -nodefconfig when probing for CPU models
Jiri Denemark [Mon, 12 Jul 2010 07:58:43 +0000 (09:58 +0200)]
qemu: Use -nodefconfig when probing for CPU models

In case qemu supports -nodefconfig, libvirt adds uses it when launching
new guests. Since this option may affect CPU models supported by qemu,
we need to use it when probing for available models.

14 years agovirsh: Fix man page syntax
Jiri Denemark [Fri, 18 Jun 2010 16:17:59 +0000 (18:17 +0200)]
virsh: Fix man page syntax

pod2man prints the following warning when generating virsh.1:

    tools/virsh.pod:890: Unmatched =back

14 years agoFix potential crash in QEMU monitor JSON impl
Daniel P. Berrange [Mon, 12 Jul 2010 13:07:02 +0000 (14:07 +0100)]
Fix potential crash in QEMU monitor JSON impl

An indentation mistake meant that a check for return status
was not properly performed in all cases. This could result
in a crash on NULL pointer in a following line.

* src/qemu/qemu_monitor_json.c: Fix check for return status
  when processing JSON for blockstats

14 years agoFix build by removing unknown pod2man flag
Daniel P. Berrange [Mon, 12 Jul 2010 13:08:36 +0000 (14:08 +0100)]
Fix build by removing unknown pod2man flag

Some versions of pod2man do not support the -u flag, so this
can't be used

* daemon/Makefile.am: Remove -u flag from pod2man

14 years agoEnsure we return the callback ID in python events binding
Daniel P. Berrange [Thu, 8 Jul 2010 10:30:47 +0000 (11:30 +0100)]
Ensure we return the callback ID in python events binding

A missing return statement in the python binding meant that
the callers could not get the callback ID, and thus not be
able to unregister event callbacks

* python/libvirt-override-virConnect.py: Add missing return
  statement

14 years agohtml docs: added firewall explanation page by daniel berrange
Justin Clift [Sat, 10 Jul 2010 12:47:00 +0000 (22:47 +1000)]
html docs: added firewall explanation page by daniel berrange

14 years agolibvirtd: add man page for libvirtd
Justin Clift [Fri, 9 Jul 2010 09:21:39 +0000 (19:21 +1000)]
libvirtd: add man page for libvirtd

With gracious thanks to Chris Lalancette for helping knock the
description section into shape.

This addresses BZ #595350

  https://bugzilla.redhat.com/show_bug.cgi?id=595350

14 years agovirsh: add new --details option to vol-list
Justin Clift [Mon, 5 Jul 2010 13:46:54 +0000 (23:46 +1000)]
virsh: add new --details option to vol-list

This patch adds a new --details option to the virsh vol-list
command, making its output more useful when many luns are
present.

Addresses BZ # 605543

  https://bugzilla.redhat.com/show_bug.cgi?id=605543

14 years agoauthors: update my authors details
Justin Clift [Fri, 9 Jul 2010 09:35:39 +0000 (19:35 +1000)]
authors: update my authors details

14 years agoFix a compile error in the previous commit.
Chris Lalancette [Thu, 8 Jul 2010 12:49:01 +0000 (08:49 -0400)]
Fix a compile error in the previous commit.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoImplement virsh managedsave-remove command.
Chris Lalancette [Tue, 22 Jun 2010 13:50:17 +0000 (09:50 -0400)]
Implement virsh managedsave-remove command.

Signed-off-by: Chris Lalancette <clalance@redhat.com>