Commit Graph

3745 Commits

Author SHA1 Message Date
Mark McLoughlin
ebea341856 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
2009-08-14 08:31:11 +01:00
Mark McLoughlin
4035152a87 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()
2009-08-14 08:31:11 +01:00
Mark McLoughlin
64a6682b93 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>
2009-08-14 08:31:11 +01:00
Mark McLoughlin
d4528d9ac2 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
2009-08-14 08:31:11 +01:00
Mark McLoughlin
0c5b7b93a3 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
2009-08-14 08:31:10 +01:00
Mark McLoughlin
7636ef4630 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
2009-08-14 08:31:10 +01:00
Daniel P. Berrange
19bac57b26 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
2009-08-13 12:11:41 +01:00
Mark McLoughlin
43b3851975 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
2009-08-11 15:39:28 +01:00
Chris Lalancette
48de890392 Remove a duplicated assignment in Xen PCI parsing.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-08-11 13:32:50 +02:00
Chris Lalancette
09cbae6297 Fix up a few minor indentation issues.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-08-11 13:32:26 +02:00
Chris Lalancette
82bdf6d5ae 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>
2009-08-11 13:32:03 +02:00
Chris Lalancette
701477e8c3 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>
2009-08-11 13:31:32 +02:00
Chris Lalancette
9be5773fbb Minor cleanup of error path for c_oneVmInfo.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-08-11 13:31:04 +02:00
Chris Lalancette
b216dd41d7 Fix up a whitespace in comments in src/console.c
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-08-11 13:30:19 +02:00
Chris Lalancette
7b0075a242 Fix up a stray whitespace in virHashGrow.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-08-11 13:29:59 +02:00
Chris Lalancette
d1ec4d7a5a 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>
2009-08-11 13:29:10 +02:00
Chris Lalancette
3c7a12b416 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>
2009-08-11 13:27:54 +02:00
Chris Lalancette
cbcf5ba7d4 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>
2009-08-11 13:27:07 +02:00
Mark McLoughlin
f5a8f969dd 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
2009-08-10 11:19:42 +01:00
Mark McLoughlin
f9bfa10797 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
2009-08-10 09:00:02 +01:00
Mark McLoughlin
c42b397845 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()
2009-08-10 09:00:01 +01:00
Daniel P. Berrange
f2144a3063 Add link to AbiCloud web management system 2009-08-07 14:12:22 +01:00
Chris Lalancette
47919e46ab 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>
2009-08-07 13:50:32 +02:00
Amy Griffis
7534be6fbc 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.
2009-08-06 15:58:38 +02:00
Amy Griffis
63fbcc6927 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
2009-08-06 15:55:07 +02:00
Amy Griffis
e542d52a7c 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.
2009-08-06 15:50:40 +02:00
Amy Griffis
9147bf2a73 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
2009-08-06 15:45:50 +02:00
Amy Griffis
22a1ec68d5 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
2009-08-06 15:38:11 +02:00
Matthias Bolte
a9e96b1ee0 Cleanup structure name naming
* src/esx/esx_driver.c src/esx/esx_util.[ch] src/esx/esx_vi.[ch]:
  just a name change
2009-08-06 15:15:45 +02:00
Matthias Bolte
5f48643e0a Fix memleak if esxOpen fails
* src/esx/esx_driver.c: if esxOpen failed, priv->transport wasn't freed
2009-08-06 15:09:40 +02:00
Matthias Bolte
a7c76142a0 Add proper OOM reporting for esxDomainGetOSType
* src/esx/esx_driver.c: catch an unchecked strdup in
  esxDomainGetOSType()
2009-08-06 15:07:46 +02:00
Daniel Veillard
22a5ebe44b 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
2009-08-05 16:00:41 +02:00
Ryota Ozaki
8b54ef4147 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
2009-08-05 14:35:17 +02:00
Daniel P. Berrange
a480572244 Add uniqness checking for LXC define/create methods
* src/lxc_driver.c: Check for name & UUID uniqueness when
  defining or creating domains
2009-08-05 12:01:04 +01:00
Daniel P. Berrange
388f3368cb Fix removal of transient VMs when LXC aborts
* src/lxc_driver.c: Remove transient VM after monitor triggered
  shutdown
2009-08-05 12:01:04 +01:00
Daniel P. Berrange
53d9a92497 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
2009-08-05 12:01:04 +01:00
Daniel P. Berrange
87f3d69dac Fix configure checks from previous commits
* configure.in: Don't set AM_CONDITIIONAL until *after* making
  the checks
2009-08-05 11:59:58 +01:00
Daniel P. Berrange
acec6c3d02 Avoid a warning if compiling without inotify
* src/xm_internal.c: split the implementations of xenInotifyActive()
2009-08-05 12:04:26 +02:00
Aron Griffis
3879b33447 Typo and comment fixes
* docs/schemas/*.rng: the comments were wrong
* src/qemu_conf.c: typo in an error message
2009-08-05 11:56:56 +02:00
Cole Robinson
a11010c07d 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.
2009-08-05 11:46:33 +02:00
Cole Robinson
8ddfb40e2d 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
2009-08-05 11:39:31 +02:00
Daniel Veillard
3e64748c72 Remove a stray semicolon
* src/xend_internal.c: extraneous ; in xenDaemonParseSxprGraphicsNew
2009-08-05 11:24:23 +02:00
Maximilian Wilhelm
3f11d7820a 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
2009-08-05 11:19:34 +02:00
Maximilian Wilhelm
64bf389bca Xen Inotify support needs sys/inotify.h
* configure.in: to activate Xen Inotify checking we need to check for
  sys/inotify.h availability
2009-08-05 10:57:40 +02:00
Maximilian Wilhelm
a3a623dd57 LXC driver requires sched.h and unshare()
* configure.in: make it check by default for both
2009-08-05 10:52:14 +02:00
Maximilian Wilhelm
16928a161b Configure UML support only if sys/inotify.h present
* configure.in: UML support requires sys/inotify.h so make it check
  by default.
2009-08-05 10:47:18 +02:00
Maximilian Wilhelm
939cc47431 Fix libcurl automatic check and ESX status
* configure.in: if libcurl is not present ESX should be desactivated
  so default to check for esx
2009-08-05 10:43:37 +02:00
Matthias Bolte
10a4e969a6 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
2009-08-05 10:23:59 +02:00
Daniel P. Berrange
8feb499ba2 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
2009-08-04 18:13:09 +01:00
Daniel P. Berrange
bf69fd9b22 Fix memory leak in openvz driver
* src/openvz_driver.c: Remove unneccessary strdup() on hypervisor
  type api call
2009-08-03 11:42:39 +01:00