]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
15 years agoesx: Dump the raw response in case of an SOAP fault
Matthias Bolte [Tue, 5 Jan 2010 01:44:33 +0000 (02:44 +0100)]
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.

15 years agoesx: Warn if the ESX server is in maintenance mode
Matthias Bolte [Tue, 5 Jan 2010 01:29:52 +0000 (02:29 +0100)]
esx: Warn if the ESX server is in maintenance mode

15 years agoReplace old CVS references with GIT
Matthias Bolte [Fri, 8 Jan 2010 00:40:38 +0000 (01:40 +0100)]
Replace old CVS references with GIT

15 years agoQemu: ask for memory preallocation with large pages
Daniel Veillard [Thu, 7 Jan 2010 13:48:06 +0000 (14:48 +0100)]
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

15 years agoxen hypervisor: xen domctl version 6
Jim Fehlig [Thu, 7 Jan 2010 20:05:35 +0000 (13:05 -0700)]
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.

15 years agonetwork/bridge_driver.c: avoid potential NULL-dereference
Jim Meyering [Tue, 5 Jan 2010 14:48:42 +0000 (15:48 +0100)]
network/bridge_driver.c: avoid potential NULL-dereference

* src/network/bridge_driver.c (networkBuildDnsmasqArgv): Correct
test for NULL *argv.

15 years agovirsh: Use VIR_FREE instead of free
Matthias Bolte [Sun, 3 Jan 2010 16:13:27 +0000 (17:13 +0100)]
virsh: Use VIR_FREE instead of free

virsh uses other parts of the internal API already, so use VIR_FREE also.

15 years agovirsh: Add persistent history using libreadline
Matthias Bolte [Sun, 3 Jan 2010 14:45:10 +0000 (15:45 +0100)]
virsh: Add persistent history using libreadline

15 years agoesx: Fix 'vpx' MAC address range and allow arbitrary MAC addresses
Matthias Bolte [Sat, 2 Jan 2010 22:58:24 +0000 (23:58 +0100)]
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

15 years agoesx: Fix deserialization for VI API calls CancelTask and UnregisterVM
Matthias Bolte [Sat, 2 Jan 2010 16:11:12 +0000 (17:11 +0100)]
esx: Fix deserialization for VI API calls CancelTask and UnregisterVM

15 years agoesx: Fix and improve the libcurl debug callback
Matthias Bolte [Sat, 2 Jan 2010 13:18:44 +0000 (14:18 +0100)]
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.

15 years agoesx: Don't warn about an empty URI path
Matthias Bolte [Sat, 2 Jan 2010 12:07:29 +0000 (13:07 +0100)]
esx: Don't warn about an empty URI path

15 years agoesx: Also allow virtualHW version 4 for ESX 4.0
Matthias Bolte [Wed, 23 Dec 2009 22:08:21 +0000 (23:08 +0100)]
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.

15 years agoDon't free an uninitalized pointer in update_driver_name()
Matthias Bolte [Wed, 23 Dec 2009 21:18:04 +0000 (22:18 +0100)]
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.

15 years agoxend_internal: don't let invalid input provoke NULL dereference
Jim Meyering [Wed, 6 Jan 2010 11:59:21 +0000 (12:59 +0100)]
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.

15 years agoqemu: Always enable the virtio balloon driver
Adam Litke [Wed, 6 Jan 2010 17:01:51 +0000 (18:01 +0100)]
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

15 years agoDon't update vol details after build
David Allan [Wed, 6 Jan 2010 16:53:15 +0000 (17:53 +0100)]
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

15 years agoDisable building of static Python module
Diego Elio Pettenò [Wed, 6 Jan 2010 16:33:41 +0000 (17:33 +0100)]
Disable building of static Python module

* python/Makefile.am: python modules are loaded at runtime so the static
  version is not needed, avoid building it

15 years agoFix parsing of 'info chardev' line endings
Matthew Booth [Wed, 6 Jan 2010 16:09:04 +0000 (17:09 +0100)]
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.

15 years agovbox_tmpl.c: don't leak a domain pointer upon failure to create
Jim Meyering [Tue, 5 Jan 2010 16:45:46 +0000 (17:45 +0100)]
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.

15 years agovbox_tmpl.c: avoid NULL deref upon vboxDomainCreateXML failure
Jim Meyering [Wed, 16 Dec 2009 12:56:57 +0000 (13:56 +0100)]
vbox_tmpl.c: avoid NULL deref upon vboxDomainCreateXML failure

* src/vbox/vbox_tmpl.c (vboxDomainCreateXML): Don't call
vboxDomainUndefine on a NULL "dom".

15 years agoqemu_driver.c: remove useless, warning-provoking test
Jim Meyering [Tue, 5 Jan 2010 15:32:11 +0000 (16:32 +0100)]
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.

15 years agoqemu_driver.c: avoid NULL dereference upon disk-op failure
Jim Meyering [Wed, 16 Dec 2009 13:15:50 +0000 (14:15 +0100)]
qemu_driver.c: avoid NULL dereference upon disk-op failure

* src/qemu/qemu_driver.c (qemudDomainAttachDevice): Call
virCgroupDenyDevicePath only if cgroup is non-NULL.

15 years agoopenvz_conf.c: don't dereference NULL upon failure
Jim Meyering [Tue, 15 Dec 2009 15:16:57 +0000 (16:16 +0100)]
openvz_conf.c: don't dereference NULL upon failure

* src/openvz/openvz_conf.c (openvzLoadDomains): Avoid NULL deref
of "dom".

15 years agoDistribute vmx2xml and xml2vmx test data files
Matthias Bolte [Wed, 23 Dec 2009 22:02:44 +0000 (23:02 +0100)]
Distribute vmx2xml and xml2vmx test data files

15 years agoRelease of libvirt-0.7.5
Daniel Veillard [Wed, 23 Dec 2009 16:00:22 +0000 (17:00 +0100)]
Release of libvirt-0.7.5

15 years agoUpdate and regenerate localizations
Daniel Veillard [Wed, 23 Dec 2009 14:53:32 +0000 (15:53 +0100)]
Update and regenerate localizations

upate of as.po bn_IN.po de.po es.po gu.po hi.po kn.po ml.po mr.po or.po
pa.po pl.po ru.po ta.po te.po zh_CN.po and regeneration

15 years agoThe secret driver is stateful, link it directly to libvirtd
Matthias Bolte [Tue, 22 Dec 2009 13:50:50 +0000 (14:50 +0100)]
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

15 years agoRemove undefined symbols from libvirt_private.syms
Matthias Bolte [Wed, 23 Dec 2009 03:07:48 +0000 (04:07 +0100)]
Remove undefined symbols from libvirt_private.syms

MinGW's ld gives an error when trying to export undefined symbols.

15 years agoboolean shadows a typedef in rpcndr.h when compiled with MinGW
Matthias Bolte [Wed, 23 Dec 2009 03:02:26 +0000 (04:02 +0100)]
boolean shadows a typedef in rpcndr.h when compiled with MinGW

Alter the offending variable names to fix this.

15 years agoRename DATADIR to PKGDATADIR to fix win32 build
Jiri Denemark [Wed, 23 Dec 2009 13:29:57 +0000 (14:29 +0100)]
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

15 years agoMove cpu_map.xml to -client RPM
Jiri Denemark [Wed, 23 Dec 2009 13:28:42 +0000 (14:28 +0100)]
Move cpu_map.xml to -client RPM

All the cpu code is part of libvirt library and it might be used by
drivers which do not require libvirtd to be running.

15 years agoconvert missing server entry points into unsupported errors
Daniel Veillard [Tue, 22 Dec 2009 16:44:03 +0000 (17:44 +0100)]
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

15 years agofix some error report when on remote access
Olivier Fourdan [Tue, 22 Dec 2009 15:49:06 +0000 (16:49 +0100)]
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

15 years agoFix undefined reference to 'close_used_without_including_unistd_h'
Matthias Bolte [Tue, 22 Dec 2009 02:06:57 +0000 (03:06 +0100)]
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.

15 years agoFix argument type of virProcessInfoSetAffinity dummy function
Matthias Bolte [Tue, 22 Dec 2009 01:03:20 +0000 (02:03 +0100)]
Fix argument type of virProcessInfoSetAffinity dummy function

15 years agoDefine ATTRIBUTE_SENTINEL for GCC < 4.0 too
Matthias Bolte [Mon, 21 Dec 2009 21:21:15 +0000 (22:21 +0100)]
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.

15 years agoFix compilation with configure --disable-nls
Matthias Bolte [Mon, 21 Dec 2009 21:16:25 +0000 (22:16 +0100)]
Fix compilation  with configure --disable-nls

15 years agocpu: Fix memory leaks in x86FeatureLoad and x86ModelLoad
Matthias Bolte [Mon, 21 Dec 2009 18:12:45 +0000 (19:12 +0100)]
cpu: Fix memory leaks in x86FeatureLoad and x86ModelLoad

Also backup and restore the original ctxt->node value in x86FeatureLoad.

15 years agoFix configure check for SASL
Matthias Bolte [Mon, 21 Dec 2009 17:58:09 +0000 (18:58 +0100)]
Fix configure check for SASL

The option --with-sasl defaults to 'check', but an inverted test logic
lets the SASL check fail with an error instead of disabling SASL.
Fix the test logic so SASL support gets disabled if SASL is missing and
--with-sasl is set to check.

15 years agoFix GnuTLS pkg-config check
Matthias Bolte [Mon, 21 Dec 2009 17:47:12 +0000 (18:47 +0100)]
Fix GnuTLS pkg-config check

The testlogic for $PKG_CONFIG was inverted, checking for an empty string
before using PKG_CHECK_MODULES. Use -x instead of -z and add an else branch
to the if checking for $GNUTLS_FOUND = no to add -lgcrypt in case the
GnuTLS libraries are detected by pkg-config.

15 years agoReport an error if no XDR library can be found
Matthias Bolte [Mon, 21 Dec 2009 17:37:15 +0000 (18:37 +0100)]
Report an error if no XDR library can be found

15 years agoDisable JSON mode monitor until QEMU is more mature
Daniel P. Berrange [Mon, 21 Dec 2009 20:49:43 +0000 (20:49 +0000)]
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

15 years agoOnly probe for CPU models if required
Jiri Denemark [Tue, 22 Dec 2009 11:23:56 +0000 (12:23 +0100)]
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.

15 years agoAdd some people missing from the AUTHORS list
Daniel Veillard [Tue, 22 Dec 2009 11:16:57 +0000 (12:16 +0100)]
Add some people missing from the AUTHORS list

15 years agoAdd cpu_map.xml to libvirt.spec
Jiri Denemark [Tue, 22 Dec 2009 11:09:56 +0000 (12:09 +0100)]
Add cpu_map.xml to libvirt.spec

* libvirt.spec.in: embbed it in the main libvirt binary rpm

15 years agoInstall cpu_map.xml
Jiri Denemark [Tue, 22 Dec 2009 11:06:01 +0000 (12:06 +0100)]
Install cpu_map.xml

* src/Makefile.am: install it in $(pkgdatadir) i.e. /usr/share/libvirt/
  usually

15 years agoMake Xen VT-d PCI attach/detach work
Chris Lalancette [Tue, 22 Dec 2009 09:53:51 +0000 (10:53 +0100)]
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()

15 years agoFix detection of JSON when restarting libvirtd
Daniel P. Berrange [Wed, 9 Dec 2009 18:28:30 +0000 (18:28 +0000)]
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

15 years agoDocument the dommemstat command in the virsh man page
Adam Litke [Mon, 21 Dec 2009 14:24:56 +0000 (15:24 +0100)]
Document the dommemstat command in the virsh man page

* tools/virsh.pod: Provide a basic mention of the dommemstat command in
  the virsh man page.

15 years agoChange virsh dommemstats command to dommemstat
Daniel Veillard [Mon, 21 Dec 2009 12:49:45 +0000 (13:49 +0100)]
Change virsh dommemstats command to dommemstat

As Paul Jenner pointed out all other statistics commands use the
singular form

* tools/virsh.c: rename dommemstats to dommemstat as well as function
  name and associated structures

15 years agoFix reporting of TLS connection errors
Daniel P. Berrange [Thu, 17 Dec 2009 17:39:43 +0000 (17:39 +0000)]
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

15 years agoFix typo in qemudDomainAttachHostPciDevice()
Daniel Veillard [Mon, 21 Dec 2009 11:32:55 +0000 (12:32 +0100)]
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

15 years agopython: Add python bindings for virDomainMemoryStats
Adam Litke [Sun, 20 Dec 2009 12:48:37 +0000 (13:48 +0100)]
python: Add python bindings for virDomainMemoryStats

Enable virDomainMemoryStats in the python API.  dom.memoryStats() will return a
dictionary containing the supported statistics.  A dictionary is required
because the meaining of each quantity cannot be inferred from its index in a
list.

* python/generator.py: reenable bindings for this entry point
* python/libvirt-override-api.xml python/libvirt-override.c: the
  generator can't handle this new function, add the new binding,
  and the XML description

15 years agoAdd a new command dommemstats for virDomainMemoryStats
Adam Litke [Sun, 20 Dec 2009 12:46:24 +0000 (13:46 +0100)]
Add a new command dommemstats for virDomainMemoryStats

Define a new command 'dommemstats' to report domain memory statistics.  The
output format is inspired by 'domblkstat' and 'domifstat' and consists of
tag/value pairs, one per line.  The command can complete successfully and
print no output if virDomainMemoryStats is supported by the driver, but not
the guest operating system.

Sample output:
swap_in 0
swap_out 0
major_fault 54
minor_fault 58259
unused 487680
available 502472

All stats referring to a quantity of memory (eg. all above except major and
minor faults) represent the quantity in KBytes.

* tools/virsh.c: implements the new command

15 years agoAdd domainMemoryStats support to remote driver
Adam Litke [Sun, 20 Dec 2009 12:43:19 +0000 (13:43 +0100)]
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

15 years agoImplements domainMemStats in the qemu driver
Adam Litke [Sun, 20 Dec 2009 12:36:28 +0000 (13:36 +0100)]
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

15 years agodomMemoryStats: Add public symbol to libvirt API
Adam Litke [Sun, 20 Dec 2009 12:34:21 +0000 (13:34 +0100)]
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

15 years agoAdd new API virDomainMemoryStats to header and drivers
Adam Litke [Sun, 20 Dec 2009 12:28:42 +0000 (13:28 +0100)]
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

15 years agoesx: Add more links to external documentation
Matthias Bolte [Sat, 12 Dec 2009 20:20:21 +0000 (21:20 +0100)]
esx: Add more links to external documentation

15 years agoesx: Destroy virtual machine on a vCenter if available
Matthias Bolte [Sat, 12 Dec 2009 19:51:35 +0000 (20:51 +0100)]
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.

15 years agoesx: Undefine virtual machine on a vCenter if available
Matthias Bolte [Sun, 6 Dec 2009 23:59:56 +0000 (00:59 +0100)]
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.

15 years agoesx: Don't warn about '/' paths
Matthias Bolte [Mon, 23 Nov 2009 22:26:31 +0000 (23:26 +0100)]
esx: Don't warn about '/' paths

15 years agoesx: Use occurrence enum to specify expected result of a SOAP call
Matthias Bolte [Sun, 22 Nov 2009 20:32:23 +0000 (21:32 +0100)]
esx: Use occurrence enum to specify expected result of a SOAP call

Also move XPath expression composition into esxVI_Context_Execute().

15 years agoesx: Fix occurence typo
Matthias Bolte [Sun, 22 Nov 2009 20:18:45 +0000 (21:18 +0100)]
esx: Fix occurence typo

15 years agoesx: Extend documentation about 'vcenter' and add some about 'auto_answer'
Matthias Bolte [Sun, 22 Nov 2009 20:00:15 +0000 (21:00 +0100)]
esx: Extend documentation about 'vcenter' and add some about 'auto_answer'

15 years agoesx: Extend vCenter query parameter
Matthias Bolte [Wed, 18 Nov 2009 23:08:13 +0000 (00:08 +0100)]
esx: Extend vCenter query parameter

If an ESX host is managed by a vCenter, it knows the IP address of the
vCenter. Setting the vCenter query parameter to * allows to connect to the
vCenter known to an ESX host without the need to specify its IP address
or hostname explicitly.

15 years agoesx: Removed unused inttypes.h include
Matthias Bolte [Wed, 18 Nov 2009 00:35:11 +0000 (01:35 +0100)]
esx: Removed unused inttypes.h include

15 years agoesx: Replace libxml1 'xmlChildrenNode' with libxml2 'children'
Matthias Bolte [Wed, 18 Nov 2009 00:31:28 +0000 (01:31 +0100)]
esx: Replace libxml1 'xmlChildrenNode' with libxml2 'children'

15 years agoesx: Use more suitable error code in esxVI_LookupVirtualMachineByUuid()
Matthias Bolte [Wed, 18 Nov 2009 00:11:45 +0000 (01:11 +0100)]
esx: Use more suitable error code in esxVI_LookupVirtualMachineByUuid()

15 years agoesx: Improve domain lookup by UUID
Matthias Bolte [Wed, 18 Nov 2009 00:03:31 +0000 (01:03 +0100)]
esx: Improve domain lookup by UUID

esxDomainLookupByUUID() and esxDomainIsActive() lookup a domain by asking
ESX for all known domains and searching manually for the one with the
matching UUID. This is inefficient. The VI API allows to lookup by UUID
directly: FindByUuid().

* src/esx/esx_driver.c: change esxDomainLookupByUUID() and esxDomainIsActive()
  to use esxVI_LookupVirtualMachineByUuid(), also reorder some functions to
  keep them in sync with the driver struct

15 years agoesx: Add automatic question handling
Matthias Bolte [Sun, 15 Nov 2009 21:22:47 +0000 (22:22 +0100)]
esx: Add automatic question handling

Questions can block tasks, to handle them automatically the driver can answers
them with the default answer. The auto_answer query parameter allows to enable
this automatic question handling.

* src/esx/README: add a detailed explanation for automatic question handling
* src/esx/esx_driver.c: add automatic question handling for all task related
  driver functions
* src/esx/esx_util.[ch]: add handling for the auto_answer query parameter
* src/esx/esx_vi.[ch], src/esx/esx_vi_methods.[ch], src/esx/esx_vi_types.[ch]:
  add new VI API methods and types and additional helper functions for
  automatic question handling

15 years agoFix compilation with gcrypt < 1.4.2
Matthias Bolte [Fri, 18 Dec 2009 11:02:07 +0000 (12:02 +0100)]
Fix compilation with gcrypt < 1.4.2

Commit 33a198c1f6a4a1bc7f34d50a31032e03bec10fee increased the gcrypt
version requirement to 1.4.2 because the GCRY_THREAD_OPTION_VERSION
define was added in this version.

The configure script doesn't check for the gcrypt version. To support
gcrypt versions < 1.4.2 change the virTLSThreadImpl initialization
to use GCRY_THREAD_OPTION_VERSION only if it's defined.

15 years agoDon't mix LDFLAGS and LIBS in the configure script
Diego Elio Pettenò [Fri, 18 Dec 2009 17:34:40 +0000 (18:34 +0100)]
Don't mix LDFLAGS and LIBS in the configure script

* configure.in: If you pass libraries in the LDFLAGS variable, and then
  try AC_CHECK_FUNCS to find whether a function is present or not,
  it'll fail badly when using the --as-needed linker flag. Instead,
  pass the libraries through the LIBS library, so that they are passed
  after the conftest.c source file and the tests are done properly.

15 years agoDon't make it possible to define HAVE_HAL but not enable it in automake
Diego Elio Pettenò [Fri, 18 Dec 2009 17:29:13 +0000 (18:29 +0100)]
Don't make it possible to define HAVE_HAL but not enable it in automake

* configure.in: With the previous logic, if libhal_get_all_devices
  function was not found, HAVE_HAL would be defined for the preprocessor
  but it wouldn't be enabled in automake conditionals, causing the final
  link to fail with missing references to HAL entries.

15 years agoImplement virsh command 'cpu-compare'
Jiri Denemark [Fri, 18 Dec 2009 15:28:15 +0000 (16:28 +0100)]
Implement virsh command 'cpu-compare'

* tools/virsh.c: provide a way to us teh new API with virsh

15 years agoImplement CPU selection in QEMU driver
Jiri Denemark [Fri, 18 Dec 2009 15:24:14 +0000 (16:24 +0100)]
Implement CPU selection in QEMU driver

* src/qemu/qemu_conf.c src/qemu/qemu_conf.h src/qemu/qemu_driver.c:
  add the new entry point, extend capabilities and code to interract
  with qemu

15 years agoAdds CPU map for models and features
Jiri Denemark [Fri, 18 Dec 2009 15:11:42 +0000 (16:11 +0100)]
Adds CPU map for models and features

* src/cpu/cpu_map.xml: newdescription file
* src/Makefile.am: include it in dist

15 years agoAdds CPU selection infrastructure
Jiri Denemark [Fri, 18 Dec 2009 15:02:11 +0000 (16:02 +0100)]
Adds CPU selection infrastructure

Each driver supporting CPU selection must fill in host CPU capabilities.
When filling them, drivers for hypervisors running on the same node as
libvirtd can use cpuNodeData() to obtain raw CPU data. Other drivers,
such as VMware, need to implement their own way of getting such data.
Raw data can be decoded into virCPUDefPtr using cpuDecode() function.

When implementing virConnectCompareCPU(), a hypervisor driver can just
call cpuCompareXML() function with host CPU capabilities.

For each guest for which a driver supports selecting CPU models, it must
set the appropriate feature in guest's capabilities:

    virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0)

Actions needed when a domain is being created depend on whether the
hypervisor understands raw CPU data (currently CPUID for i686, x86_64
architectures) or symbolic names has to be used.

Typical use by hypervisors which prefer CPUID (such as VMware and Xen):

- convert guest CPU configuration from domain's XML into a set of raw
  data structures each representing one of the feature policies:

    cpuEncode(conn, architecture, guest_cpu_config,
              &forced_data, &required_data, &optional_data,
              &disabled_data, &forbidden_data)

- create a mask or whatever the hypervisor expects to see and pass it
  to the hypervisor

Typical use by hypervisors with symbolic model names (such as QEMU):

- get raw CPU data for a computed guest CPU:

    cpuGuestData(conn, host_cpu, guest_cpu_config, &data)

- decode raw data into virCPUDefPtr with a possible restriction on
  allowed model names:

    cpuDecode(conn, guest, data, n_allowed_models, allowed_models)

- pass guest->model and guest->features to the hypervisor

* src/cpu/cpu.c src/cpu/cpu.h src/cpu/cpu_generic.c
  src/cpu/cpu_generic.h src/cpu/cpu_map.c src/cpu/cpu_map.h
  src/cpu/cpu_x86.c src/cpu/cpu_x86.h src/cpu/cpu_x86_data.h
* configure.in: check for CPUID instruction
* src/Makefile.am: glue the new files in
* src/libvirt_private.syms: add new private symbols
* po/POTFILES.in: add new cpu files containing translatable strings

15 years agoRemote driver CPU flags support
Jiri Denemark [Fri, 18 Dec 2009 14:56:09 +0000 (15:56 +0100)]
Remote driver CPU flags support

* src/remote/remote_driver.c: add the new entry point

15 years agoCPU flags wire protocol format and server side
Jiri Denemark [Fri, 18 Dec 2009 14:49:34 +0000 (15:49 +0100)]
CPU flags wire protocol format and server side

* src/remote/remote_protocol.x: update with new entry point
* daemon/remote.c: add the new server dispatcher
* 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: regenerated

15 years agoPublic API implementation
Jiri Denemark [Fri, 18 Dec 2009 14:24:34 +0000 (15:24 +0100)]
Public API implementation

* src/libvirt.c: adds the public entry point virConnectCompareCPU()

15 years agoAdds the internal driver API
Jiri Denemark [Fri, 18 Dec 2009 13:59:39 +0000 (14:59 +0100)]
Adds the internal driver API

* src/driver.h: add an extra entry point in the structure
* src/esx/esx_driver.c src/lxc/lxc_driver.c src/opennebula/one_driver.c
  src/openvz/openvz_driver.c src/phyp/phyp_driver.c src/qemu/qemu_driver.c
  src/remote/remote_driver.c src/test/test_driver.c src/uml/uml_driver.c
  src/vbox/vbox_tmpl.c src/xen/xen_driver.c: add NULL entry points for
  all drivers

15 years agoNew public API definition virConnectCompareCPU()
Jiri Denemark [Fri, 18 Dec 2009 13:51:39 +0000 (14:51 +0100)]
New public API definition virConnectCompareCPU()

* include/libvirt/libvirt.h.in: add it in the public API as
  well as the new flags
* src/libvirt_public.syms: export it

15 years agoFixes syntax-check with previous commit
Daniel Veillard [Fri, 18 Dec 2009 13:50:04 +0000 (14:50 +0100)]
Fixes syntax-check with previous commit

* po/POTFILES.in: adds src/conf/cpu_conf.c in teh set of files with
  translatable content
* src/conf/cpu_conf.c: remove an unused include

15 years agoXML parsing/formating code for CPU flags
Jiri Denemark [Fri, 18 Dec 2009 13:44:55 +0000 (14:44 +0100)]
XML parsing/formating code for CPU flags

* include/libvirt/virterror.h src/util/virterror.c: add new domain
  VIR_FROM_CPU for errors
* src/conf/cpu_conf.c src/conf/cpu_conf.h: new parsing module
* src/Makefile.am proxy/Makefile.am: include new files
* src/conf/capabilities.[ch] src/conf/domain_conf.[ch]: reference
  new code
* src/libvirt_private.syms: private export of new entry points

15 years agoXML schema for CPU flags
Jiri Denemark [Fri, 18 Dec 2009 13:37:09 +0000 (14:37 +0100)]
XML schema for CPU flags

XML schema for CPU flags

Firstly, CPU topology and model with optional features have to be
advertised in host capabilities:

    <host>
        <cpu>
            <arch>ARCHITECTURE</arch>
            <features>
                <!-- old-style features are here -->
            </features>
            <model>NAME</model>
            <topology sockets="S" cores="C" threads="T"/>
            <feature name="NAME"/>
        </cpu>
        ...
    </host>

Secondly, drivers which support detailed CPU specification have to
advertise
it in guest capabilities:

    <guest>
    ...
    <features>
            <cpuselection/>
        </features>
    </guest>

And finally, CPU may be configured in domain XML configuration:

<domain>
    ...
    <cpu match="MATCH">
        <model>NAME</model>
        <topology sockets="S" cores="C" threads="T"/>
        <feature policy="POLICY" name="NAME"/>
    </cpu>
</domain>

Where MATCH can be one of:
    - 'minimum'     specified CPU is the minimum requested CPU
    - 'exact'       disable all additional features provided by host CPU
    - 'strict'      fail if host CPU doesn't exactly match

POLICY can be one of:
    - 'force'       turn on the feature, even if host doesn't have it
    - 'require'     fail if host doesn't have the feature
    - 'optional'    match host
    - 'disable'     turn off the feature, even if host has it
    - 'forbid'      fail if host has the feature

'force' and 'disable' policies turn on/off the feature regardless of its
availability on host. 'force' is unlikely to be used but its there for
completeness since Xen and VMWare allow it.

'require' and 'forbid' policies prevent a guest from being started on a host
which doesn't/does have the feature. 'forbid' is for cases where you disable
the feature but a guest may still try to access it anyway and you don't want
it to succeed.

'optional' policy sets the feature according to its availability on host.
When a guest is booted on a host that has the feature and then migrated to
another host, the policy changes to 'require' as we can't take the feature
away from a running guest.

Default policy for features provided by host CPU but not specified in domain
configuration is set using match attribute of cpu tag. If 'minimum' match is
requested, additional features will be treated as if they were specified
with 'optional' policy. 'exact' match implies 'disable' policy and 'strict'
match stands for 'forbid' policy.

* docs/schemas/capability.rng docs/schemas/domain.rng: extend the
  RelaxNG schemas to add CPU flags support

15 years agoInitialize gcrypt threading
Daniel P. Berrange [Fri, 17 Jul 2009 19:20:08 +0000 (20:20 +0100)]
Initialize gcrypt threading

GNUTLS uses gcrypt for its crypto functions. gcrypt requires
that the app/library initializes threading before using it.
We don't want to force apps using libvirt to know about
gcrypt, so we make virInitialize init threading on their
behalf. This location also ensures libvirtd has initialized
it correctly. This initialization is required even if libvirt
itself were only using one thread, since another non-libvirt
library (eg GTK-VNC) could also be using gcrypt from another
thread

* src/libvirt.c: Register thread functions for gcrypt
* configure.in: Add -lgcrypt to linker flags

15 years agoFix bug in storage driver accessing wrong private data
Daniel P. Berrange [Wed, 9 Dec 2009 09:38:11 +0000 (09:38 +0000)]
Fix bug in storage driver accessing wrong private data

* src/storage/storage_driver.c: Fix IsPersistent() and IsActivE()
  methods on storage pools to use 'storagePrivateData' instead
  of 'privateData'. Also fix naming convention of objects

15 years agoesx_vi.c: do not call through NULL function pointer
Jim Meyering [Tue, 15 Dec 2009 18:22:31 +0000 (19:22 +0100)]
esx_vi.c: do not call through NULL function pointer

* src/esx/esx_vi.c (esxVI_List_CastFromAnyType): For invalid
inputs, fail right away.  Do not "goto failure" where a NULL
input pointer would be dereferenced.

15 years agoesx_util.c: avoid NULL deref for invalid inputs
Jim Meyering [Tue, 15 Dec 2009 18:08:49 +0000 (19:08 +0100)]
esx_util.c: avoid NULL deref for invalid inputs

* src/esx/esx_util.c (esxUtil_ParseDatastoreRelatedPath): Return
right away for invalid inputs, rather than using them (which would
dereference NULL pointers) in clean-up code.

15 years agoesx: Don't goto failure for invalid arguments in VMX code
Matthias Bolte [Tue, 15 Dec 2009 22:49:56 +0000 (23:49 +0100)]
esx: Don't goto failure for invalid arguments in VMX code

This also fixes a NULL-deref of virtualDev in esxVMX_ParseSCSIController
found by Jim Meyering.

15 years agoFix memory leak in qemudBuildCommandLine
Matthias Bolte [Mon, 14 Dec 2009 22:25:21 +0000 (23:25 +0100)]
Fix memory leak in qemudBuildCommandLine

15 years agoavoid calling exit with a constant; use EXIT_* instead
Jim Meyering [Tue, 15 Dec 2009 08:43:29 +0000 (09:43 +0100)]
avoid calling exit with a constant; use EXIT_* instead

This appeases a new gnulib-provided "syntax-check".
* daemon/libvirtd.c (main): Use EXIT_FAILURE, not 1.
* proxy/libvirt_proxy.c (main): Likewise, and EXIT_SUCCESS, not 0.
* tests/conftest.c (main): Likewise.
* tests/reconnect.c (main): Likewise.
* tests/testutils.h (EXIT_AM_SKIP): Define.
* tests/nodeinfotest.c (mymain): Use EXIT_AM_SKIP, not 77.
* tests/qemuargv2xmltest.c: Likewise.
* tests/qemuxml2xmltest.c: Likewise.
* tests/virshtest.c (mymain): Likewise.

15 years agomaint: remove from VC two gnulib-provided files
Jim Meyering [Tue, 15 Dec 2009 08:20:02 +0000 (09:20 +0100)]
maint: remove from VC two gnulib-provided files

* build-aux/link-warning.h: Remove file from version control.
* build-aux/mktempd: Likewise.
* build-aux/.gitignore: Adjust.

15 years agoavoid malfunction when virFileResolveLink is applied to non-POSIX FS
Jim Meyering [Tue, 15 Dec 2009 07:27:53 +0000 (08:27 +0100)]
avoid malfunction when virFileResolveLink is applied to non-POSIX FS

The virFileResolveLink utility function relied on the POSIX guarantee
that stat.st_size of a symlink is the length of the value.  However,
on some types of file systems, it is invalid, so do not rely on it.
Use gnulib's areadlink module instead.
* bootstrap (modules): Add areadlink.
* src/util/util.c: Include "areadlink.h".
Let areadlink perform the readlink and malloc.
* configure.in (AC_CHECK_FUNCS): Remove readlink.  No need,
since it's presence is guaranteed by gnulib.

15 years agobuild: update gnulib submodule to latest
Jim Meyering [Tue, 15 Dec 2009 07:37:24 +0000 (08:37 +0100)]
build: update gnulib submodule to latest

15 years agoxm_internal.c: remove misleading dead code
Jim Meyering [Mon, 14 Dec 2009 20:37:54 +0000 (21:37 +0100)]
xm_internal.c: remove misleading dead code

* src/xen/xm_internal.c (xenXMConfigGetULong): Remove useless and
misleading test (always false) for val->str == NULL before code that
always dereferences val->str.  "val" comes from virConfGetValue, and
at that point, val->str is guaranteed to be non-NULL.
(xenXMConfigGetBool): Likewise.
* src/util/conf.c (virConfSetValue): Ensure that vir->str is never NULL,
not even if someone tries to set such a value via virConfSetValue.

15 years agolibvirt.c: don't let a NULL "cpumaps" argument provoke a NULL-deref
Jim Meyering [Mon, 14 Dec 2009 16:17:53 +0000 (17:17 +0100)]
libvirt.c: don't let a NULL "cpumaps" argument provoke a NULL-deref

* src/libvirt.c (virDomainGetVcpus): Describe new, stronger
requirement on "maplen"s relationship to "cpumaps".

15 years agoqemu migration: avoid NULL-deref given an invalid input
Jim Meyering [Mon, 14 Dec 2009 16:02:56 +0000 (17:02 +0100)]
qemu migration: avoid NULL-deref given an invalid input

* src/qemu/qemu_driver.c (doNonTunnelMigrate): Don't let a
NULL "uri_out" provoke a NULL-dereference in doNativeMigrate:
supply omitted goto-after-qemudReportError.