]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
15 years agoFix up virNodeGetCellsFreeMemory
Chris Lalancette [Fri, 21 Aug 2009 12:16:13 +0000 (14:16 +0200)]
Fix up virNodeGetCellsFreeMemory

The documentation for virNodeGetCellsFreeMemory claims the values
returned are in kilobytes, but that's actually wrong; the value
returned is actually in bytes.  Fix up the documentation to be
correct.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix sexpr2string() to handle empty list.
Jim Fehlig [Tue, 25 Aug 2009 21:54:18 +0000 (15:54 -0600)]
Fix sexpr2string() to handle empty list.

S-expression containing empty lists, e.g. (cpus (() () () ())),
was not being handled properly in sexpr2string() serialization.
Emit an empty list when encountering NIL sexpr kind.

15 years agoFix driver entry table for UML numa APIs
Daniel P. Berrange [Thu, 27 Aug 2009 18:13:11 +0000 (19:13 +0100)]
Fix driver entry table for UML numa APIs

* src/uml_driver.c: Fix numa API driver entries to avoid
  infinite loop

15 years agoFix crash in virsh vol-key command
Pritesh Kothari [Thu, 27 Aug 2009 17:47:41 +0000 (18:47 +0100)]
Fix crash in virsh vol-key command

* src/virsh.c: Pass in pool object to avoid crash in key lookup

15 years agoRefactor policycode auth code to avoid compiler warnings
Daniel P. Berrange [Tue, 25 Aug 2009 16:18:27 +0000 (17:18 +0100)]
Refactor policycode auth code to avoid compiler warnings

* src/remote_internal.c: Split remoteAuthPolkit into separate
  impls for v0 and v1 to avoid compile warnings due to unused
  variables/params
* qemud/remote.c: Remove accidental tabs

15 years agoSupport new PolicyKit 1.0 API
Daniel P. Berrange [Thu, 6 Aug 2009 12:54:08 +0000 (13:54 +0100)]
Support new PolicyKit 1.0 API

* configure.in: Check for pkcheck which indicates new policykit
* qemud/Makefile.am: Install different versions of policy
* qemud/libvirtd.policy: Rename to libvirtd.policy-0
* qemud/libvirtd.policy-1: new style policy
* qemud/qemud.c, qemud/qemud.h, qemud/remote.c: Support new
  policykit API via external pkcheck helper
* src/remote_internal.c: Don't prompt for polkit auth with new
  policykit API
* libvirt.spec.in: deal with new policy install locations & deps

15 years ago517157 fix selinux problem with images on NFS
Darryl L. Pierce [Fri, 21 Aug 2009 14:57:29 +0000 (16:57 +0200)]
517157 fix selinux problem with images on NFS

* src/security_selinux.c: ignores EOPNOTSUPP when attempting to access an
  NFS share

15 years agospec file: add URL to Source tag
Mark McLoughlin [Fri, 21 Aug 2009 10:10:37 +0000 (11:10 +0100)]
spec file: add URL to Source tag

See https://fedoraproject.org/wiki/Packaging:SourceURL

15 years agoFix phypOpen() escape_specialcharacters
Mattias Bolte [Thu, 20 Aug 2009 11:59:07 +0000 (13:59 +0200)]
Fix phypOpen() escape_specialcharacters

Matthias correctly points out that escape_specialcharaters() takes a
length, and since we are now malloc()'ing string in phypOpen instead of
making it a static array, we can't use sizeof(string) anymore.  Calculate
the proper strlen and then use that both to allocate the string and also
pass it to escape_specialcharacters().

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoPower Hypervisor: fix potential segfault
Mattias Bolte [Thu, 20 Aug 2009 10:32:19 +0000 (12:32 +0200)]
Power Hypervisor: fix potential segfault

I came across this line in the phypOpen function:

char string[strlen(conn->uri->path)];

Here the path part of the given URI is used without checking it for
NULL, this can cause a segfault as strlen expects a string != NULL.
Beside that uuid_db and connection_data leak in case of an error.

In this line

conn->uri->path = string;

the original path of the URI leaks. The patch adds a VIR_FREE call
before setting the new path.

The attached patch is compile-tested but I don't have a Power
Hypervisor installation at hand to test it for real.

Matthias

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoSmall fixes for qemu save compression.
Chris Lalancette [Mon, 17 Aug 2009 10:34:53 +0000 (12:34 +0200)]
Small fixes for qemu save compression.

Fix up a small memory leak pointed out by DanB; I was forgetting
to release memory allocated to driver->saveImageFormat.
Also add the "save_image_format" and "security" entries to
the augeas lens.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoAdd test for recently fixed crash with latest XenD
Daniel P. Berrange [Tue, 18 Aug 2009 21:10:41 +0000 (22:10 +0100)]
Add test for recently fixed crash with latest XenD

Test case for the fix applied in

  commit 14435163a086c0bcdff04308077fa46a5fa08bb0
  Author: Daniel Veillard <veillard@redhat.com>
  Date:   Fri Jun 26 18:14:16 2009 +0000

* tests/sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.sexpr,
  tests/sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml: Data
  files exhibiting the crash
* tests/sexpr2xmltest.c: Process new data files

15 years agoFix some typos & remove unhelpful acronyms in QEMU docs
Daniel P. Berrange [Wed, 19 Aug 2009 16:02:45 +0000 (17:02 +0100)]
Fix some typos & remove unhelpful acronyms in QEMU docs

15 years agoAdd documentation about the QEMU driver security features
Daniel P. Berrange [Wed, 19 Aug 2009 13:17:17 +0000 (14:17 +0100)]
Add documentation about the QEMU driver security features

* docs/drvqemu.html.in: Document DAC usage, SELinux integration,
  Linux capabilities, and Cgroups device ACLs

15 years agoFix bridge/tap system error reporting
Mark McLoughlin [Tue, 18 Aug 2009 13:15:58 +0000 (14:15 +0100)]
Fix bridge/tap system error reporting

* src/qemu_conf.c, src/uml_conf.c: use virReportSystemError() to report
  system errors

15 years agoDon't expose 'vnet%d' to the user
Mark McLoughlin [Tue, 18 Aug 2009 12:32:42 +0000 (13:32 +0100)]
Don't expose 'vnet%d' to the user

https://bugzilla.redhat.com/517371

Matt Booth points out that if you use a non-existent bridge name when
start a guest you get a weird error message:

  Failed to add tap interface 'vnet%d' to bridge 'virbr0'

and dev='vnet%d' appears in the dumpxml output.

Fix that by not including 'vnet%d' in the error message and freeing the
'vnet%d' string if adding the tap device to the bridge fails.

* src/qemu_conf.c, src/uml_conf.c: fix qemudNetworkIfaceConnect()
  and umlConnectTapDevice() to not expose 'vnet%d' to the user

15 years agoMaintain a list of active PCI hostdevs and use it in pciResetDevice()
Mark McLoughlin [Mon, 17 Aug 2009 14:05:23 +0000 (15:05 +0100)]
Maintain a list of active PCI hostdevs and use it in pciResetDevice()

As we start/shutdown guests, or hotplug/hot-unplug devices, we can add
or delete devices as appropriate from a list of active devices.

Then, in pciReset(), we can use this to determine whether its safe to
reset a device as a side effect of resetting another device.

* src/qemu_conf.h: add activePciHostdevs to qemud_driver

* src/qemu_driver.c: maintain the activePciHostdevs list, and pass it
  to pciResetDevice()

* src/pci.[ch]: pass the activeDevs list to pciResetDevice() and use
  it to determine whether a Secondary Bus Reset is safe

15 years agoSimplify PCI hostdev prepare/re-attach using a pciDeviceList type
Mark McLoughlin [Mon, 17 Aug 2009 14:05:23 +0000 (15:05 +0100)]
Simplify PCI hostdev prepare/re-attach using a pciDeviceList type

The qemuPrepareHostDevices() and qemuDomainReAttachHostDevices()
functions are clutter with a bunch of calls to pciGetDevice() and
pciFreeDevice() obscuring the basic logic.

Add a pciDeviceList type and add a qemuGetPciHostDeviceList() function
to build a list from a domain definition. Use this in prepare/re-attach
fto simplify things and eliminate the multiple pciGetDevice calls.

This is especially useful because in the next patch we need to iterate
the hostdevs list a third time and we also need a list type for keeping
track of active devices.

* src/pci.[ch]: add pciDeviceList type and also a per-device 'managed'
  property

* src/libvirt_private.syms: export the new functions

* src/qemu_driver.c: add qemuGetPciHostDeviceList() and re-write
  qemuPrepareHostDevices() and qemuDomainReAttachHostDevices() to use it

15 years agoUse pci_addr=auto with QEMU's pci_add monitor command
Mark McLoughlin [Mon, 17 Aug 2009 14:05:23 +0000 (15:05 +0100)]
Use pci_addr=auto with QEMU's pci_add monitor command

Newer versions of QEMU accept 'pci_add auto', but older versions require
'pci_add pci_addr=auto'

* src/qemu_driver.c: use pci_addr= in qemudDomainAttachHostPciDevice()
  for older versions of QEMU

15 years agoFix thinko in PCI hostdev detach
Mark McLoughlin [Mon, 17 Aug 2009 14:05:23 +0000 (15:05 +0100)]
Fix thinko in PCI hostdev detach

* src/qemu_driver.c: Add missing break statement in
  qemudDomainDetachHostDevice()

15 years agoReset PCI host devices after hot-unplug
Mark McLoughlin [Mon, 17 Aug 2009 14:05:23 +0000 (15:05 +0100)]
Reset PCI host devices after hot-unplug

When we hot-unplug a PCI host device from a guest, we should reset it.

Both managed and unmanaged devices should be reset, but only managed
devices should be re-attached.

* src/qemu_driver.c: reset devices in qemudDomainDetachHostPciDevice()

15 years agoReset unmanaged PCI host devices before hotplug
Mark McLoughlin [Mon, 17 Aug 2009 14:05:23 +0000 (15:05 +0100)]
Reset unmanaged PCI host devices before hotplug

Right now we're only resetting managed devices before hotplug, but we
should reset them irrespective of whether they are managed.

* src/qemu_driver.c: reset all PCI hostdevs before hotplug

15 years agoRevert changes to allow pciResetDevice() reset multiple devices
Mark McLoughlin [Mon, 17 Aug 2009 14:05:22 +0000 (15:05 +0100)]
Revert changes to allow pciResetDevice() reset multiple devices

It turns out that the previous attempt at this doesn't work well
in the case of hotplug. We need qemuCheckPciHostDevice() to
disallow the reset affecting devices already attach to the guest,
but we still need to avoid double locking the virDomainObjPtr.

This is all getting messy, I've a better idea.

This reverts commit 6318808270dd7679cd5dc082dcf2c7d85a432bd6 and
c106c8a18c63d9e4f2547724a4a563706f8f6778.

* src/qemu_driver.c, src/pci.[ch], src/xen_unified.c,
  src/libvirt_private.syms: revert a bunch of stuff.

15 years agoFix list updating after disk/network/hostdev hot-unplug
Mark McLoughlin [Mon, 17 Aug 2009 14:05:22 +0000 (15:05 +0100)]
Fix list updating after disk/network/hostdev hot-unplug

The current code makes a poor effort at updating the device arrays after
hot-unplug. Fix that and combine the two code paths into one.

* src/qemu_driver.c: fix list updating in qemudDomainDetachNetDevice(),
  qemudDomainDetachPciDiskDevice() and qemudDomainDetachHostPciDevice()

15 years agoRe-name remote_internal.c:driver to remote_driver
Mark McLoughlin [Mon, 17 Aug 2009 14:05:22 +0000 (15:05 +0100)]
Re-name remote_internal.c:driver to remote_driver

Confused me when poking at another 'driver' variable in gdb which gcc
had optimized away

* src/remote_internal.c: rename driver to remote_driver

15 years agoCosmetic change to 'virsh nodedev-list --tree' output
Mark McLoughlin [Mon, 17 Aug 2009 14:05:22 +0000 (15:05 +0100)]
Cosmetic change to 'virsh nodedev-list --tree' output

Maybe it's just me, but I try to select an item from the tree using
double-click and get annoyed when "+-" gets included in the selection.

* src/virsh.c: add a space between "+-" and the node device name
  in 'virsh nodedev-list --tree'

15 years agoFix up connection reference counting.
Chris Lalancette [Tue, 11 Aug 2009 13:48:59 +0000 (15:48 +0200)]
Fix up connection reference counting.

Currently the reference counting for connections is busted.  I
first noticed it while trying to use virConnectRef; it would
eventually cause a crash in the remote_internal driver, although
that was really just a victim.  Really, we should only call the
close callbacks on the methods when the references drop to 0.  To
accomplish this, move all of the close callbacks into
virUnrefConnect (since there are lots of internal users of that
function), and arrange for virConnectClose to call that.

V2: Make sure to drop the connection lock before we call the close
    callbacks, otherwise we could deadlock the daemon
V3: Fix up a crash when we got an error from one of the drivers

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix LXC driver crash when kernel doesn't support clone
Daniel P. Berrange [Wed, 12 Aug 2009 10:07:41 +0000 (11:07 +0100)]
Fix LXC driver crash when kernel doesn't support clone

* src/domain_conf.c: Make virDomainObjListFree a no-op if list
  is NULL
* src/domain_event.c: make virDomainEventCallbackListFree a no-op
  if event list is NULL
* src/lxc_driver.c: Log a message if LXC driver does not startup
  due to lacking kernel support

15 years agoCompressed save image format for Qemu.
Chris Lalancette [Fri, 7 Aug 2009 11:34:05 +0000 (13:34 +0200)]
Compressed save image format for Qemu.

Implement a compressed save image format for qemu.  While ideally
we would have the choice between compressed/non-compressed
available to the libvirt API, unfortunately there is no "flags"
parameter to the virDomainSave() API.  Therefore, implement this
as a qemu.conf option.  gzip, bzip2, and lzma are implemented, and
it should be very easy to implement additional compression
methods.

One open question is if/how we should detect the compression
binaries.  One way to do it is to do compile-time setting of the
paths (via configure.in), but that doesn't seem like a great thing
to do.  My preferred solution is not to detect at all;
when we go to run the commands that need them, if they
aren't available, or aren't available in one of the standard paths,
then we'll fail.  That's also the solution implemented in this patch.

In the future, we'll have a more robust (managed) save/restore API,
at which time we can expose this functionality properly in the API.

V2: get rid of redundant dd command and just use >> to append data.
V3: Add back the missing pieces for the enum and bumping the save version.
V4: Make the compressed field in the save_header an int.
    Implement LZMA compression.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoRemove 'the the' typo in docs
Daniel P. Berrange [Fri, 14 Aug 2009 11:00:50 +0000 (12:00 +0100)]
Remove 'the the' typo in docs

15 years agoCheck active domain hostdevs before allowing PCI reset
Mark McLoughlin [Fri, 14 Aug 2009 07:31:11 +0000 (08:31 +0100)]
Check active domain hostdevs before allowing PCI reset

If a PCI device reset causes other devices to be reset, allow it so long
as those other devices are note assigned to another active domain.

Note, we need to take the driver lock qemudNodeDeviceReset() because the
check function will iterate over the domain list.

* src/qemu_conf.c: add qemuCheckPciHostDevice() to iterate over active
  domains checking whether the affected device is assigned

* src/pci.[ch]: add pciDeviceEquals() helper

15 years agoAllow pciResetDevice() to reset multiple devices
Mark McLoughlin [Fri, 14 Aug 2009 07:31:11 +0000 (08:31 +0100)]
Allow pciResetDevice() to reset multiple devices

When using a Secondary Bus Reset, all devices on the bus are reset.

Extend the pciResetDevice() API so that a 'check' callback can be
supplied which will verify that it is safe to reset the other devices
on the bus.

The virDomainObjPtr parameter is needed so that when the check function
iterates over the domain list, it can avoid double locking.

* src/pci.[ch]: add a 'check' callback to pciResetDevice(), re-work
  pciIterDevices() to pass the check function to the iter functions,
  use the check function in the bus iterator, return the first unsafe
  device from pciBusCheckOtherDevices() and include its details in
  the bus reset error message.

* src/qemu_driver.c, src/xen_uninified.c: just pass NULL as the
  check function for now

15 years agoImprove PCI host device reset error message
Mark McLoughlin [Fri, 14 Aug 2009 07:31:11 +0000 (08:31 +0100)]
Improve PCI host device reset error message

Currently, if we are unable to reset a PCI device we return a fairly
generic 'No PCI reset capability available' error message.

Fix that by returning an error from the individual reset messages and
using that error to construct the higher level error mesage.

* src/pci.c: set errors in pciTryPowerManagementReset() and
  pciTrySecondaryBusReset() on failure; use those error messages
  in pciResetDevice(), or explain that no reset support is available

15 years agoReset and re-attach PCI host devices on guest shutdown
Mark McLoughlin [Fri, 14 Aug 2009 07:31:11 +0000 (08:31 +0100)]
Reset and re-attach PCI host devices on guest shutdown

When the guest shuts down, we should attempt to restore all PCI host
devices to a sane state.

In the case of managed hostdevs, we should reset and re-attach the
devices. In the case of unmanaged hostdevs, we should just reset them.

Note, KVM will already reset assigned devices when the guest shuts
down using whatever means it can, so we are only doing it to cover the
cases the kernel can't handle.

* src/qemu_driver.c: add qemuDomainReAttachHostDevices() and call
  it from qemudShutdownVMDaemon()

15 years agoAllow PM reset on multi-function PCI devices
Mark McLoughlin [Fri, 14 Aug 2009 07:31:11 +0000 (08:31 +0100)]
Allow PM reset on multi-function PCI devices

It turns out that a PCI Power Management reset only affects individual
functions, and not the whole device.

The PCI Power Management spec talks about resetting the 'device' rather
than the 'function', but Intel's Dexuan Cui informs me that it is
actually a per-function reset.

Also, Yu Zhao has added pci_pm_reset() to the kernel, and it doesn't
reject multi-function devices, so it must be true! :-)

(A side issue is that we could defer the PM reset to the kernel if we
could detect that the kernel has PM reset support, but barring version
number checks we don't have a way to detect that support)

* src/pci.c: remove the pciDeviceContainsOtherFunctions() check from
  pciTryPowerManagementReset() and prefer PM reset over bus reset
  where both are available

Cc: Cui, Dexuan <dexuan.cui@intel.com>
Cc: Yu Zhao <yu.zhao@intel.com>
15 years agoDetect KVM's PCI device assignment support
Mark McLoughlin [Fri, 14 Aug 2009 07:31:11 +0000 (08:31 +0100)]
Detect KVM's PCI device assignment support

PCI device assignment is only supported in KVM's fork of qemu, so we
should really detect its availability and give a nice error if its
not supported.

* src/qemu_conf.[ch]: introduce QEMUD_CMD_FLAG_PCIDEVICE indicating
  that the -pcidevice command line option is available

* tests/*: update the tests

15 years agoAdd host PCI device hotplug support
Mark McLoughlin [Fri, 14 Aug 2009 07:31:10 +0000 (08:31 +0100)]
Add host PCI device hotplug support

Attaching a host PCI device to a qemu guest is done with a
straightforward 'pci_add auto host host=XX:XX.X' command.

Like with NIC and disk hotplug, we need to retain the guest PCI address
assigned by qemu so that we can use it for hot-unplug.

Identifying a device for detach is done using the host PCI address.

Managed mode is handled by detaching/resetting the device before
attaching it to the guest and re-attaching it after detaching it from
the guest.

* src/qemu_driver.c: add qemudDomainAttachHostPciDevice() and
  qemudDomainDetachHostPciDevice()

* src/domain_conf.h: add somewhere to store the guest PCI address

* src/domain_conf.c: handle formatting and parsing the guest PCI
  address

15 years agoRe-factor hostdev hotplug
Mark McLoughlin [Fri, 14 Aug 2009 07:31:10 +0000 (08:31 +0100)]
Re-factor hostdev hotplug

Re-factor the hostdev hotplug code so that we can easily add PCI
hostdev hotplug to qemudDomainAttachHostDevice().

* src/qemu_driver.c: rename qemudDomainAttachHostDevice() to
  qemudDomainAttachHostUsbDevice(); make qemudDomainAttachHostDevice()
  handle all hostdev types

* src/libvirt_private.syms: export a couple of hostdev related
  ToString() functions

15 years agoMake LXC / UML drivers robust against NUMA topology brokenness
Daniel P. Berrange [Thu, 13 Aug 2009 10:56:31 +0000 (11:56 +0100)]
Make LXC / UML drivers robust against NUMA topology brokenness

Some kernel versions expose broken NUMA topology for some machines.
This causes the LXC/UML drivers to fail to start. QEMU driver was
already fixed for this problem

* src/lxc_conf.c: Log and ignore failure to populate NUMA info
* src/uml_conf.c: Log and ignore failure to populate NUMA info
* src/capabilities.c: Reset nnumaCell to 0 after freeing

15 years agoFix some URLs in virsh manpage
Mark McLoughlin [Tue, 11 Aug 2009 14:37:33 +0000 (15:37 +0100)]
Fix some URLs in virsh manpage

* docs/virsh.pod: don't reference format.html anymore, reference
  the formatdomain.html etc. pages

* virsh.1: re-generate

15 years agoRemove a duplicated assignment in Xen PCI parsing.
Chris Lalancette [Mon, 3 Aug 2009 11:57:37 +0000 (13:57 +0200)]
Remove a duplicated assignment in Xen PCI parsing.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix up a few minor indentation issues.
Chris Lalancette [Mon, 3 Aug 2009 11:57:23 +0000 (13:57 +0200)]
Fix up a few minor indentation issues.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix phyp escape_specialcharacters.
Chris Lalancette [Mon, 3 Aug 2009 11:53:26 +0000 (13:53 +0200)]
Fix phyp escape_specialcharacters.

A couple of minor fixes to phyp escape_specialcharacters.  Make it
a static function (since it's only used in phyp/phyp_driver.c), and
make it take a dstlen parameter.  This paves the way for removing
strncpy in the future.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoMake openvzGetVPSUUID take a len.
Chris Lalancette [Mon, 3 Aug 2009 11:50:27 +0000 (13:50 +0200)]
Make openvzGetVPSUUID take a len.

Minor fix to openvzGetVPSUUID to make it take a length parameter.
This ensures that it doesn't make assumptions about the length
of the UUID buffer, and paves the way for removal of strncpy in
the future.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoMinor cleanup of error path for c_oneVmInfo.
Chris Lalancette [Mon, 3 Aug 2009 11:48:16 +0000 (13:48 +0200)]
Minor cleanup of error path for c_oneVmInfo.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix up a whitespace in comments in src/console.c
Chris Lalancette [Fri, 7 Aug 2009 08:56:38 +0000 (10:56 +0200)]
Fix up a whitespace in comments in src/console.c

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix up a stray whitespace in virHashGrow.
Chris Lalancette [Wed, 5 Aug 2009 11:46:43 +0000 (13:46 +0200)]
Fix up a stray whitespace in virHashGrow.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoRun 'cont' on successful migration finish.
Chris Lalancette [Wed, 5 Aug 2009 11:42:07 +0000 (13:42 +0200)]
Run 'cont' on successful migration finish.

As of qemu 0.10.6, qemu now honors the -S flag on incoming migration.
That means that when the migration completes, we have to issue a
'cont' command to get the VM running again.  We do it unconditionally
since it won't hurt on older qemu.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoSplit virDomainMigrate into functions.
Chris Lalancette [Thu, 30 Jul 2009 14:52:02 +0000 (16:52 +0200)]
Split virDomainMigrate into functions.

Re-factor virDomainMigrate to split out the version 1 and version 2
protocols into their own functions.  In reality, the two versions share
very little in common, so forcing them together in the same function was
just confusing.  This will also make adding tunnelled migration easier.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix QEMU domain status after restore.
Chris Lalancette [Fri, 7 Aug 2009 13:20:30 +0000 (15:20 +0200)]
Fix QEMU domain status after restore.

When doing a restore, we were forgetting to update the state file
for the VM.  That means that if you do a save/restore, then shut
down libvirtd, then start it back up, you'll see the state of the
guest as "paused", even though it is really running.  We were
just forgetting a "virDomainSaveStatus" call in the restor path.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoHandle kernels with no ipv6 support
Mark McLoughlin [Mon, 10 Aug 2009 10:16:37 +0000 (11:16 +0100)]
Handle kernels with no ipv6 support

If the ipv6 kernel module is not loaded, then we get this when starting
a virtual network:

  libvir: Network Config error :
  cannot enable /proc/sys/net/ipv6/conf/virbr0/disable_ipv6:
  No such file or directory

If disable_ipv6 is not present, we should just merrily continue on our
way.

* src/network_driver.c: make networkDisableIPV6() not fail if the kernel
  has no ipv6 support

15 years agoSet perms on /var/lib/libvirt/boot to 0711
Mark McLoughlin [Thu, 6 Aug 2009 14:20:36 +0000 (15:20 +0100)]
Set perms on /var/lib/libvirt/boot to 0711

Allow qemu user to open kernel/initrds in this dir, but still prevent
others from listing it.

* libvirt.spec.in: set /var/lib/libvirt/boot perms to 0711

15 years agochown kernel/initrd before spawning qemu
Mark McLoughlin [Thu, 6 Aug 2009 14:14:19 +0000 (15:14 +0100)]
chown kernel/initrd before spawning qemu

If we're running qemu unprivileged, we need to chown any supplied kernel
or initrd before spawning it.

* src/qemu_driver.c: rename qemuDomainSetDiskOwnership() to
  qemuDomainSetFileOwnership(), pass it a path string instead of a disk
  definition and use it for chowning the kernel/initrd in
  qemuDomainSetAllDeviceOwnership()

15 years agoAdd link to AbiCloud web management system
Daniel P. Berrange [Fri, 7 Aug 2009 13:12:22 +0000 (14:12 +0100)]
Add link to AbiCloud web management system

15 years agoRemove unsafe strncpy from esx_vmx.c
Chris Lalancette [Mon, 3 Aug 2009 11:39:07 +0000 (13:39 +0200)]
Remove unsafe strncpy from esx_vmx.c

While trying to remove uses of unsafe strncpy in the tree, I came
across a couple of usages in the ESX driver.  To my eyes, the snprintf
replacements do the same thing in less code, and are also safer.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
Tested-by: Mattias Bolte <matthias.bolte@googlemail.com>
15 years agoUpdate logging documentation
Amy Griffis [Thu, 6 Aug 2009 13:58:38 +0000 (15:58 +0200)]
Update logging documentation

* docs/logging.html[.in] try to include a little more description about
  the corner cases, things someone might get hung up on on.

15 years agoConsolidate code for parsing the logging env
Amy Griffis [Thu, 6 Aug 2009 13:55:07 +0000 (15:55 +0200)]
Consolidate code for parsing the logging env

* src/logging.c src/logging.h src/libvirt_private.syms:
  define new functions virLogSetFromEnv and virLogParseDefaultPriority
* qemud/qemud.c src/libvirt.c tests/eventtest.c: cleanup to use the
  unified functions

15 years agoCleanup VIR_LOG_DEBUG parsing in eventtest
Amy Griffis [Thu, 6 Aug 2009 13:50:40 +0000 (15:50 +0200)]
Cleanup VIR_LOG_DEBUG parsing in eventtest

* tests/eventtest.c: don't covert high priority levels to debug level.
  Consider an invalid priority level setting a setup failure.

15 years agoSeveral fixes to libvirtd's log setup
Amy Griffis [Thu, 6 Aug 2009 13:45:50 +0000 (15:45 +0200)]
Several fixes to libvirtd's log setup

* qemud/qemud.c src/logging.[ch]: Similar as for general libvirt, don't
  convert high priority levels to debug level. Ignore LIBVIRT_LOG_FILTERS
  and LIBVIRT_LOG_OUTPUTS when they're set to the empty string, otherwise
  they can override a valid setting from the config file. Send all
  settings through the parser functions for validation, so that the
  existence of a bad setting doesn't nullify a good setting that should
  have applied -- particularly the default output. Keep the order of
  precedence consistent for all variables between the environment and
  the config file.  Warn when an invalid log level, filter, or output
  is ignored.
* src/libvirt_private.syms: export internally a few convenience functions

15 years agoTighten libvirt's parsing of logging env
Amy Griffis [Thu, 6 Aug 2009 13:38:11 +0000 (15:38 +0200)]
Tighten libvirt's parsing of logging env

* src/libvirt.c src/logging.c: Don't convert high priority levels to the
  debug level. Don't parse LIBVIRT_LOG_FILTERS and LIBVIRT_LOG_OUTPUTS
  when they're set to the empty string. Warn when the user specifies an
  invalid value (empty string remains a noop).
* po/POTFILES.in: src/logging.c now include translatable strings

15 years agoCleanup structure name naming
Matthias Bolte [Thu, 6 Aug 2009 13:15:45 +0000 (15:15 +0200)]
Cleanup structure name naming

* src/esx/esx_driver.c src/esx/esx_util.[ch] src/esx/esx_vi.[ch]:
  just a name change

15 years agoFix memleak if esxOpen fails
Matthias Bolte [Thu, 6 Aug 2009 13:09:40 +0000 (15:09 +0200)]
Fix memleak if esxOpen fails

* src/esx/esx_driver.c: if esxOpen failed, priv->transport wasn't freed

15 years agoAdd proper OOM reporting for esxDomainGetOSType
Matthias Bolte [Thu, 6 Aug 2009 13:07:46 +0000 (15:07 +0200)]
Add proper OOM reporting for esxDomainGetOSType

* src/esx/esx_driver.c: catch an unchecked strdup in
  esxDomainGetOSType()

15 years agoRelease of libvirt-0.7.0
Daniel Veillard [Wed, 5 Aug 2009 14:00:41 +0000 (16:00 +0200)]
Release of libvirt-0.7.0

* configure.in NEWS docs/* libvirt.spec.in include/libvirt/libvirt.h:
  Release of 0.7.0
* po/*.po*: updated and regenerated the localization pool

15 years agoAdd an allocation unit when calling qemu-img
Ryota Ozaki [Wed, 5 Aug 2009 12:35:17 +0000 (14:35 +0200)]
Add an allocation unit when calling qemu-img

* src/storage_backend.c: as the absence of units can be interpreted
  in diverging ways depending on the version

15 years agoAdd uniqness checking for LXC define/create methods
Daniel P. Berrange [Fri, 31 Jul 2009 14:25:03 +0000 (15:25 +0100)]
Add uniqness checking for LXC define/create methods

* src/lxc_driver.c: Check for name & UUID uniqueness when
  defining or creating domains

15 years agoFix removal of transient VMs when LXC aborts
Daniel P. Berrange [Fri, 31 Jul 2009 13:38:46 +0000 (14:38 +0100)]
Fix removal of transient VMs when LXC aborts

* src/lxc_driver.c: Remove transient VM after monitor triggered
  shutdown

15 years agoDon't try to activate cgroups if not present for LXC
Daniel P. Berrange [Fri, 31 Jul 2009 13:37:25 +0000 (14:37 +0100)]
Don't try to activate cgroups if not present for LXC

* src/lxc_controller.c: Don't throw error in LXC startup if
  the cgroups driver mount isn't available. Improve error
  logging for resource setup

15 years agoFix configure checks from previous commits
Daniel P. Berrange [Wed, 5 Aug 2009 10:59:58 +0000 (11:59 +0100)]
Fix configure checks from previous commits

* configure.in: Don't set AM_CONDITIIONAL until *after* making
  the checks

15 years agoAvoid a warning if compiling without inotify
Daniel P. Berrange [Wed, 5 Aug 2009 10:04:26 +0000 (12:04 +0200)]
Avoid a warning if compiling without inotify

* src/xm_internal.c: split the implementations of xenInotifyActive()

15 years agoTypo and comment fixes
Aron Griffis [Wed, 5 Aug 2009 09:56:56 +0000 (11:56 +0200)]
Typo and comment fixes

* docs/schemas/*.rng: the comments were wrong
* src/qemu_conf.c: typo in an error message

15 years agoRefresh /etc/xen if inotify wasn't
Cole Robinson [Wed, 5 Aug 2009 09:46:33 +0000 (11:46 +0200)]
Refresh /etc/xen if inotify wasn't

* src/xm_internal.c: in case of multiple connections to the xen driver
  and some clients were not using domain events, the whole /etc/xen
  monitoring would break leading to disapearing domains.

15 years agoDon't loose id on xen domain redefine
Cole Robinson [Wed, 5 Aug 2009 09:39:31 +0000 (11:39 +0200)]
Don't loose id on xen domain redefine

* src/xm_internal.c: bug when redefining a domain, if it was running
  we would loose its id

15 years agoRemove a stray semicolon
Daniel Veillard [Wed, 5 Aug 2009 09:24:23 +0000 (11:24 +0200)]
Remove a stray semicolon

* src/xend_internal.c: extraneous ; in xenDaemonParseSxprGraphicsNew

15 years agoWorkaround for broken GCC in Debian Etch
Maximilian Wilhelm [Wed, 5 Aug 2009 09:19:34 +0000 (11:19 +0200)]
Workaround for broken GCC in Debian Etch

* src/storage_conf.c src/internal.h: move previous check in internal.h
  and add a workaround for a GCC bug in Debian Etch on limit definitions

15 years agoXen Inotify support needs sys/inotify.h
Maximilian Wilhelm [Wed, 5 Aug 2009 08:57:40 +0000 (10:57 +0200)]
Xen Inotify support needs sys/inotify.h

* configure.in: to activate Xen Inotify checking we need to check for
  sys/inotify.h availability

15 years agoLXC driver requires sched.h and unshare()
Maximilian Wilhelm [Wed, 5 Aug 2009 08:52:14 +0000 (10:52 +0200)]
LXC driver requires sched.h and unshare()

* configure.in: make it check by default for both

15 years agoConfigure UML support only if sys/inotify.h present
Maximilian Wilhelm [Wed, 5 Aug 2009 08:47:18 +0000 (10:47 +0200)]
Configure UML support only if sys/inotify.h present

* configure.in: UML support requires sys/inotify.h so make it check
  by default.

15 years agoFix libcurl automatic check and ESX status
Maximilian Wilhelm [Wed, 5 Aug 2009 08:43:37 +0000 (10:43 +0200)]
Fix libcurl automatic check and ESX status

* configure.in: if libcurl is not present ESX should be desactivated
  so default to check for esx

15 years agoExtend the ESX URL to habdle ports and GSX
Matthias Bolte [Wed, 5 Aug 2009 08:23:59 +0000 (10:23 +0200)]
Extend the ESX URL to habdle ports and GSX

* src/esx/esx_driver.c src/esx/esx_vi.[ch] src/esx/esx_vmx.[ch]:
  adds version checking for GSX 2.0, allows to pass a specific port
  for the connection and also add a new specific gsx scheme for
  easier connections to GSX hosts

15 years agoFix escaping of 8-bit high characters
Daniel P. Berrange [Tue, 4 Aug 2009 17:13:09 +0000 (18:13 +0100)]
Fix escaping of 8-bit high characters

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

* src/buf.c: Cast to 'unsigned char' before doing compare to
  avoid rejecting 8-bit high characters

15 years agoFix memory leak in openvz driver
Daniel P. Berrange [Mon, 3 Aug 2009 10:42:39 +0000 (11:42 +0100)]
Fix memory leak in openvz driver

* src/openvz_driver.c: Remove unneccessary strdup() on hypervisor
  type api call

15 years agoRemove ATTRIBUTE_UNUSED from flags to qemudDomainMigratePerform.
Chris Lalancette [Fri, 31 Jul 2009 07:29:09 +0000 (09:29 +0200)]
Remove ATTRIBUTE_UNUSED from flags to qemudDomainMigratePerform.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoAdd a comment about setting errors after qemudStartVMDaemon().
Chris Lalancette [Fri, 31 Jul 2009 07:03:55 +0000 (09:03 +0200)]
Add a comment about setting errors after qemudStartVMDaemon().

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix an erroneous debug error to KVM; it should read QEMU/KVM.
Chris Lalancette [Fri, 31 Jul 2009 06:59:02 +0000 (08:59 +0200)]
Fix an erroneous debug error to KVM; it should read QEMU/KVM.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoRemove a stray semicolon in qemudDomainMigratePrepare2.
Chris Lalancette [Fri, 31 Jul 2009 06:56:17 +0000 (08:56 +0200)]
Remove a stray semicolon in qemudDomainMigratePrepare2.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoConvert a few stray users of free() in libvirt.c to VIR_FREE().
Chris Lalancette [Thu, 30 Jul 2009 14:43:34 +0000 (16:43 +0200)]
Convert a few stray users of free() in libvirt.c to VIR_FREE().

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoUse virGetHostname instead of gethostname.
Chris Lalancette [Thu, 30 Jul 2009 14:41:12 +0000 (16:41 +0200)]
Use virGetHostname instead of gethostname.

Fix up qemudDomainMigratePrepare2 to use virGetHostname instead of
gethostname.  Besides the fact that virGetHostname is far more clever,
there was a latent bug in the handling that could cause a buffer overflow
on a very long hostname.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix up a minor indentation issue with virDomainMigratePrepare.
Chris Lalancette [Thu, 30 Jul 2009 14:32:44 +0000 (16:32 +0200)]
Fix up a minor indentation issue with virDomainMigratePrepare.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix virCapabilitiesDefaultGuestMachine documentation.
Chris Lalancette [Thu, 30 Jul 2009 14:31:41 +0000 (16:31 +0200)]
Fix virCapabilitiesDefaultGuestMachine documentation.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix up a silly typo in apibuild.py.
Chris Lalancette [Thu, 30 Jul 2009 14:30:50 +0000 (16:30 +0200)]
Fix up a silly typo in apibuild.py.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoProtected against potential crash scenarios
Daniel P. Berrange [Fri, 31 Jul 2009 15:55:49 +0000 (16:55 +0100)]
Protected against potential crash scenarios

* src/qemu_driver.c: Check that monitor device is not NULL
  before runing a command to protect against bugs in caller

15 years agoImprove diagnostics when pidfile writing fails
Daniel P. Berrange [Fri, 31 Jul 2009 14:51:27 +0000 (15:51 +0100)]
Improve diagnostics when pidfile writing fails

* src/util.c: Include path & pid when logging pidfile failure

15 years agoFix crash when attempting to shutdown inactive QEMU vm
Daniel P. Berrange [Fri, 31 Jul 2009 14:50:46 +0000 (15:50 +0100)]
Fix crash when attempting to shutdown inactive QEMU vm

* src/qemu_driver.c: Add check that QEMU is active before attemting
  to shutdown. Fix error code for check in destroy method

15 years agoEnable ESX driver build on Mingw32
Daniel P. Berrange [Thu, 30 Jul 2009 15:40:29 +0000 (16:40 +0100)]
Enable ESX driver build on Mingw32

* autobuild.sh, mingw32-libvirt.spec.in: Enable esx on mingw32
* src/esx/esx_driver.c: Define AI_ADDRCONFIG if not set
* src/esx/esx_util.c, src/esx/esx_vi_types.c: Always use
  %lld & friends, since gnulib guarentees we have these
  and not the target's own variants

15 years agoDisable IPv6 on virtual networks
Daniel P. Berrange [Thu, 30 Jul 2009 15:34:56 +0000 (16:34 +0100)]
Disable IPv6 on virtual networks

If the bridge device is configured to have IPv6 address and
accept router advertisments, then a malicious guest can send
out bogus advertisments and hijack/DOS host IPv6 connectivity

* src/network_driver.c: Set accept_ra=0, disable_ipv6=1, autoconf=0
  for IPv6 sysctl on virual network bridge devices

15 years agoFix PCIe FLR detection
Mark McLoughlin [Fri, 31 Jul 2009 14:35:53 +0000 (15:35 +0100)]
Fix PCIe FLR detection

PCIe DevCap register is actually 32 bits, not 16 bits. Since FLR is
bit 28, we clearly are failing to detect FLR support.

Known to fix device reset with some SR-IOV devices.

* src/pci.c: fix pciDetectFunctionLevelReset()

15 years agoSet perms on /var/lib/libvirt/images to 0711
Mark McLoughlin [Fri, 31 Jul 2009 08:49:08 +0000 (09:49 +0100)]
Set perms on /var/lib/libvirt/images to 0711

Allow qemu user to open images in this dir, but still prevent others
from listing it.

* libvirt.spec.in: set /var/lib/libvirt/images perms to 0711

15 years agoFix problem writing QEMU pidfile
Daniel P. Berrange [Thu, 30 Jul 2009 13:58:16 +0000 (14:58 +0100)]
Fix problem writing QEMU pidfile

* src/util.c: Don't drop capabilities until after the PID file has
  been written. Kill off child if writing the PID file fails
* src/qemu_driver.c: Remove bogus trailing '/' in state dir

15 years agoAllow dnsmasq to provide DNS without DHCP
Daniel P. Berrange [Thu, 30 Jul 2009 13:52:31 +0000 (14:52 +0100)]
Allow dnsmasq to provide DNS without DHCP

* src/network_driver.c: Always start dnsmasq to allow it to provide
  DNS, even if no DHCP ranges are enabled