Commit Graph

2495 Commits

Author SHA1 Message Date
Matthias Bolte
7003390791 esx: Dump the raw response in case of an SOAP fault
Currently only the faultcode and faultstring are deserialized, the
detail part is ignored. The implementation of many new SOAP types
would be necessary to deserialize the detail part correctly. As an
intermediate solution the raw response is dumped to the debug log.
2010-01-08 19:28:14 +01:00
Matthias Bolte
75b7f400f9 esx: Warn if the ESX server is in maintenance mode 2010-01-08 19:28:09 +01:00
Matthias Bolte
728e9229b1 Replace old CVS references with GIT 2010-01-08 18:08:22 +01:00
Daniel Veillard
edcae5a7c4 Qemu: ask for memory preallocation with large pages
The -mem-prealloc flag should be used when using large pages
This ensures qemu tries to allocate all required memory immediately,
rather than when first used. The latter mode will crash qemu
if hugepages aren't available when accessed, while the former
should gracefully fallback to non-hugepages.

* src/qemu/qemu_conf.c: add -mem-prealloc flag to qemu command line
  when using large pages
2010-01-08 12:17:35 +01:00
Jim Fehlig
98ea78b6ee xen hypervisor: xen domctl version 6
xen-unstable c/s 20685 changed the domctl interface, adding a field to
xen_domctl_getdomaininfo structure.  This additional field causes stack
corruption in libvirt.  xen-unstable c/s 20711 rightly bumped the domctl
interface version so it is at least possible to handle the new field.
This change accounts for shr_pages field added to xen_domctl_getdomaininfo
structure.
2010-01-07 13:05:35 -07:00
Jim Meyering
65160f50be network/bridge_driver.c: avoid potential NULL-dereference
* src/network/bridge_driver.c (networkBuildDnsmasqArgv): Correct
test for NULL *argv.
2010-01-07 14:25:45 +01:00
Matthias Bolte
96ceb12443 esx: Fix 'vpx' MAC address range and allow arbitrary MAC addresses
The MAC addresses with 00:50:56 prefix are split into several ranges:

  00:50:56:00:00:00 - 00:50:56:3f:ff:ff  'static' range (manually assigned)
  00:50:56:80:00:00 - 00:50:56:bf:ff:ff  'vpx' range (assigned by a VI Client)

Erroneously the 'vpx' range was assumed to be larger and to occupy the
remaining addresses of the 00:50:56 prefix that are not part of the 'static'
range.

00:50:56 was used as prefix for generated MAC addresses, this is not possible
anymore, because there are gaps in the allowed ranges. Therefore, change the
prefix to 00:0c:29 which is the prefix for auto generated MAC addresses anyway.

Allow arbitrary MAC addresses to be used and set the checkMACAddress VMX option
to false in case the MAC address doesn't fall into any predefined range.

* docs/drvesx.html.in: update website accordingly
* src/esx/esx_driver.c: set the auto generation prefix to 00:0c:29
* src/esx/esx_vmx.c: fix MAC address range handling and allow arbitrary MAC
  addresses
* tests/vmx2xml*, tests/xml2vmx*: add some basic MAC address range tests
2010-01-07 01:38:19 +01:00
Matthias Bolte
79f9419652 esx: Fix deserialization for VI API calls CancelTask and UnregisterVM 2010-01-07 01:38:19 +01:00
Matthias Bolte
d9734072ff esx: Fix and improve the libcurl debug callback
The data passed to the callback is not guaranteed to be zero terminated,
take care of that by coping the data and adding a zero terminator.

Also dump the data for other types than CURLINFO_TEXT.

Set CURLOPT_VERBOSE to 1 so the debug callback is called when enabled.
2010-01-07 01:38:19 +01:00
Matthias Bolte
b0367e86ee esx: Don't warn about an empty URI path 2010-01-07 01:38:19 +01:00
Matthias Bolte
44112bce89 esx: Also allow virtualHW version 4 for ESX 4.0
A domain with virtualHW version 4 is allowed on an ESX 4.0 server.
If a domain is migrated from an ESX 3.5 server to an ESX 4.0 server
then the virtualHW version stays the same. So a ESX 4.0 server can
host domains with virtualHW version 4.
2010-01-07 01:38:19 +01:00
Matthias Bolte
338e7c3c8d Don't free an uninitalized pointer in update_driver_name()
This invalid free results in heap corruption. Some symptoms I saw
because of this were libvirtd crashing and virt-manager hanging
while trying to enumerate devices.
2010-01-07 01:38:19 +01:00
Jim Meyering
7679f064bf xend_internal: don't let invalid input provoke NULL dereference
* src/xen/xend_internal.c (xenDaemonOpen_unix): Do not dereference
a NULL "conn".  Move first deref to follow the "conn == NULL" test.
2010-01-06 21:52:25 +01:00
Adam Litke
7a90f21655 qemu: Always enable the virtio balloon driver
The behavior for the qemu balloon device has changed.  Formerly, a virtio
balloon device was provided by default.  Now, '-balloon virtio' must be
specified on the command line to enable it.  This patch causes libvirt to
add '-balloon virtio' to the command line whenever the -balloon option is
available.
* src/qemu/qemu_conf.c src/qemu/qemu_conf.h: check for the new flag and
  add "-baloon vitio" to qemu command when needed
* tests/qemuhelptest.c: add the new flag for detection
2010-01-06 18:01:51 +01:00
David Allan
1c06eb18c3 Don't update vol details after build
This patch removes the call to vol update after the volume build completes.
The update call is currently meaningless anyway because the vol build is passed
a copy of the definition, so the update result is thrown away.  More
importantly, if the user specified a selinux label for the volume, the update
call results in a double free of the label
* src/storage/storage_backend_fs.c: remove the update call
2010-01-06 17:53:15 +01:00
Matthew Booth
c0a9b6a533 Fix parsing of 'info chardev' line endings
This change makes the 'info chardev' parser ignore any trailing
whitespace on a line. This fixes a specific problem handling a '\r\n'
line ending.

* src/qemu/qemu_monitor_text.c: Ignore trailing whitespace in
  'info chardev' output.
2010-01-06 17:09:04 +01:00
Jim Meyering
aee70b7482 vbox_tmpl.c: don't leak a domain pointer upon failure to create
* src/vbox/vbox_tmpl.c (vboxDomainCreateXML): "Unref" the domain
upon failure.  Patch by Matthias Bolte.
2010-01-05 18:14:47 +01:00
Jim Meyering
2718a3d836 vbox_tmpl.c: avoid NULL deref upon vboxDomainCreateXML failure
* src/vbox/vbox_tmpl.c (vboxDomainCreateXML): Don't call
vboxDomainUndefine on a NULL "dom".
2010-01-05 18:14:44 +01:00
Jim Meyering
f2d8c9d087 qemu_driver.c: remove useless, warning-provoking test
* src/qemu/qemu_driver.c (qemudDomainMigratePrepare2): Remove useless
test of always-non-NULL uri_out parameter.  Use ATTRIBUTE_NONNULL to
inform tools.
2010-01-05 17:25:26 +01:00
Jim Meyering
eebf932e94 qemu_driver.c: avoid NULL dereference upon disk-op failure
* src/qemu/qemu_driver.c (qemudDomainAttachDevice): Call
virCgroupDenyDevicePath only if cgroup is non-NULL.
2010-01-05 17:25:19 +01:00
Jim Meyering
c1237818d2 openvz_conf.c: don't dereference NULL upon failure
* src/openvz/openvz_conf.c (openvzLoadDomains): Avoid NULL deref
of "dom".
2010-01-05 15:32:53 +01:00
Matthias Bolte
a26d2628c0 The secret driver is stateful, link it directly to libvirtd
All other stateful drivers are linked directly to libvirtd
instead of libvirt.so. Link the secret driver to libvirtd too.

* daemon/Makefile.am: link the secret driver to libvirtd
* daemon/libvirtd.c: add #ifdef WITH_SECRETS blocks
* src/Makefile.am: don't link the secret driver to libvirt.so
* src/libvirt_private.syms: remove the secretRegister symbol
2009-12-23 15:01:09 +01:00
Matthias Bolte
f7e5ca90e6 Remove undefined symbols from libvirt_private.syms
MinGW's ld gives an error when trying to export undefined symbols.
2009-12-23 14:57:07 +01:00
Matthias Bolte
ca9e601fcb boolean shadows a typedef in rpcndr.h when compiled with MinGW
Alter the offending variable names to fix this.
2009-12-23 14:57:01 +01:00
Jiri Denemark
913ab198fb Rename DATADIR to PKGDATADIR to fix win32 build
* src/Makefile.am src/cpu/cpu_map.c: rename in Makefile and in the
  cpu map loading code
2009-12-23 14:29:57 +01:00
Daniel Veillard
b9daebfee4 convert missing server entry points into unsupported errors
If using a remote access, sometimes an RPC entry point is not
available, and currently we just end up with a raw:
    error: unknown procedure: xxx
error, while this should be more cleanly reported as an unsupported
entry point like for local access

* src/remote/remote_driver.c: convert missing remote entry points into
  the unsupported feature error
2009-12-22 17:44:03 +01:00
Olivier Fourdan
54f868c164 fix some error report when on remote access
When querying about a domain from 0.3.3 (or RHEL 5.3) domain located
on a 0.6.3 (RHEL-5) machine, the errors are not properly reported.
This patch from Olivier Fourdan <ofourdan@redhat.com> , slightly
modified to not change the semantic when the domain os details cannot
be provided

* src/xen/proxy_internal.c src/xen/xen_hypervisor.c: add some missing
  error reports
2009-12-22 16:49:06 +01:00
Matthias Bolte
457d4ad99d Fix undefined reference to 'close_used_without_including_unistd_h'
Found while trying to cross-compile libvirt on Fedora 12 for Windows.
gnulib redefines 'close' to 'close_used_without_including_unistd_h'
in sys/socket.h if winsock2.h is present and unistd.h has not been
included before sys/socket.h. Reorder some includes to fix this.
2009-12-22 13:04:50 +01:00
Matthias Bolte
9501a45fc0 Fix argument type of virProcessInfoSetAffinity dummy function 2009-12-22 13:04:50 +01:00
Matthias Bolte
a3bd8bbb38 Define ATTRIBUTE_SENTINEL for GCC < 4.0 too
ATTRIBUTE_SENTINEL was defined for GCC >= 4.0 only, resulting in
compile errors when using GCC < 4.0.
2009-12-22 13:04:50 +01:00
Matthias Bolte
d4c1e5aeed Fix compilation with configure --disable-nls 2009-12-22 13:04:50 +01:00
Matthias Bolte
434daaff9a cpu: Fix memory leaks in x86FeatureLoad and x86ModelLoad
Also backup and restore the original ctxt->node value in x86FeatureLoad.
2009-12-22 13:04:50 +01:00
Daniel P. Berrange
27c357bcfa Disable JSON mode monitor until QEMU is more mature
* src/qemu/qemu_conf.h: Remove QEMU_CMD_FLAG_0_12 and just leave
  the lone JSON flag
* src/qemu/qemu_conf.c: Enable JSON on QEMU 0.13 or later, but
  leave it disabled for now
2009-12-22 11:43:48 +00:00
Jiri Denemark
8153c72b97 Only probe for CPU models if required
* src/qemu/qemu_conf.c: CPU models should be probed only if the
  a guest's XML contains CPU model, not each time a qemu command line
  is generated.
2009-12-22 12:23:56 +01:00
Jiri Denemark
bfeeb9a6d2 Install cpu_map.xml
* src/Makefile.am: install it in $(pkgdatadir) i.e. /usr/share/libvirt/
  usually
2009-12-22 12:06:01 +01:00
Chris Lalancette
e9f468d3f9 Make Xen VT-d PCI attach/detach work
The Xen code for making HVM VT-d PCI passthrough attach and detach
wasn't working properly:

1)  In xenDaemonAttachDevice(), we were always trying to reconfigure
a PCI passthrough device, even the first time we added it.  This was
because the code in virDomainXMLDevID() was not checking xenstore for
the existence of the device, and always returning 0 (meaning that
the device already existed).

2)  In xenDaemonDetachDevice(), we were trying to use "device_destroy"
to detach a PCI device.  While you would think that is the right
method to call, it's actually wrong for PCI devices.  In particular,
in upstream Xen (and soon in RHEL-5 Xen), device_configure is actually
used to destroy a PCI device.

To fix the attach
problem I add a lookup into xenstore to see if the device we are
trying to attach already exists.  To fix the detach problem I change
it so that for PCI detach (only), we use device_configure with the
appropriate sxpr to do the detachment.

* src/xen/xend_internal.c: don't use device_destroy for PCI devices
  and fix the other issues.
* src/xen/xs_internal.c src/xen/xs_internal.h: add
  xenStoreDomainGetPCIID()
2009-12-22 10:53:51 +01:00
Daniel P. Berrange
c90e545f83 Fix detection of JSON when restarting libvirtd
The XML XPath for detecting JSON in the running VM statefile was
wrong causing all VMs to get JSON mode enabled at libvirtd restart.

In addition if a VM was running a JSON enabled QEMU once, and then
altered to point to a non-JSON enabled QEMU later the 'monJSON'
flag would not get reset to 0.

* src/qemu/qemu_driver.c: Fix setting/detection of JSON mode
2009-12-21 23:37:37 +00:00
Daniel P. Berrange
469b6b3a75 Fix reporting of TLS connection errors
The code for connecting to a server tries each socket in turn
until it finds one that connects. Unfortunately for TLS sockets
if it connected, but failed TLS handshake it would treat that
as a failure to connect, and try the next socket. This is bad,
it should have reported the TLS failure immediately.

$ virsh -c qemu://somehost.com/system
error: unable to connect to libvirtd at 'somehost.com': Invalid argument
error: failed to connect to the hypervisor

$ ./tools/virsh -c qemu://somehost.com/system
error: server certificate failed validation: The certificate hasn't got a known issuer.
error: failed to connect to the hypervisor

 * src/remote/remote_driver.c: Stop trying to connect if the
   TLS handshake fails
2009-12-21 12:18:38 +00:00
Daniel Veillard
9b2c299a35 Fix typo in qemudDomainAttachHostPciDevice()
* src/qemu/qemu_driver.c: The 'if' statement is supposed to check return
  value of pci = pciGetDevice(conn, ...); , but check uses if (!dev),
  fix it
2009-12-21 12:32:55 +01:00
Adam Litke
841d50358f Add domainMemoryStats support to remote driver
Use a dynamically sized xdr_array to pass memory stats on the wire.  This
supports the addition of future memory stats and reduces the message size
since only supported statistics are returned.

* src/remote/remote_protocol.x: provide defines for the new entry point
* src/remote/remote_driver.c daemon/remote.c: implement the client and
  server side
* daemon/remote_dispatch_args.h daemon/remote_dispatch_prototypes.h
  daemon/remote_dispatch_ret.h daemon/remote_dispatch_table.h
  src/remote/remote_protocol.c src/remote/remote_protocol.h: generated
  stubs
2009-12-20 13:43:19 +01:00
Adam Litke
c7523b410a Implements domainMemStats in the qemu driver
Support for memory statistics reporting is accepted for qemu inclusion.
Statistics are reported via the monitor command 'info balloon' as a comma
seprated list:

(qemu) info balloon
balloon: actual=1024,mem_swapped_in=0,mem_swapped_out=0,major_page_faults=88,minor_page_faults=105535,free_mem=1017065472,total_mem=1045229568

Libvirt, qemu, and the guest operating system may support a subset of the
statistics defined by the virtio spec.  Thus, only statistics recognized by
components will be reported.

* src/qemu/qemu_driver.c src/qemu/qemu_monitor_text.[ch]: implement the
  new entry point by using info balloon monitor command
2009-12-20 13:36:28 +01:00
Adam Litke
4fe975fe4e domMemoryStats: Add public symbol to libvirt API
* src/libvirt.c: implement the main entry point
* src/libvirt_public.syms: add it to the exported symbols
2009-12-20 13:34:21 +01:00
Adam Litke
3a70131312 Add new API virDomainMemoryStats to header and drivers
Set up the types for the domainMemoryStats function and insert it into the
virDriver structure definition.  Because of static initializers, update
every driver and set the new field to NULL.

* include/libvirt/libvirt.h.in: new API
* src/driver.h src/*/*_driver.c src/vbox/vbox_tmpl.c: add the new
  entry to the driver structure
* python/generator.py: fix compiler errors, the actual python binding is
  implemented later
2009-12-20 13:28:42 +01:00
Matthias Bolte
7c59337d5d esx: Add more links to external documentation 2009-12-18 19:29:39 +01:00
Matthias Bolte
470764f0b4 esx: Destroy virtual machine on a vCenter if available
If a virtual machine is destroyed on a ESX server then immediately
undefining this virtual machine on a vCenter may fail, because the
vCenter has not been informed about the status change yet. Therefore,
destroy a virtual machine on a vCenter if available, so the vCenter
is up-to-date when the virtual machine should be undefined.
2009-12-18 19:29:39 +01:00
Matthias Bolte
46306c9c85 esx: Undefine virtual machine on a vCenter if available
Undefining a virtual machine on an ESX server leaves a orphan on the
vCenter behind. So undefine a virtual machine on a vCenter if available
to fix this problem.
2009-12-18 19:29:39 +01:00
Matthias Bolte
a5d8d265a2 esx: Don't warn about '/' paths 2009-12-18 19:29:39 +01:00
Matthias Bolte
1e93e37bbf esx: Use occurrence enum to specify expected result of a SOAP call
Also move XPath expression composition into esxVI_Context_Execute().
2009-12-18 19:29:38 +01:00
Matthias Bolte
cf54204e27 esx: Fix occurence typo 2009-12-18 19:29:38 +01:00
Matthias Bolte
49e261d14e esx: Extend documentation about 'vcenter' and add some about 'auto_answer' 2009-12-18 19:29:38 +01:00