]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
14 years agoFix Xen SEXPR generation to properly quote strings containing ()
Daniel P. Berrange [Mon, 23 Aug 2010 13:00:22 +0000 (14:00 +0100)]
Fix Xen SEXPR generation to properly quote strings containing ()

* src/xen/sexpr.c: Ensure () are escaped in sexpr2string
* tests/sexpr2xmldata/sexpr2xml-boot-grub.sexpr,
  tests/sexpr2xmldata/sexpr2xml-boot-grub.xml,
  tests/xml2sexprdata/xml2sexpr-boot-grub.sexpr,
  tests/xml2sexprdata/xml2sexpr-boot-grub.xml: Data files to
  check escaping
* tests/sexpr2xmltest.c, tests/xml2sexprtest.c: Add boot-grub
  escaping test case

14 years agonwfilter: resolve deadlock between VM ops and filter update
Stefan Berger [Wed, 13 Oct 2010 14:33:26 +0000 (10:33 -0400)]
nwfilter: resolve deadlock between VM ops and filter update

 This is from a bug report and conversation on IRC where Soren reported that while a filter update is occurring on one or more VMs (due to a rule having been edited for example), a deadlock can occur when a VM referencing a filter is started.

The problem is caused by the two locking sequences of

qemu driver, qemu domain, filter             # for the VM start operation
filter, qemu_driver, qemu_domain            # for the filter update operation

that obviously don't lock in the same order. The problem is the 2nd lock sequence. Here the qemu_driver lock is being grabbed in qemu_driver:qemudVMFilterRebuild()

The following solution is based on the idea of trying to re-arrange the 2nd sequence of locks as follows:

qemu_driver, filter, qemu_driver, qemu_domain

and making the qemu driver recursively lockable so that a second lock can occur, this would then lead to the following net-locking sequence

qemu_driver, filter, qemu_domain

where the 2nd qemu_driver lock has been ( logically ) eliminated.

The 2nd part of the idea is that the sequence of locks (filter, qemu_domain) and (qemu_domain, filter) becomes interchangeable if all code paths where filter AND qemu_domain are locked have a preceding qemu_domain lock that basically blocks their concurrent execution

So, the following code paths exist towards qemu_driver:qemudVMFilterRebuild where we now want to put a qemu_driver lock in front of the filter lock.

-> nwfilterUndefine()   [ locks the filter ]
    -> virNWFilterTestUnassignDef()
        -> virNWFilterTriggerVMFilterRebuild()
            -> qemudVMFilterRebuild()

-> nwfilterDefine()
    -> virNWFilterPoolAssignDef() [ locks the filter ]
        -> virNWFilterTriggerVMFilterRebuild()
            -> qemudVMFilterRebuild()

-> nwfilterDriverReload()
    -> virNWFilterPoolLoadAllConfigs()
        ->virNWFilterPoolObjLoad()
            -> virNWFilterPoolAssignDef() [ locks the filter ]
                -> virNWFilterTriggerVMFilterRebuild()
                    -> qemudVMFilterRebuild()

-> nwfilterDriverStartup()
    -> virNWFilterPoolLoadAllConfigs()
        ->virNWFilterPoolObjLoad()
            -> virNWFilterPoolAssignDef() [ locks the filter ]
                -> virNWFilterTriggerVMFilterRebuild()
                    -> qemudVMFilterRebuild()

Qemu is not the only driver using the nwfilter driver, but also the UML driver calls into it. Therefore qemuVMFilterRebuild() can be exchanged with umlVMFilterRebuild() along with the driver lock of qemu_driver that can now be a uml_driver. Further, since UML and Qemu domains can be running on the same machine, the triggering of a rebuild of the filter can touch both types of drivers and their domains.

In the patch below I am now extending each nwfilter callback driver with functions for locking and unlocking the (VM) driver (UML, QEMU) and introduce new functions for locking all registered callback drivers and unlocking them. Then I am distributing the lock-all-cbdrivers/unlock-all-cbdrivers call into the above call paths. The last shown callpath starting with nwfilterDriverStart() is problematic since it is initialize before the Qemu and UML drives are and thus a lock in the path would result in a NULL pointer attempted to be locked -- the call to virNWFilterTriggerVMFilterRebuild() is never called, so we never lock either the qemu_driver or the uml_driver in that path. Therefore, only the first 3 paths now receive calls to lock and unlock all callback drivers. Now that the locks are distributed where it matters I can remove the qemu_driver and uml_driver lock from qemudVMFilterRebuild() and umlVMFilterRebuild() and not requiring the recursive locks.

For now I want to put this out as an RFC patch. I have tested it by 'stretching' the critical section after the define/undefine functions each lock the filter so I can (easily) concurrently execute another VM operation (suspend,start). That code is in this patch and if you want you can de-activate it. It seems to work ok and operations are being blocked while the update is being done.
I still also want to verify the other assumption above that locking filter and qemu_domain always has a preceding qemu_driver lock.

14 years agovirsh: update comment about parsing
Eric Blake [Tue, 12 Oct 2010 22:23:18 +0000 (16:23 -0600)]
virsh: update comment about parsing

* tools/virsh.c: Update comments to match patch series.

14 years agovirsh: move code into topological order
Eric Blake [Tue, 12 Oct 2010 22:01:02 +0000 (16:01 -0600)]
virsh: move code into topological order

* tools/virsh.c (vshCommandParse): Float up, to avoid the need for
a forward declaration.

14 years agovirsh: simplify top-level option parsing
Eric Blake [Tue, 12 Oct 2010 21:49:13 +0000 (15:49 -0600)]
virsh: simplify top-level option parsing

This makes 'virsh --conn test:///default help help' work right;
previously, the abbreviation confused our hand-rolled option parsing.

* tools/virsh.c (vshParseArgv): Use getopt_long feature, rather
than (incorrectly) reparsing options ourselves.

14 years agovirsh: add -- support
Lai Jiangshan [Tue, 12 Oct 2010 07:14:22 +0000 (15:14 +0800)]
virsh: add -- support

"--" means no option at the following arguments.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
14 years agovirsh: support single quote
Lai Jiangshan [Tue, 12 Oct 2010 07:14:17 +0000 (15:14 +0800)]
virsh: support single quote

Some users may type command like this at the virsh shell:
virsh # somecmd 'some arg'

because they often use single quote in linux shell.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
14 years agovirsh: add escaper \ for command string parsing
Lai Jiangshan [Tue, 12 Oct 2010 07:14:10 +0000 (15:14 +0800)]
virsh: add escaper \ for command string parsing

add escaper \ for command string parsing, example:

virsh # cd /path/which/have/a/double\"quote

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
14 years agovirsh: document options in man page
Eric Blake [Tue, 12 Oct 2010 20:49:28 +0000 (14:49 -0600)]
virsh: document options in man page

* tools/virsh.pod: Document top-level options.

14 years agovirsh: rework command parsing
Lai Jiangshan [Tue, 12 Oct 2010 07:14:01 +0000 (15:14 +0800)]
virsh: rework command parsing

Old virsh command parsing mashes all the args back into a string and
miss the quotes, this patches fix it. It is also needed for introducing
qemu-monitor-command which is very useful.

This patches uses the new vshCommandParser abstraction and adds
vshCommandArgvParse() for arguments vector, so we don't need
to mash arguments vector into a command sting.

And the usage was changed:
old:
virsh [options] [commands]

new:
virsh [options]... [<command_string>]
virsh [options]... <command> [args...]

So we still support commands like:
"define D.xml; dumpxml D" was parsed as a commands-string.

and support commands like:
we will not mash them into a string, we use new argv parser for it.

But we don't support the command like:
"define D.xml; dumpxml" was parsed as a command-name, but we have no such command-name.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
14 years agovirsh: add vshCommandParser abstraction
Lai Jiangshan [Tue, 12 Oct 2010 07:13:50 +0000 (15:13 +0800)]
virsh: add vshCommandParser abstraction

add vshCommandParser and make vshCommandParse() accept different
parsers.

the current code for parse command string is integrated as
vshCommandStringParse().

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
14 years agovirsh: better handling the boolean option
Lai Jiangshan [Tue, 12 Oct 2010 07:13:39 +0000 (15:13 +0800)]
virsh: better handling the boolean option

in old code the following commands are equivalent:
     virsh # dumpxml --update-cpu=vm1
     virsh # dumpxml --update-cpu vm1
because the old code split the option argument into 2 parts:
--update-cpu=vm1 is split into update-cpu and vm1,
and update-cpu is a boolean option, so the parser takes vm1 as another
argument, very strange.

after this patch applied, the first one will become illegal.

To achieve this, we don't parse/check options when parsing command sting,
but check options when parsing a command argument. And the argument is
not split when parsing command sting.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
14 years agovirsh: allow zero length arguments
Lai Jiangshan [Tue, 12 Oct 2010 07:13:28 +0000 (15:13 +0800)]
virsh: allow zero length arguments

the following command is allowed at shell, we also make it allowed at virsh shell.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
14 years agovirsh: poison raw allocation routines
Eric Blake [Tue, 12 Oct 2010 17:24:00 +0000 (11:24 -0600)]
virsh: poison raw allocation routines

* tools/virsh.c (malloc, calloc, realloc, strdup): Enforce that
within this file, we use the safe vsh wrappers instead.
(cmdNodeListDevices, cmdSnapshotCreate, main): Fix violations of
this policy.

14 years agovirsh: better support double quote
Lai Jiangshan [Tue, 12 Oct 2010 07:13:16 +0000 (15:13 +0800)]
virsh: better support double quote

In origin code, double quote is only allowed at the begin or end
"complicated argument"
--some_opt="complicated string"  (we split this argument into 2 parts,
option and data, the data is "complicated string").

This patch makes it allow double quote at any position of
an argument:
complicated" argument"
complicated" "argument
--"some opt=complicated string"

This patch is also needed for the following patches,
the following patches will not split option argument into 2 parts,
so we have to allow double quote at any position of an argument.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
14 years agoDon't fail on missing D-Bus
Guido Günther [Wed, 13 Oct 2010 07:07:48 +0000 (09:07 +0200)]
Don't fail on missing D-Bus

We don't fail when we can't contact HAL so we shouldn't fail if we can't
contact D-Bus either.

14 years agoFixes for documentation extraction
Daniel Veillard [Wed, 13 Oct 2010 10:19:02 +0000 (12:19 +0200)]
Fixes for documentation extraction

* include/libvirt/libvirt.h.in: some of the function type description
  were broken so they could not be automatically documented
* src/util/event.c docs/apibuild.py: event.c exports one public API
  so it needs to be scanned too, avoid a few warnings

14 years agoImplement support for virtio plan9fs filesystem passthrough in QEMU
Daniel P. Berrange [Wed, 2 Jun 2010 14:05:09 +0000 (15:05 +0100)]
Implement support for virtio plan9fs filesystem passthrough in QEMU

Make use of the existing <filesystem> element to support plan9fs
filesystem passthrough in the QEMU driver

    <filesystem type='mount'>
      <source dir='/export/to/guest'/>
      <target dir='/import/from/host'/>
    </filesystem>

NB, the target is not actually a directory, it is merely a arbitrary
string tag that is exported to the guest as a hint for where to mount
it.

14 years agoAdd todo.pl and config example to EXTRA_DIST
Daniel P. Berrange [Wed, 13 Oct 2010 09:58:11 +0000 (10:58 +0100)]
Add todo.pl and config example to EXTRA_DIST

* docs/Makefile.am: Add todo.pl and todo.cfg-example to EXTRA_DIST

14 years agoFix several minor problems introduced by the memtune series
Matthias Bolte [Tue, 12 Oct 2010 19:24:11 +0000 (21:24 +0200)]
Fix several minor problems introduced by the memtune series

Add proper documentation to the new VIR_DOMAIN_MEMORY_* macros in
libvirt.h.in to placate apibuild.py.

Mark args as unused in for libvirt_virDomain{Get,Set}MemoryParameters
in the Python bindings and add both to the libvirtMethods array.

Update remote_protocol-structs to placate make syntax-check.

Undo unintended modifications in vboxDomainGetInfo.

Update the function table of the VirtualBox and XenAPI drivers.

14 years agoRemote protocol implementation of virDomainSet/GetMemoryParameters
Nikunj A. Dadhania [Tue, 12 Oct 2010 17:23:04 +0000 (19:23 +0200)]
Remote protocol implementation of virDomainSet/GetMemoryParameters

14 years agoAdding memtune command to virsh tool
Nikunj A. Dadhania [Tue, 12 Oct 2010 16:56:49 +0000 (18:56 +0200)]
Adding memtune command to virsh tool

The command helps to control the memory/swap parameters for the system, for
eg. hard_limit (max memory the vm can use), soft_limit (limit during memory
contention), swap_hard_limit(max swap the vm can use)

14 years agoAvoid checking against strncpy in virsh.c
Daniel Veillard [Tue, 12 Oct 2010 16:55:47 +0000 (18:55 +0200)]
Avoid checking against strncpy in virsh.c

since the replacement function virStrcpy is not available

14 years agoImplement domainGetMemoryParamters for LXC
Nikunj A. Dadhania [Tue, 12 Oct 2010 16:39:05 +0000 (18:39 +0200)]
Implement domainGetMemoryParamters for LXC

Driver interface for getting memory parameters, eg. hard_limit,
soft_limit and swap_hard_limit.

14 years agoImplement domainSetMemoryParamters for LXC
Nikunj A. Dadhania [Tue, 12 Oct 2010 16:31:19 +0000 (18:31 +0200)]
Implement domainSetMemoryParamters for LXC

Add support in the lxc driver for various memory controllable parameters

14 years agoAdding memtunables to libvirt-lxc command
Nikunj A. Dadhania [Tue, 12 Oct 2010 16:14:44 +0000 (18:14 +0200)]
Adding memtunables to libvirt-lxc command

libvirt-lxc now configures the hardlimit, softlimit and swaplimit, if
specified in the domain xml file or picks up the defaults.

14 years agoAdding memtunables to qemuSetupCgroup
Nikunj A. Dadhania [Tue, 12 Oct 2010 16:12:31 +0000 (18:12 +0200)]
Adding memtunables to qemuSetupCgroup

QEmu startup will pick up the memory tunables specified in the domain
configuration file

14 years agoImplement domainGetMemoryParamters for QEmu
Nikunj A. Dadhania [Tue, 12 Oct 2010 15:50:36 +0000 (17:50 +0200)]
Implement domainGetMemoryParamters for QEmu

Driver interface for getting memory parameters, eg. hard_limit,
soft_limit and swap_hard_limit based on cgroup support

14 years agoImplement domainSetMemoryParamters for QEmu
Nikunj A. Dadhania [Tue, 12 Oct 2010 15:24:54 +0000 (17:24 +0200)]
Implement domainSetMemoryParamters for QEmu

Driver interface for setting memory hard_limit, soft_limit and swap
hard_limit based on cgroup support

14 years agoImplement cgroup memory controller tunables
Nikunj A. Dadhania [Tue, 12 Oct 2010 14:50:53 +0000 (16:50 +0200)]
Implement cgroup memory controller tunables

Provides interfaces for setting/getting memory tunables like hard_limit,
soft_limit and swap_hard_limit

14 years agoXML parsing for memory tunables
Nikunj A. Dadhania [Tue, 12 Oct 2010 14:43:39 +0000 (16:43 +0200)]
XML parsing for memory tunables

Adding parsing code for memory tunables in the domain xml file
also change the internal define structures used for domain memory
informations
Adds a new specific test

14 years agoCleanup some tabs issues
Daniel Veillard [Tue, 12 Oct 2010 14:12:08 +0000 (16:12 +0200)]
Cleanup some tabs issues

14 years agoAdds xml entries for memory tunables in domain schema
Nikunj A. Dadhania [Tue, 12 Oct 2010 14:06:55 +0000 (16:06 +0200)]
Adds xml entries for memory tunables in domain schema

The patch adds xml entries to the domain.rng file.

v2:
+ Fix typo min_guarantee

14 years agoAdding virDomainSetMemoryParameters and virDomainGetMemoryParameters API
Nikunj A. Dadhania [Tue, 12 Oct 2010 14:03:24 +0000 (16:03 +0200)]
Adding virDomainSetMemoryParameters and virDomainGetMemoryParameters API

Public api to set/get memory tunables supported by the hypervisors.

dv:
* some cleanups in libvirt.c
* adding extra checks in libvirt.c new entry points

v4:
* Move exporting public API to this patch
* Add unsigned int flags to the public api for future extensions

v3:
* Add domainGetMemoryParamters and NULL in all the driver interface

v2:
* Initialize domainSetMemoryParameters to NULL in all the driver
  interface structure.

14 years agoAdding structure and defines for virDomainSet/GetMemoryParameters
Nikunj A. Dadhania [Tue, 12 Oct 2010 13:43:27 +0000 (15:43 +0200)]
Adding structure and defines for virDomainSet/GetMemoryParameters

This patch adds a structure virMemoryParameter, it contains the name of
the
parameter and the type of the parameter along with a union.

dv:
+ rename enums to VIR_DOMAIN_MEMORY_PARAM_*
+ remove some extraneous tabs

v4:
+ Add unsigned int flags to the public api for future extensions

v3:
+ Protoype for virDomainGetMemoryParameters and dummy python binding.

v2:
+ Includes dummy python bindings for the library to build cleanly.
+ Define string constants like "hard_limit", etc.
+ re-order this patch.

14 years agocpu: Remove redundant features
Jiri Denemark [Mon, 11 Oct 2010 08:57:04 +0000 (10:57 +0200)]
cpu: Remove redundant features

Some features provided by the recently added CPU models were mentioned
twice for each model. This was a result of automatic generation of the
XML from qemu's CPU configuration file without noticing this redundancy.

14 years agoutil: add missing export
Eric Blake [Tue, 12 Oct 2010 11:35:25 +0000 (05:35 -0600)]
util: add missing export

Commit 1fe2927a3 forgot to export a symbol.

* src/libvirt_private.syms (virHexToBin): Add.
* src/.gitignore: Ignore temporary file.

14 years agoSet sensible defaults for cpu match and feature policy
Daniel P. Berrange [Wed, 22 Sep 2010 11:47:48 +0000 (12:47 +0100)]
Set sensible defaults for cpu match and feature policy

To enable the CPU XML from the capabilities to be pasted directly
into the guest XML with no editing, pick a sensible default for
match and feature policy. The CPU match will be exact and the
feature policy will be require. This should ensure safety for
migration and give DWIM semantics for users

* src/conf/cpu_conf.c: Default to exact match and require policy
* docs/formatdomain.html.in: Document new defaults

14 years agoAdd automatic generation of a todo item page
Daniel P. Berrange [Tue, 21 Sep 2010 15:40:32 +0000 (16:40 +0100)]
Add automatic generation of a todo item page

This adds a script to generate the todo item page from
bugzilla. This requires a valid username+password for
bugzilla, so it is intended that this only be run on
the libvirt.org website via cron. Normal usage will just
generate an empty stub page.

* docs/todo.pl: Script to extract todo items from bugzilla
* docs/todo.cfg-example: Example config file
* docs/sitemap.html.in: Add todo page
* docs/Makefile.am: Generation rules for todo items

14 years agoxen: Fix virDomain{At,De}tachDevice
Jiri Denemark [Fri, 1 Oct 2010 14:45:55 +0000 (16:45 +0200)]
xen: Fix virDomain{At,De}tachDevice

According to API documentation virDomain{At,De}tachDevice calls are
supposed to only work on active guests for device hotplug. For anything
beyond that, their *Flags variants have to be used.

Despite the variant which was acked on libvirt mailing list
(https://www.redhat.com/archives/libvir-list/2010-January/msg00385.html)
commit ed9c14a7ef86d7a45a6d57cbfee5410fca428633 (by Jim Fehlig)
introduced automagic behavior of these API calls for xen driver. Since
January, these calls always change persistent configuration of a guest
and if the guest is currently active, they also hot(un)plug the device.

That change didn't follow API documentation and also broke device
hot(un)plug for older xend implementations which do not support changing
persistent configuration of a guest and hot(un)plugging in one step.

This patch should not break anything for active guests. On the other
hand, changing inactive guests is not supported any more.

14 years agoxen: xenXMDomain*DeviceFlags should obey all flags
Jiri Denemark [Fri, 1 Oct 2010 14:37:53 +0000 (16:37 +0200)]
xen: xenXMDomain*DeviceFlags should obey all flags

xenXMDomain*DeviceFlags() silently ignores requests to modify live
configuration of an active guest while still touching its persistent
configuration.

14 years agoxen: Fix logic bug in xenDaemon*DeviceFlags
Jiri Denemark [Fri, 1 Oct 2010 14:31:04 +0000 (16:31 +0200)]
xen: Fix logic bug in xenDaemon*DeviceFlags

14 years agoxen: Make xenDaemon*DeviceFlags errors less confusing
Jiri Denemark [Fri, 1 Oct 2010 14:22:29 +0000 (16:22 +0200)]
xen: Make xenDaemon*DeviceFlags errors less confusing

When a user calls to virDomain{Attach,Detach,Update}DeviceFlags() with
flags == VIR_DOMAIN_DEVICE_MODIFY_LIVE on an inactive guest running on
an old Xen hypervisor (such as RHEL-5) xend_internal driver reports:

    Xend version does not support modifying persistent config

which is pretty confusing since no-one requested to modify persistent
config.

14 years agoReturn a suitable error message if we can't find a matching emulator
Guido Günther [Fri, 8 Oct 2010 12:16:46 +0000 (14:16 +0200)]
Return a suitable error message if we can't find a matching emulator

14 years agoPass -n to ip(6)tables
Guido Günther [Fri, 8 Oct 2010 14:35:03 +0000 (16:35 +0200)]
Pass -n to ip(6)tables

to avoid long timeouts waiting for DNS servers

14 years agonwfilter: Add 2nd example to the html docs
Stefan Berger [Thu, 7 Oct 2010 10:50:26 +0000 (06:50 -0400)]
nwfilter: Add 2nd example to the html docs

This patch adds another example to the nwfilter html page and provides 2 solutions for how to write a filter meeting the given requirements using newly added features.

14 years agonwfilter: Extend docs with info about the state attribute
Stefan Berger [Thu, 7 Oct 2010 10:45:46 +0000 (06:45 -0400)]
nwfilter: Extend docs with info about the state attribute

I am adding a row with information about the newly supported state
attribute to each of the tables describing supported attributes of protocols.

14 years agonwfilter: Extend schema to accept state attribute
Stefan Berger [Thu, 7 Oct 2010 10:44:41 +0000 (06:44 -0400)]
nwfilter: Extend schema to accept state attribute

Extend the nwfilter.rng schema to accept state attribute.

14 years agonwfilter: Add test case for testing the state attribute
Stefan Berger [Thu, 7 Oct 2010 10:43:35 +0000 (06:43 -0400)]
nwfilter: Add test case for testing the state attribute

This patch adds a test case for testing the XML parser's and instantiator's
support of the state attribute. The other test case tests existing
capabilities. Both test cases will be used in TCK again.

14 years agonwfilter: Instantiate state match in ip(6)tables rules
Stefan Berger [Thu, 7 Oct 2010 10:41:37 +0000 (06:41 -0400)]
nwfilter: Instantiate state match in ip(6)tables rules

In this patch I am extending the rule instantiator to create the state
match according to the state attribute in the XML. Only one iptables
rule in the incoming or outgoing direction will be created for a rule
in direction 'in' or 'out' respectively. A rule in direction 'inout' does
get iptables rules in both directions.

14 years agonwfilter: Extend XML parser and gen. to support state attr.
Stefan Berger [Thu, 7 Oct 2010 10:37:31 +0000 (06:37 -0400)]
nwfilter: Extend XML parser and gen. to support state attr.

The patch below extends the XML parser and generator so that every l3 protocol
now can have a state attribute.

14 years agobuild: require pkg-config for bootstrap
Eric Blake [Tue, 5 Oct 2010 15:10:31 +0000 (09:10 -0600)]
build: require pkg-config for bootstrap

* .gnulib: Update to latest, for bootstrap fixes.
* bootstrap: Synchronize with upstream.
* bootstrap.conf: Add pkg-config pre-requisite.
* autogen.sh: Tweak wording message.
Reported by Justin Clift, and with feedback from Bruno Haible.

14 years agoxen: Fix bogus error when attaching a device
Jiri Denemark [Tue, 5 Oct 2010 11:39:37 +0000 (13:39 +0200)]
xen: Fix bogus error when attaching a device

The xm internal xen driver only supports disk and network devices to be
added to a guest. On an attempt to attach any other device the xm driver
used VIR_ERR_XML_ERROR which resulted in a completely bogus error
message:

error: Failed to attach device from pci.xml
error: XML description for unknown device is not well formed or invalid

14 years agoconfigure: disable network and storage-fs drivers on mac os x
Justin Clift [Tue, 5 Oct 2010 01:31:05 +0000 (12:31 +1100)]
configure: disable network and storage-fs drivers on mac os x

Disabling these two drivers on MacOS X, where they are known to
not work, allows libvirt (including the daemon) to compile without
any further changes.

14 years agonwfilter: fix memory leaks
Stefan Berger [Mon, 4 Oct 2010 10:34:05 +0000 (06:34 -0400)]
nwfilter: fix memory leaks

Fixing memory leak shown by valgrind and freeing buffer in two more places.

14 years agoesx: Add support for virtual serial device network backing
Matthias Bolte [Wed, 29 Sep 2010 21:04:19 +0000 (23:04 +0200)]
esx: Add support for virtual serial device network backing

Since version 4.1 ESX(i) can expose virtual serial devices over TCP.

Add support in the VMX handling code for this, add test cases to cover
it and add links to some documentation.

ESX supports two additional protocols: TELNETS and TLS. Add them to
the list of serial-over-TCP protocols.

14 years agovcpu: improve cpuset attribute
Eric Blake [Mon, 27 Sep 2010 23:29:13 +0000 (17:29 -0600)]
vcpu: improve cpuset attribute

The <vcpu cpuset=...> attribute has been available since commit
e193b5dd, but without documentation or RNG validation.

* docs/schemas/domain.rng (vcpu): Further validate cpuset.
* docs/formatdomain.html.in: Document it.
* src/conf/domain_conf.c: Fix typos.

14 years agophyp: Verify that domain XML contains at least one disk element
Matthias Bolte [Thu, 30 Sep 2010 19:13:29 +0000 (21:13 +0200)]
phyp: Verify that domain XML contains at least one disk element

phypBuildLpar expects that at least one disk element is provided.

14 years agovirt-aa-helper-test cleanups
Jamie Strandboge [Thu, 30 Sep 2010 21:01:36 +0000 (15:01 -0600)]
virt-aa-helper-test cleanups

Don't cat | sed, just sed.  Suggested by Eric Blake.

14 years agoimplement usb and pci hot attach in AppArmor driver
Jamie Strandboge [Thu, 30 Sep 2010 20:54:56 +0000 (14:54 -0600)]
implement usb and pci hot attach in AppArmor driver

Description: Implement AppArmorSetSecurityHostdevLabel() and
AppArmorRestoreSecurityHostdevLabel() for hostdev and pcidev attach.

virt-aa-helper also has to be adjusted because *FileIterate() is used for pci
and usb devices and the corresponding XML for hot attached hostdev and pcidev
is not in the XML passed to virt-aa-helper. The new '-F filename' option is
added to append a rule to the profile as opposed to the existing '-f
filename', which rewrites the libvirt-<uuid>.files file anew. This new '-F'
option will append a rule to an existing libvirt-<uuid>.files if it exists,
otherwise it acts the same as '-f'.

load_profile() and reload_profile() have been adjusted to add an 'append'
argument, which when true will use '-F' instead of '-f' when executing
virt-aa-helper.

All existing calls to load_profile() and reload_profile() have been adjusted
to use the old behavior (ie append==false) except AppArmorSetSavedStateLabel()
where it made sense to use the new behavior.

This patch also adds tests for '-F'.

Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/640993

14 years agonwfilter: Add a test case for testing the comment attribute
Stefan Berger [Thu, 30 Sep 2010 20:09:04 +0000 (16:09 -0400)]
nwfilter: Add a test case for testing the comment attribute

This patch adds a test case for testing the XML parser's and instantiator's
support of the comment attribute.

14 years agonwfilter: Extend docs with information about comment attr.
Stefan Berger [Thu, 30 Sep 2010 20:01:51 +0000 (16:01 -0400)]
nwfilter: Extend docs with information about comment attr.

I am adding a row with information about the newly supported comment
attribute to each of the tables describing supported attributes of protocols.

14 years agonwfilter: Extend nwfilter schema to accept comment attrib.
Stefan Berger [Thu, 30 Sep 2010 20:00:11 +0000 (16:00 -0400)]
nwfilter: Extend nwfilter schema to accept comment attrib.

Extend the nwfilter.rng schema to accept comment attributes for all protocol
types.

14 years agonwfilter: Instantiate comments in ip(6)tables rules
Stefan Berger [Thu, 30 Sep 2010 19:56:09 +0000 (15:56 -0400)]
nwfilter: Instantiate comments in ip(6)tables rules

In this patch I am extending the rule instantiator to create the comment
node where supported, which is the case for iptables and ip6tables.

Since commands are written in the format

cmd='iptables ...-m comment --comment \"\" '

certain characters ('`) in the comment need to be escaped to
prevent comments from becoming commands themselves or cause other
forms of (bash) substitutions. I have tested this with various input and in
my tests the input made it straight into the comment. A test case for TCK
will be provided separately that tests this.

14 years agonwfilter: Extend XML parser and generator w/ comment attribute
Stefan Berger [Thu, 30 Sep 2010 19:46:10 +0000 (15:46 -0400)]
nwfilter: Extend XML parser and generator w/ comment attribute

The patch below extends the XML parser and generator so that every protocol
now can have a comment node. Comments are limited to 256 characters.

14 years agobuild: fix example build on MacOS X
Eric Blake [Tue, 28 Sep 2010 16:37:50 +0000 (10:37 -0600)]
build: fix example build on MacOS X

Partial reversion of commit 76d87a59, now that bootstrap is smarter.

* .gnulib: Update to latest, for poll and bootstrap fixes.
* bootstrap: Resync from gnulib.
* autogen.sh: Drop redundant tool checks; bootstrap does them
better, by honoring environment variables.
* examples/domain-events/events-c/Makefile.am (INCLUDES)
(event_test_LDADD): Use gnulib library during build.
* bootstrap.conf (gnulib_tool_option_extras): Revert --libtool
addition, now that updated bootstrap does it for us.
Reported by Justin Clift.

14 years agophyp: Checking for NULL values when building new guest
Eduardo Otubo [Wed, 29 Sep 2010 14:52:15 +0000 (16:52 +0200)]
phyp: Checking for NULL values when building new guest

When creating a new gust, the function phypBuildLpar() was not
checking for NULL values

src/phyp/phyp_driver.c: check the definition arguments to avoid a segmentation
  fault in phypBuildLpar()

14 years agoconfigure: tweak logic flow of virtport check
Justin Clift [Wed, 29 Sep 2010 14:14:07 +0000 (00:14 +1000)]
configure: tweak logic flow of virtport check

This fixes a small logic bug, where passing --without-macvtap
on the configure line, or otherwise indicating a lack of
support for macvtap, causes configure to bail.

14 years agompath: disable devmapper-multipath checking on non-linux
Justin Clift [Wed, 29 Sep 2010 12:34:36 +0000 (22:34 +1000)]
mpath: disable devmapper-multipath checking on non-linux

The configure script was breaking on MacOS X unless passed:

  --without-storage-mpath

This patch leverages Stefan Bergers earlier work for nwfilter,
so non-linux systems don't even attempt to build multipath.

14 years agoRework configure logic for virtualport support
Stefan Berger [Wed, 29 Sep 2010 11:56:26 +0000 (07:56 -0400)]
Rework configure logic for virtualport support

In this patch I am reworking the logic around detecting virtual port support and requiring the libnl dependency.

- It requires --with-macvtap and displays an error in case of --without-macvtap --with-virtualport.
- It tests for availability of certain data in include files and displays an error in case the include file is not at the correct level and --with-virtualport was chosen
- displays 'checking' messages for macvtap and virtualport support and results
- libnl support is required when macvtap is found or requested; if libnl is not there, please supply without-macvtap

14 years agomac os x: use awk selected by build system rather than first in path
Justin Clift [Tue, 28 Sep 2010 13:28:23 +0000 (23:28 +1000)]
mac os x: use awk selected by build system rather than first in path

Prior to this patch, the ChangeLog generation was hard coded to use
"awk", when it should have been using the AWK variable set by our
build system.

This breaks compilation on a newly installed OS X system, where the
default path has the Mac (non GNU) awk in the default search PATH
before any installed GNU awk (gawk).

14 years agonwfilter: remove recently added workaround define for macos x
Justin Clift [Tue, 28 Sep 2010 00:52:21 +0000 (10:52 +1000)]
nwfilter: remove recently added workaround define for macos x

This reverses commit 04c3704, which added a define to nwfilter to
allow libvirtd compilation on Mac OS X.  Stefan Bergers commit, 2e7294d,
is the proper solution, removing the requirement for nwfilter on non-Linux.

14 years agovirtualbox: fix a typo in the expected location on mac os x
Justin Clift [Tue, 28 Sep 2010 01:16:04 +0000 (11:16 +1000)]
virtualbox: fix a typo in the expected location on mac os x

Mac OS X provides an "/Applications" folder, not an "/Application" folder,
so installed VirtualBox wasn't being detected by default.

This 1 character patch fixes this.

14 years agopython: drop unnecessary conn assignment
Dan Kenigsberg [Mon, 27 Sep 2010 08:58:28 +0000 (10:58 +0200)]
python: drop unnecessary conn assignment

Since 554d82a200289938d5639a782a9f12e3e2e968f0, conn is unused. Let's
drop it - but keep the signature of the constructor for backward
compatibility.

14 years agonwfilter: Don't compile nwfilter driver on other systems than Linux
Stefan Berger [Mon, 27 Sep 2010 19:44:27 +0000 (15:44 -0400)]
nwfilter: Don't compile nwfilter driver on other systems than Linux

Don't compile the nwfilter driver (instantiating the rules) on other systems than Linux.

14 years agonwfilter: add a missing define, so libvirtd builds on macos x
Justin Clift [Mon, 27 Sep 2010 15:18:57 +0000 (01:18 +1000)]
nwfilter: add a missing define, so libvirtd builds on macos x

The nwfilter code uses ETH_ALEN, which isn't defined on MacOS X.
This is a simple workaround, to add it when missing.

14 years agonwfilter: report if ip(6)tables rules would not be active
Stefan Berger [Fri, 24 Sep 2010 16:06:17 +0000 (12:06 -0400)]
nwfilter: report if ip(6)tables rules would not be active

The patch below reports a warning in the log if the generated ip(6)tables rules would not be effective due to the proc filesystem entries

    /proc/sys/net/bridge/bridge-nf-call-iptables
    /proc/sys/net/bridge/bridge-nf-call-ip6tables

containing a '0'. The warning tells the user what to do. I am rate-limiting the warning message to appear only every 10 seconds.

14 years agoapp-armor: add 'rw' for appropriate devices
Jamie Strandboge [Thu, 23 Sep 2010 17:22:44 +0000 (11:22 -0600)]
app-armor: add 'rw' for appropriate devices

Description: Check for VIR_DOMAIN_CHR_TYPE in serial ports and add 'rw' for
defined serial ports, parallel ports and channels

Bug-Ubuntu: LP: #578527, LP: #609055

14 years agoadd extra tests to virt-aa-helper-test for new '-p' option
Jamie Strandboge [Thu, 23 Sep 2010 17:16:24 +0000 (11:16 -0600)]
add extra tests to virt-aa-helper-test for new '-p' option

14 years agodocs: grammar cleanups on logging examples
Eric Blake [Wed, 22 Sep 2010 21:34:17 +0000 (15:34 -0600)]
docs: grammar cleanups on logging examples

* docs/logging.html.in: Fix spelling and grammar.

14 years agoFix spelling of Xen in comments
Philipp Hahn [Thu, 23 Sep 2010 15:22:03 +0000 (17:22 +0200)]
Fix spelling of Xen in comments

14 years agomaint: update to latest gnulib
Eric Blake [Wed, 22 Sep 2010 18:08:58 +0000 (12:08 -0600)]
maint: update to latest gnulib

* .gnulib: Update to latest.
* bootstrap.conf (gnulib_modules): Add new termios module.
(gnulib_tool_option_extras): Make libtool usage explicit.
* src/util/util.c (includes): Gnulib now guarantees termios.h.
* bootstrap: Resync from gnulib.

14 years agoesx: Allow '-' in VMX entry names
Matthias Bolte [Wed, 22 Sep 2010 20:41:38 +0000 (22:41 +0200)]
esx: Allow '-' in VMX entry names

Add a test for this.

Reported by Frank Dirks.

14 years agopciFindStubDriver should return NULL on error
Chris Wright [Wed, 22 Sep 2010 22:54:23 +0000 (15:54 -0700)]
pciFindStubDriver should return NULL on error

pciFindStubDriver currently returns 0 in one of the error cases.
While it's correct...NULL is more readable.

Signed-off-by: Chris Wright <chrisw@redhat.com>
14 years agolibvirt-guests: start late and stop early
Jiri Denemark [Wed, 22 Sep 2010 13:46:04 +0000 (15:46 +0200)]
libvirt-guests: start late and stop early

libvirt-guests init script should be started as late as possible during
host startup and stopped as early as possible during host shutdown to
make sure required services are already/still up and running at the time
libvirt-guests runs.

14 years agoMake SASL work over UNIX domain sockets
Daniel P. Berrange [Tue, 14 Sep 2010 18:17:25 +0000 (19:17 +0100)]
Make SASL work over UNIX domain sockets

The addrToString methods were not coping with UNIX domain sockets
which have no normal host+port address. Hardcode special handling
for these so that SASL routines can work over UNIX sockets. Also
fix up SSF logic in remote client so that it presumes that a UNIX
socket is secure

* daemon/remote.c: Fix addrToString for UNIX sockets.
* src/remote/remote_driver.c: Fix addrToString for UNIX sockets
  and fix SSF logic to work for TLS + UNIX sockets in the same
  manner

14 years agoRefactor some daemon code to facilitate introduction of static probes
Daniel P. Berrange [Tue, 14 Sep 2010 16:50:25 +0000 (17:50 +0100)]
Refactor some daemon code to facilitate introduction of static probes

Refactor some daemon code to facilitate the introductioin of static
probes, sanitizing function exit paths in many places

* daemon/libvirtd.c: Pass the dname string into remoteCheckDN
  to let caller deal with failure paths. Add separate exit paths
  to remoteCheckCertificate for auth failure vs denial. Merge
  all exit paths in qemudDispatchServer to one cleanup block
* daemon/remote.c: Add separate exit paths to SASL & PolicyKit
  functions for auth failure vs denial

14 years agonodeinfo: work when hot-plugging is disabled
Eric Blake [Tue, 21 Sep 2010 17:43:06 +0000 (11:43 -0600)]
nodeinfo: work when hot-plugging is disabled

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

* src/nodeinfo.c (cpu_online): Allow missing directory for all
CPUs, not just cpu0.

Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agoThis patch fixes a bug appearing on big endian machines where the returned XML is...
Stefan Berger [Wed, 22 Sep 2010 10:24:19 +0000 (06:24 -0400)]
This patch fixes a bug appearing on big endian machines where the returned XML is not the one that is expected (see test/nwfilterxml2xmltest). The problem is due to for example the casting of pointers to unsigned integers to void * and then back to 16 bit integers.

14 years agotests: silence qemuargv2xmltest noise
Eric Blake [Fri, 10 Sep 2010 16:25:49 +0000 (10:25 -0600)]
tests: silence qemuargv2xmltest noise

Before this patch, the testsuite was noisy:

TEST: qemuargv2xmltest
      ........................................ 40
      ................20:41:28.046: warning : qemuParseCommandLine:6565 : unknown QEMU argument '-unknown', adding to the qemu namespace
20:41:28.046: warning : qemuParseCommandLine:6565 : unknown QEMU argument 'parameter', adding to the qemu namespace
.                        57  OK
PASS: qemuargv2xmltest

It's not a real failure (which is why the test was completing
successfully), so much as an intentional warning to the user that use
of the qemu namespace has the potential for undefined effects that
leaked through the default logging behavior.  After this patch series,
all tests can access any logged data, and this particular test can
explicitly check for the presence or absence of the warning, such that
the test output becomes:

TEST: qemuargv2xmltest
      ........................................ 40
      .................                        57  OK
PASS: qemuargv2xmltest

* tests/testutils.h (virtTestLogContentAndReset): New prototype.
* tests/testutils.c (struct virtTestLogData): New struct.
(virtTestLogOutput, virtTestLogClose, virtTestLogContentAndReset):
New functions.
(virtTestMain): Always capture log data emitted during tests.
* tests/qemuargv2xmltest.c (testCompareXMLToArgvHelper, mymain):
Use flag to mark which tests expect noisy stderr.
(testCompareXMLToArgvFiles): Add parameter to test whether stderr
was appropriately silent.

14 years agotests: clean up qemuargv2xmltest
Eric Blake [Fri, 10 Sep 2010 02:32:50 +0000 (20:32 -0600)]
tests: clean up qemuargv2xmltest

Since commit 107a7bd06bc, the extraFlags argument was unused.

* tests/qemuargv2xmltest.c (DO_TEST): Drop extraFlags argument.
Adjust all callers.

14 years agodocs: reworked the policykit patch submitted by Patrick Dignan
Justin Clift [Thu, 16 Sep 2010 12:14:18 +0000 (22:14 +1000)]
docs: reworked the policykit patch submitted by Patrick Dignan

Tweaked the PolicyKit documentation improvement patch submitted
by Patrick Dignan.

Additionally, removed the reference to PolicyKit.conf, which is
no longer used by PolicyKit, plus added a link to the expanded
PolicyKit example page on the wiki.

14 years agodocs: fix the xml validity errors regarding name and id
Justin Clift [Thu, 16 Sep 2010 10:07:19 +0000 (20:07 +1000)]
docs: fix the xml validity errors regarding name and id

Got sick of seeing the "validity error : ID Objects already defined"
errors, which this patch addresses.

14 years agobuild: avoid non-portable IPv6 struct member, for MacOS X
Eric Blake [Wed, 15 Sep 2010 20:50:51 +0000 (14:50 -0600)]
build: avoid non-portable IPv6 struct member, for MacOS X

* src/util/network.c (getIPv6Addr): Manually join s6_addr bytes,
instead of assuming s6_addr16 shorts.
Reported by Justin Clifton; solution suggested by Bruno Haible.

14 years agovirsh: change wexitstatus order to allow compilation on mac osx
Justin Clift [Wed, 15 Sep 2010 15:08:14 +0000 (01:08 +1000)]
virsh: change wexitstatus order to allow compilation on mac osx

This is the simple fix Daniel Veillard suggested last year:

  http://www.redhat.com/archives/libvir-list/2009-May/msg00459.html

14 years agolibvirtd: improve the error message displayed on tls client auth failure
Justin Clift [Wed, 15 Sep 2010 15:39:08 +0000 (01:39 +1000)]
libvirtd: improve the error message displayed on tls client auth failure

This address BZ # 556599:

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

14 years agomaint: silence warning from libtool
Eric Blake [Fri, 10 Sep 2010 02:10:33 +0000 (20:10 -0600)]
maint: silence warning from libtool

I got tired of seeing this.

config.status: executing libtool commands
/bin/rm: cannot remove `libtoolT': No such file or directory
config.status: executing po-directories commands

While I was at it, there were a couple other unused variables.

* configure.ac (RM, MV, TAR): Drop; nothing in libvirt directly uses
this, and assigning RM interferes with libtool.

14 years agoRebuild network filter for UML guests on updates
Soren Hansen [Tue, 14 Sep 2010 08:07:43 +0000 (10:07 +0200)]
Rebuild network filter for UML guests on updates

When nwfilter support was added to UML, I didn't realise the UML driver
needed instrumentation to make updating nwfilters on the fly work. This
patch adds this bit of glue.

Signed-off-by: Soren Hansen <soren@linux2go.dk>
14 years agovirsh: Use virBuffer for generating XML
Jiri Denemark [Fri, 10 Sep 2010 11:38:40 +0000 (13:38 +0200)]
virsh: Use virBuffer for generating XML

cmdAttachInterface and cmdAttachDisk still used vshRealloc and sprintf
for generating XML, which is hardly maintainable. Let's get rid of this
old code.

14 years agobuild: use portable sed expressions
Eric Blake [Fri, 10 Sep 2010 16:38:17 +0000 (10:38 -0600)]
build: use portable sed expressions

* src/Makefile.am (libvirt.def, libvirt_qemu.def): '\}' and '\t'
are not required by POSIX.  Use '}' and literal tab instead.
(install-data-local): Avoid sed -i.
* tests/read-bufsiz: Likewise.
Reported by Mitchell Hashimoto.