]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
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.

15 years agoqemu_driver.c: don't unlink(NULL) on OOM error path
Jim Meyering [Mon, 14 Dec 2009 15:41:11 +0000 (16:41 +0100)]
qemu_driver.c: don't unlink(NULL) on OOM error path

* src/qemu/qemu_driver.c (qemudDomainMigratePrepareTunnel): Upon an
out of memory error, we would end up with unixfile==NULL and attempt
to unlink(NULL).  Skip the unlink when it's NULL.

15 years agoremote_driver.c: also zero out ->saslDecodedOffset member
Jim Meyering [Mon, 14 Dec 2009 12:00:01 +0000 (13:00 +0100)]
remote_driver.c: also zero out ->saslDecodedOffset member

* src/remote/remote_driver.c (remoteIOReadMessage): ...rather than
zeroing out priv->saslDecodedLength twice.

15 years agoqemu_driver.c: avoid double free on error path
Jim Meyering [Mon, 14 Dec 2009 14:55:19 +0000 (15:55 +0100)]
qemu_driver.c: avoid double free on error path

* src/qemu/qemu_driver.c (qemudDomainMigrateFinish2): Set
"event" to NULL after qemuDomainEventQueue frees it, so a
subsequent free (after endjob label) upon qemuMonitorStartCPUs
failure does not cause a double free.

15 years agolibvirtd: avoid a NULL dereference on error path
Jim Meyering [Mon, 14 Dec 2009 15:45:11 +0000 (16:45 +0100)]
libvirtd: avoid a NULL dereference on error path

* daemon/libvirtd.c (qemudDispatchServer): Since "client" may be
NULL in the "cleanup:" block, free client->rx only when it's not.

15 years agoFix and improve domain xml video element description
Matthias Bolte [Sun, 13 Dec 2009 17:25:17 +0000 (18:25 +0100)]
Fix and improve domain xml video element description

The description mismatched the actual structure since the video element
was introduced. The nvram attribute is actually called vram. Specify the
unit of the vram attribute.

15 years agoFix install location for Python bindings
Matthias Bolte [Fri, 11 Dec 2009 23:11:31 +0000 (00:11 +0100)]
Fix install location for Python bindings

Commit 66137344feb488ea87b0d92f3c03844d9a7a7786 changed the Python detection
mechanism in configure to use AM_PATH_PYTHON. This results in a changed
install location for the Python bindings, at least on Fedora 12 64bit systems.

Before this commit libvirt.py and libvirtmod.so were installed to

  /usr/lib64/python2.6/site-packages

After this commit they are installed to

  /usr/lib/python2.6/site-packages

Mixed Python packages (containing *.py and *.so files) should be installed to
the pyexecdir directory detected by AM_PATH_PYTHON.

This restores the install location from before the AM_PATH_PYTHON commit.

* configure.in: remove unnecessary pythondir export
* python/Makefile.am: switch from pythondir to pyexecdir

15 years agoRelax the allowed values for machine type in schema
Daniel Veillard [Mon, 14 Dec 2009 15:59:06 +0000 (16:59 +0100)]
Relax the allowed values for machine type in schema

* docs/schemas/domain.rng: don't try to validate based on a list, open
  up the machine type to a regexp allowing a-z A-Z 0-9 _ - and .

15 years agovirsh: avoid double-free
Jim Meyering [Mon, 14 Dec 2009 13:34:29 +0000 (14:34 +0100)]
virsh: avoid double-free

* tools/virsh.c (vshCommandParse): Avoid double-free of "tkdata".
Set it to NULL immediately after free in the (cmd == NULL) case,
just as in the other case, in case the final free(tkdata) is
triggered by a syntax error.

15 years agonode_device_driver.c: don't write beyond EOB for 4K-byte symlink
Jim Meyering [Mon, 14 Dec 2009 11:05:38 +0000 (12:05 +0100)]
node_device_driver.c: don't write beyond EOB for 4K-byte symlink

* src/node_device/node_device_driver.c (update_driver_name): The
previous code would write one byte beyond the end of the 4KiB
stack buffer when presented with a symlink value of exactly that
length (very unlikely).  Remove the automatic buffer and use
virFileResolveLink in place of readlink.  Suggested by Daniel Veillard.

15 years agoFix owner and group in example volume XML
Matthew Booth [Mon, 14 Dec 2009 15:23:26 +0000 (16:23 +0100)]
Fix owner and group in example volume XML

The owner and group in the documentation examples were confusingly given as
'0744'. They should be numeric uid and gid. Changed the examples to use the
default uid and gid assigned to qemu in F12.

* docs/formatstorage.html.in: Change example owner and group in volume XML

15 years agoadd missing doc for device <shareable/> option
Daniel Veillard [Mon, 14 Dec 2009 15:20:55 +0000 (16:20 +0100)]
add missing doc for device <shareable/> option

15 years agoEliminate failure to delete empty storage pools
Laine Stump [Mon, 14 Dec 2009 15:15:28 +0000 (16:15 +0100)]
Eliminate failure to delete empty storage pools

* src/storage/storage_backend_fs.c: virStorageBackendFileSystemDelete
  was incorrectly calling unlink() in an attempt to remove a directory.
  It should be calling rmdir() instead.

15 years agoFix use of virEventAddHandleImpl()
Jiri Denemark [Mon, 14 Dec 2009 15:09:01 +0000 (16:09 +0100)]
Fix use of virEventAddHandleImpl()

src/node_device/node_device_udev.c was using a function available only
on the daemon code, fix this and use the function available globally

* src/node_device/node_device_udev.c: replace use of virEventAddHandleImpl
  by virEventAddHandle

15 years agoCleanup temporary #define after use
Matthew Booth [Mon, 14 Dec 2009 15:05:45 +0000 (16:05 +0100)]
Cleanup temporary #define after use

* src/qemu/qemu_driver.c: #undef LOOKUP_PTYS after use in
  qemudFindCharDevicePTYsMonitor()

15 years agoImplement --pool option for virsh vol-path
Dave Allan [Mon, 14 Dec 2009 14:17:35 +0000 (15:17 +0100)]
Implement --pool option for virsh vol-path

This patch fixes the problem reported in:

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

The bug reporter says that vol-delete does not support the --pool
option, but that's not the case in the current head.  This patch makes
vol-path behave the same way as vol-delete

* tools/virsh.c: Modified vol-path to use the same logic as vol-delete,
  allowing the syntax: virsh vol-path --pool testdirpool testvol0

15 years agonodedev: Add removable storage 'media_label' prop
Cole Robinson [Mon, 14 Dec 2009 13:58:23 +0000 (14:58 +0100)]
nodedev: Add removable storage 'media_label' prop

Provides the CDROM label for current media. Only implemented for the
udev backend.

15 years agoexpose SR IOV physical/virtual function relationships
Dave Allan [Mon, 14 Dec 2009 13:44:12 +0000 (14:44 +0100)]
expose SR IOV physical/virtual function relationships

exposes the relationships between physical
and virtual functions on SR IOV capable devices.

15 years agoFix possible NULL pointer dereference
Paolo Bonzini [Mon, 14 Dec 2009 13:09:10 +0000 (14:09 +0100)]
Fix possible NULL pointer dereference

If there are no references remaining to the object, vm is set to NULL
and vm->persistent cannot be accessed.  Fixed by this trivial patch.

* src/qemu/qemu_driver.c (qemudDomainCoreDump): Avoid possible
  NULL pointer dereference on --crash dump.

15 years agoadd AppArmor test and examples to dist
Jamie Strandboge [Mon, 14 Dec 2009 12:40:42 +0000 (13:40 +0100)]
add AppArmor test and examples to dist

tests/virt-aa-helper-test and examples/apparmor are not included in
official tarballs, but should be. Attached is a patch to fix that
which works when apparmor is and is not available.

15 years agoadd --live support to "virsh dump"
Paolo Bonzini [Mon, 14 Dec 2009 11:10:38 +0000 (12:10 +0100)]
add --live support to "virsh dump"

This is trivial for QEMU since you just have to not stop the vm before
starting the dump.  And for Xen, you just pass the flag down to xend.

* include/libvirt/libvirt.h.in (virDomainCoreDumpFlags): Add VIR_DUMP_LIVE.
* src/qemu/qemu_driver.c (qemudDomainCoreDump): Support live dumping.
* src/xen/xend_internal.c (xenDaemonDomainCoreDump): Support live dumping.
* tools/virsh.c (opts_dump): Add --live. (cmdDump): Map it to VIR_DUMP_LIVE.

15 years agoadd --crash support to "virsh dump"
Paolo Bonzini [Mon, 14 Dec 2009 10:59:27 +0000 (11:59 +0100)]
add --crash support to "virsh dump"

This patch adds the --crash option (already present in "xm dump-core")
to "virsh dump".  virDomainCoreDump already has a flags argument, so
the API/ABI is untouched.

* include/libvirt/libvirt.h.in (virDomainCoreDumpFlags): New flag for
  CoreDump
* src/test/test_driver.c (testDomainCoreDump): Do not crash
  after dump unless VIR_DUMP_CRASH is given.
* src/qemu/qemu_driver.c (qemudDomainCoreDump): Shutdown the domain
  instead of restarting it if --crash is passed.
* src/xen/xend_internal.c (xenDaemonDomainCoreDump): Support --crash.
* tools/virsh.c (opts_dump): Add --crash.
  (cmdDump): Map it to flags for virDomainCoreDump and pass them.

15 years agofix various breakages in qemu Dump command
Paolo Bonzini [Mon, 14 Dec 2009 10:27:41 +0000 (11:27 +0100)]
fix various breakages in qemu Dump command

1) qemuMigrateToCommand uses ">>" so we have to truncate the file
before starting the migration;

2) the command wasn't updated to chown the driver and set/restore
the security lavels;

3) the VM does not have to be resumed if migration fails;

4) the file is not removed when migration fails.

* src/qemu/qemu_driver.c (qemuDomainCoreDump): Truncate file before
  dumping, set/restore ownership and security labels for the file.

15 years agoFix a couple of problems in last patch
Daniel Veillard [Mon, 14 Dec 2009 10:05:55 +0000 (11:05 +0100)]
Fix a couple of problems in last patch

Those were pointed by DanB in his review but not yet fixed

* src/qemu/qemu_driver.c: qemudWaitForMonitor() use EnterMonitorWithDriver()
  and ExitMonitorWithDriver() there
* src/qemu/qemu_monitor_text.c: checking fro strdu failure and hash
  table add error in qemuMonitorTextGetPtyPaths()

15 years agoGet QEMU pty paths from the monitor
Matthew Booth [Mon, 14 Dec 2009 09:50:01 +0000 (10:50 +0100)]
Get QEMU pty paths from the monitor

This change makes the QEMU driver get pty paths from the output of the
monitor 'info chardev' command. This output is structured, and contains
both the name of the device and the path on the same line. This is
considerably more reliable than parsing the startup log output, which
requires the parsing code to know which order QEMU will print pty
information in.

Note that we still need to parse the log output as the monitor itself
may be on a pty. This should be rare, however, and the new code will
replace all pty paths parsed by the log output method once the monitor
is available.

* src/qemu/qemu_monitor.(c|h) src/qemu_monitor_text.(c|h): Implement
  qemuMonitorGetPtyPaths().
* src/qemu/qemu_driver.c: Get pty path information using
  qemuMonitorGetPtyPaths().

15 years agoExtract the assigned pty device for QEmu channels
Matthew Booth [Mon, 14 Dec 2009 09:42:14 +0000 (10:42 +0100)]
Extract the assigned pty device for QEmu channels

* src/qemu/qemu_driver.c: Parse pty devices for channels

15 years agoMake QEMU driver use -chardev everywhere if available
Matthew Booth [Mon, 14 Dec 2009 09:38:44 +0000 (10:38 +0100)]
Make QEMU driver use -chardev everywhere if available

Change -monitor, -serial and -parallel output to use -chardev if it is
available.
* src/qemu/qemu_conf.c: Update qemudBuildCommandLine to use -chardev where
  available.
* tests/qemuxml2argvtest.c tests/qemuxml2argvdata/: Add -chardev equivalents
  for all current serial and parallel tests.

15 years agoSuppress cgroup error message on sucess startup
Ryota Ozaki [Mon, 14 Dec 2009 09:30:49 +0000 (10:30 +0100)]
Suppress cgroup error message on sucess startup

Even if qemudStartVMDaemon suceeds, an error was logged such as
'qemuRemoveCgroup:1778 : internal error Unable to find cgroup for'.
This is because qemudStartVMDaemon calls qemuRemoveCgroup to
ensure that old cgroup does not remain. This workaround makes
sense but leaving an error message may confuse users.
* src/qemu/qemu_driver.c: a an option to the function to suppress the
  error being logged

15 years agoFix reference leak in remoteDispatchStorageVolCreateXmlFrom
Matthias Bolte [Thu, 10 Dec 2009 23:56:04 +0000 (00:56 +0100)]
Fix reference leak in remoteDispatchStorageVolCreateXmlFrom

15 years agoFix memory leak in virStorageBackendCopyToFD
Matthias Bolte [Thu, 10 Dec 2009 23:54:49 +0000 (00:54 +0100)]
Fix memory leak in virStorageBackendCopyToFD

15 years agoFix 'make syntax-check' after iptables.c cleanup
Daniel Veillard [Fri, 11 Dec 2009 09:09:26 +0000 (10:09 +0100)]
Fix 'make syntax-check' after iptables.c cleanup

15 years agoretrieve paused/running state at migration start
Paolo Bonzini [Fri, 11 Dec 2009 09:06:05 +0000 (10:06 +0100)]
retrieve paused/running state at migration start

This patch fixes the bug where paused/running state is not
transmitted during migration.  As a result, in the QEMU driver
for example the machine was always started on the destination
end.

In order to do so, just read the state and if it is appropriate and
set the VIR_MIGRATE_PAUSED flag.

* src/libvirt.c (virDomainMigrateVersion1, virDomainMigrateVersion2):
  Automatically add VIR_MIGRATE_PAUSED when appropriate.
* src/xen/xend_internal.c (xenDaemonDomainMigratePerform): Give a nicer
  error message when migration of paused domains is attempted.

15 years agoadd virsh --suspend arg to migrate command
Paolo Bonzini [Fri, 11 Dec 2009 09:00:44 +0000 (10:00 +0100)]
add virsh --suspend arg to migrate command

This adds a new flag, VIR_MIGRATE_PAUSED, that mandates pausing
the migrated VM before starting it.

* include/libvirt/libvirt.h.in (virDomainMigrateFlags): Add VIR_MIGRATE_PAUSED.
* src/qemu/qemu_driver.c (qemudDomainMigrateFinish2): Handle VIR_MIGRATE_PAUSED.
* tools/virsh.c (opts_migrate): Add --suspend. (cmdMigrate): Handle it.
* tools/virsh.pod (migrate): Document it.

15 years agofix migration of paused vms upon failure
Paolo Bonzini [Fri, 11 Dec 2009 08:42:19 +0000 (09:42 +0100)]
fix migration of paused vms upon failure

This makes a small change on the failed-migration path.  Up to now,
all VMs that failed non-live migration after the "stop" command
were restarted.  This must not be done when the VM was paused in
the first place.

* src/qemu/qemu_driver.c (qemudDomainMigratePerform): Do not restart
  a paused VM that fails migration.  Set paused state after "stop",
  reset it after failure.

15 years agoSmall change of RNG syntax for domain
Diego Elio Pettenò [Fri, 11 Dec 2009 07:46:11 +0000 (08:46 +0100)]
Small change of RNG syntax for domain

* docs/schemas/domain.rng: As trang seems to bug with <optional><oneOrMore>
  replace it with <zeroOrMore>

15 years agoqemu driver: Fix segfault in libvirt/libvirtd when uri->path is NULL.
Richard Jones [Thu, 10 Dec 2009 16:39:07 +0000 (16:39 +0000)]
qemu driver: Fix segfault in libvirt/libvirtd when uri->path is NULL.

See also:
https://bugzilla.redhat.com/show_bug.cgi?id=545400#c1

15 years agoFix a wellformedness problem in secret.rng
Diego Elio Pettenò [Thu, 10 Dec 2009 16:03:47 +0000 (17:03 +0100)]
Fix a wellformedness problem in secret.rng

* docs/schemas/secret.rng: ref tag for usagevolume wasn't closed

15 years agoremove iptablesReloadRules() and related code
Mark McLoughlin [Thu, 10 Dec 2009 11:27:18 +0000 (11:27 +0000)]
remove iptablesReloadRules() and related code

We don't use this method of reloading rules anymore, so we can just
kill the code.

This simplifies things a lot because we no longer need to keep a
table of the rules we've added.

* src/util/iptables.c: kill iptablesReloadRules()

15 years agoremove all traces of lokkit support
Mark McLoughlin [Thu, 10 Dec 2009 11:27:17 +0000 (11:27 +0000)]
remove all traces of lokkit support

Long ago we tried to use Fedora's lokkit utility in order to register
our iptables rules so that 'service iptables restart' would
automatically load our rules.

There was one fatal flaw - if the user had configured iptables without
lokkit, then we would clobber that configuration by running lokkit.

We quickly disabled lokkit support, but never removed it. Let's do
that now.

The 'my virtual network stops working when I restart iptables' still
remains. For all the background on this saga, see:

  https://bugzilla.redhat.com/227011

* src/util/iptables.c: remove lokkit support

* configure.in: remove --enable-lokkit

* libvirt.spec.in: remove the dirs used only for saving rules for lokkit

* src/Makefile.am: ditto

* src/libvirt_private.syms, src/network/bridge_driver.c,
  src/util/iptables.h: remove references to iptablesSaveRules

15 years agoreload iptables rules on libvirtd restart
Mark McLoughlin [Thu, 10 Dec 2009 11:27:17 +0000 (11:27 +0000)]
reload iptables rules on libvirtd restart

This is the expected behaviour, I think - reloading libvirtd should
be a subset of restarting it.

Note, we reload the rules after we've determined which networks
are active (because we only add the rules for active networks)
and before we start autostart networks (to avoid re-adding the
rules).

* src/network/bridge_driver.c: reload iptables rules on startup

15 years agoreload iptables rules simply by re-adding them
Mark McLoughlin [Thu, 10 Dec 2009 11:27:17 +0000 (11:27 +0000)]
reload iptables rules simply by re-adding them

Currently, when we add iptables rules, we keep them on a list so that
we can easily reload them on e.g. 'service libvirtd reload'.

However, we don't save this list to disk, so if libvirtd is restarted
we lose the ability to reload the rules.

The fix is simple - just re-add the damn things on reload.

Note, we delete the rules before re-adding them, just like the current
behaviour of iptRulesReload().

* src/network/bridge_driver.c: re-add the iptables rules on reload.

15 years agoAdd virBufferFreeAndReset() and replace free()
Matthias Bolte [Wed, 9 Dec 2009 23:00:50 +0000 (00:00 +0100)]
Add virBufferFreeAndReset() and replace free()

Replace free(virBufferContentAndReset()) with virBufferFreeAndReset().
Update documentation and replace all remaining calls to free() with
calls to VIR_FREE(). Also add missing calls to virBufferFreeAndReset()
and virReportOOMError() in OOM error cases.

15 years agoPlumb domain description tag in xend backend
Jim Fehlig [Wed, 9 Dec 2009 14:25:31 +0000 (15:25 +0100)]
Plumb domain description tag in xend backend

xen-unstable changesets 20321 and 20521 added support for
description in xend domain config.  This patch extends that
support in xend backend.
* src/xen/xend_internal.c: add parse and output of domain description

15 years agoUpdate location of C# bindings.
Richard Jones [Wed, 9 Dec 2009 09:39:37 +0000 (09:39 +0000)]
Update location of C# bindings.

15 years agoMake QEMU text monitor parsing more robust
Daniel P. Berrange [Tue, 8 Dec 2009 18:05:02 +0000 (18:05 +0000)]
Make QEMU text monitor parsing more robust

The QEMU 0.10.0 release (and possibly other 0.10.x) has a bug where
it sometimes/often forgets to display the initial monitor greeting
line, soley printing a (qemu).  This in turn confuses the text
console parsing because it has a '(qemu)' it is not expecting. The
confusion results in a negative malloc. Bad things follow.

This re-writes the text console handling to be more robust. The key
idea is that it should only look for a (qemu), once it has seen the
original command echo'd back. This ensures it'll skip the bogus stray
(qemu) with broken QEMUs.

* src/qemu/qemu_monitor.c: Add some (disabled) debug code
* src/qemu/qemu_monitor_text.c: Re-write way command replies
  are detected

15 years agoFix virDomainObj ref handling in QEMU driver
Daniel P. Berrange [Tue, 8 Dec 2009 14:42:43 +0000 (14:42 +0000)]
Fix virDomainObj ref handling in QEMU driver

Since the monitor I/O is processed out of band from the main
thread(s) invoking monitor  commands, the virDomainObj may be
deleted by the I/O thread. The qemuDomainObjBeginJob takes an
extra reference to protect against final deletion, but this
reference is released by the corresponding EndJob call. THus
after the EndJob call it may not be valid to reference the
virDomainObj any more. To allow callers to detect this, the
EndJob call is changed to return the remaining reference count.

* src/conf/domain_conf.c: Make virDomainObjUnref return the
  remaining reference count
* src/qemu/qemu_driver.c: Avoid referencing virDomainObjPtr
  after qemuDomainObjEndJob if it has been deleted.

15 years agoFix the news file non-ascii characters
Daniel Veillard [Wed, 9 Dec 2009 10:16:48 +0000 (11:16 +0100)]
Fix the news file non-ascii characters

by adding an explicit HTML encoding meta description

15 years agoUse AM_PATH_PYTHON and python-config to detect Python configuration
Matthias Bolte [Sun, 6 Dec 2009 15:05:33 +0000 (16:05 +0100)]
Use AM_PATH_PYTHON and python-config to detect Python configuration

Using AM_PATH_PYTHON solves the site-packages directory problem. At least
in Ubuntu with Python 2.6 and later site-packages is renamed to dist-packages
and site-packages is not part of sys.path anymore. So installing the libvirt
Python bindings to site-packages renders them unusable, because they can be
imported from there without manually including site-packages into sys.path.

AM_PATH_PYTHON detects the correct site-packages/dist-packages directory.

python-config --includes gives the correct include path for the Python header
files. The old probing code stays there as fallback mechanism.

* configure.in: use AM_PATH_PYTHON and python-config
* python/Makefile.am: remove -I because PYTHON_INCLUDES contains it now

15 years agoAdd missing commas to the 0.7.4 news section
Matthias Bolte [Sun, 22 Nov 2009 19:40:04 +0000 (20:40 +0100)]
Add missing commas to the 0.7.4 news section

15 years agoChange generated HTML to UTF-8 encoding
Daniel Veillard [Tue, 8 Dec 2009 15:09:33 +0000 (16:09 +0100)]
Change generated HTML to UTF-8 encoding

* docs/ChangeLog.xsl docs/newapi.xsl docs/site.xsl: change all
  stylesheets to output UTF-8 HTML instead of ISO Latin 1 which was
  breaking on some people names.

15 years agoAvoid an type-punned pointer aliasing pbm
Daniel Veillard [Tue, 8 Dec 2009 10:14:55 +0000 (11:14 +0100)]
Avoid an type-punned pointer aliasing pbm

Fix this warning, there is no need to use an intermediate,
different array pointer.
network.c: In function 'getIPv6Addr':
network.c:50: warning: dereferencing type-punned pointer will break strict-aliasing rules
* src/util/network.c: avoid an intermediary pointer cast

15 years agoHook up JSON monitor to emit basic lifecycle events
Daniel P. Berrange [Thu, 26 Nov 2009 13:06:24 +0000 (13:06 +0000)]
Hook up JSON monitor to emit basic lifecycle events

* src/qemu/qemu_monitor_json.c: Hook up reset, shutdown,
  poweroff and stop events

15 years agoAdd QEMU monitor callbacks for basic lifecycle events
Daniel P. Berrange [Thu, 26 Nov 2009 13:05:24 +0000 (13:05 +0000)]
Add QEMU monitor callbacks for basic lifecycle events

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add callbacks
  for reset, shutdown, poweroff and stop events. Add convenience
  methods for emiting those events

15 years agoSwitch over to passing a callback table to QEMU monitor
Daniel P. Berrange [Thu, 15 Oct 2009 17:56:52 +0000 (18:56 +0100)]
Switch over to passing a callback table to QEMU monitor

With addition of events there will be alot of callbacks.
To avoid having to add many APIs to register callbacks,
provide them all at once in a big table

* src/qemu/qemu_driver.c: Pass in a callback table to QEMU
  monitor code
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h Replace
  the EOF and disk secret callbacks with a callback table

15 years agoSupport for JSON mode monitor
Daniel P. Berrange [Tue, 3 Nov 2009 18:59:18 +0000 (13:59 -0500)]
Support for JSON mode monitor

Initial support for the new QEMU monitor protocol  using JSON
as the data encoding format instead of plain text

* po/POTFILES.in: Add src/qemu/qemu_monitor_json.c
* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Hack to turn on QMP
  mode. Replace with a version number check on >= 0.12 later
* src/qemu/qemu_monitor.c: Delegate to json monitor if enabled
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h: Add
  impl of QMP protocol
* src/Makefile.am: Add src/qemu/qemu_monitor_json.{c,h}

15 years agoIntroduce callbacks for serializing domain object private data to XML
Daniel P. Berrange [Thu, 26 Nov 2009 17:57:00 +0000 (17:57 +0000)]
Introduce callbacks for serializing domain object private data to XML

Now that drivers are using a private domain object state blob,
the virDomainObjFormat/Parse methods are no longer able to
directly serialize all neccessary state to/from XML. It is
thus neccessary to introduce a pair of callbacks fo serializing
private state.

The code for serializing vCPU PIDs and the monitor device
config can now move out of domain_conf.c and into the
qemu_driver.c where they belong.

* src/conf/capabilities.h: Add callbacks for serializing private
  state to/from XML
* src/conf/domain_conf.c, src/conf/domain_conf.h: Remove the
  monitor, monitor_chr, monitorWatch, nvcpupids and vcpupids
  fields from virDomainObjPtr. Remove code that serialized
  those fields
* src/libvirt_private.syms: Export virXPathBoolean
* src/qemu/qemu_driver.c: Add callbacks for serializing monitor
  and vcpupid data to/from XML
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Pass monitor
  char device config into qemuMonitorOpen directly.

15 years agoSwitch LXC driver to use a private data blob for virDomainObj state
Daniel P. Berrange [Thu, 26 Nov 2009 17:56:01 +0000 (17:56 +0000)]
Switch LXC driver to use a private data blob for virDomainObj state

* src/lxc/lxc_driver.c: Introduce lxcDomainObjPrivate for storing
  monitor device state

15 years agoSwitch UML driver to use a private data blob for virDomainObj state
Daniel P. Berrange [Thu, 26 Nov 2009 17:55:12 +0000 (17:55 +0000)]
Switch UML driver to use a private data blob for virDomainObj state

* src/uml/uml_driver.c: Introduce umlDomainObjPrivateData for storing
  monitor device state. Remove unneccessary VIR_FREE on vcpupids

15 years agoPull code to start CPUs executing out of qemudInitCpuAffinity()
Daniel P. Berrange [Thu, 26 Nov 2009 13:51:42 +0000 (13:51 +0000)]
Pull code to start CPUs executing out of qemudInitCpuAffinity()

The code to start CPUs executing has nothing todo with CPU
affinity masks, so pull it out of the qemudInitCpuAffinity()
method and up into qemudStartVMDaemon()

* src/qemu/qemu_driver.c: Pull code to start CPUs executing out
  of qemudInitCpuAffinity()

15 years agoAdd a 'format' arg to qemuMonitorChangeMedia() since JSON will support it
Daniel P. Berrange [Thu, 26 Nov 2009 13:48:17 +0000 (13:48 +0000)]
Add a 'format' arg to qemuMonitorChangeMedia() since JSON will support it

The current QEMU disk media change does not support setting the
disk format. The new JSON monitor will support this, so add an
extra parameter to pass this info in

* src/qemu/qemu_driver.c: Pass in disk format when changing media
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c,
  src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
  Add a 'format' arg to qemuMonitorChangeMedia()

15 years agoFix migration cancellation for QEMU
Daniel P. Berrange [Thu, 26 Nov 2009 13:39:30 +0000 (13:39 +0000)]
Fix migration cancellation for QEMU

* src/qemu/qemu_monitor_text.c: Add missing underscore in the
  migrate_cancel monitor command impl