]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
14 years agonwfilter: extensions of docs with
Stefan Berger [Fri, 18 Jun 2010 17:44:17 +0000 (13:44 -0400)]
nwfilter: extensions of docs with

As requested, here a couple of paragraphs about the recently added statematch attribute and some advanced (and tricky) traffic filtering topics.

14 years agoAdd ACK'd v2 changes for previous commit
Cole Robinson [Fri, 18 Jun 2010 15:56:04 +0000 (11:56 -0400)]
Add ACK'd v2 changes for previous commit

14 years agoqemu: Fix crash on failed VM startup
Cole Robinson [Tue, 1 Jun 2010 19:10:19 +0000 (15:10 -0400)]
qemu: Fix crash on failed VM startup

If VM startup fails early enough (can't find a referenced USB device),
libvirtd will crash trying to clear the VNC port bit, since port = 0,
which overflows us out of the bitmap bounds.

Fix this by being more defensive in the bitmap operations, and only
clearing a previously set VNC port.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
14 years agoFix description of virStorageVolGetInfo()
Philipp Hahn [Tue, 15 Jun 2010 09:44:13 +0000 (11:44 +0200)]
Fix description of virStorageVolGetInfo()

Probably a copy-paste-bug in python/libvirt-override-api.xml:
virStorageVolGetInfo() extracts information about a "storage volume",
not the "storage pool" as virStoragePoolGetInfo() does.

Signed-off-by: Philipp Hahn <hahn@univention.de>
14 years agovirsh: add --uuid option to vol-pool
Justin Clift [Fri, 11 Jun 2010 16:26:58 +0000 (02:26 +1000)]
virsh: add --uuid option to vol-pool

Adds an optional switch, --uuid, for telling the virsh vol-pool command
to return the pool UUID rather than pool name.

14 years agoqemu: reduce file padding requirements
Eric Blake [Thu, 10 Jun 2010 02:23:51 +0000 (20:23 -0600)]
qemu: reduce file padding requirements

Followup to https://bugzilla.redhat.com/show_bug.cgi?id=599091,
commit 20206a4b, to reduce disk waste in padding.

* src/qemu/qemu_monitor.h (QEMU_MONITOR_MIGRATE_TO_FILE_BS): Drop
back to 4k.
(QEMU_MONITOR_MIGRATE_TO_FILE_TRANSFER_SIZE): New macro.
* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Update comment.
* src/qemu/qemu_monitor_text.c (qemuMonitorTextMigrateToFile): Use
two invocations of dd to output non-aligned large blocks.
* src/qemu/qemu_monitor_json.c (qemuMonitorJSONMigrateToFile):
Likewise.

14 years agonwfilter: add XML attribute to control iptables state match
Stefan Berger [Thu, 17 Jun 2010 18:12:34 +0000 (14:12 -0400)]
nwfilter: add XML attribute to control iptables state match

This patch adds an optional XML attribute to a nwfilter rule to give the user control over whether the rule is supposed to be using the iptables state match or not. A rule may now look like shown in the XML below with the statematch attribute either having value '0' or 'false' (case-insensitive).

[...]
<rule action='accept' direction='in' statematch='false'>
<tcp srcmacaddr='1:2:3:4:5:6'
           srcipaddr='10.1.2.3' srcipmask='32'
           dscp='33'
           srcportstart='20' srcportend='21'
           dstportstart='100' dstportend='1111'/>
</rule>
[...]

I am also extending the nwfilter schema and add this attribute to a test case.

14 years agovirsh: ensure persistence and autostart are shown for dominfo and pool-info
Justin Clift [Thu, 17 Jun 2010 07:57:12 +0000 (17:57 +1000)]
virsh: ensure persistence and autostart are shown for dominfo and pool-info

This patch adds the persistence status (yes/no) to the output of the virsh
dominfo and pool-info commands.  This patch also adds the autostart status
to the output of the virsh pool-info command.

Red Hat BZ for this:

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

14 years agophyp: adding support for IVM
Eduardo Otubo [Wed, 16 Jun 2010 20:33:27 +0000 (14:33 -0600)]
phyp: adding support for IVM

Use virBuffer* API to conditionally keep the portion of the command
line specific to HMC, so that IVM can work.

Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agonwfilter: use match target on incoming traffic
Stefan Berger [Thu, 17 Jun 2010 11:15:20 +0000 (07:15 -0400)]
nwfilter: use match target on incoming traffic

The following patch enables the iptables match target to be used by
default for incoming traffic. So far it has only be used for outgoing
traffic.

14 years agomacvtap: work-around for 2.6.32 and older kernels
Stefan Berger [Thu, 17 Jun 2010 11:05:38 +0000 (07:05 -0400)]
macvtap: work-around for 2.6.32 and older kernels

This patch works around a recent extension of the netlink driver I had made use of when building the netlink messages. Unfortunately older kernels don't accept IFLA_IFNAME + name of interface as a replacement for the interface's index, so this patch now gets the interface index ifindex if it's not provided (ifindex <= 0).

14 years agovirsh: change printf() calls to vshPrint()
Justin Clift [Wed, 16 Jun 2010 05:25:05 +0000 (15:25 +1000)]
virsh: change printf() calls to vshPrint()

Trivial fix changing printf() calls to vshPrint() where the ctl
variable is available.

14 years agovirsh: improve help text for vol query commands
Justin Clift [Fri, 11 Jun 2010 11:52:24 +0000 (21:52 +1000)]
virsh: improve help text for vol query commands

Improves the help text for vol-path, vol-name, and vol-key, which
previously referred to volume UUIDs.

Addresses BZ # 598365.

14 years agovirsh: add pool support to vol-key command
Justin Clift [Fri, 11 Jun 2010 11:51:55 +0000 (21:51 +1000)]
virsh: add pool support to vol-key command

Presently the vol-key command only supports being provided with
a volume path.

This patch adds support for providing it with a pool and volume
identifier pair as well.

    virsh # vol-key --pool <pool-name-or-uuid> <vol-name-or-path>

14 years agoAdd several missing vir*Free calls in libvirtd's remote code
Matthias Bolte [Sat, 12 Jun 2010 15:13:33 +0000 (17:13 +0200)]
Add several missing vir*Free calls in libvirtd's remote code

Justin Clift reported a problem with adding virStoragePoolIsPersistent
to virsh's pool-info command, resulting in a strange problem. Here's
an example:

    virsh # pool-create-as images_dir3 dir - - - - "/home/images2"
    Pool images_dir3 created

    virsh # pool-info images_dir3
    Name:           images_dir3
    UUID:           90301885-94eb-4ca7-14c2-f30b25a29a36
    State:          running
    Capacity:       395.20 GB
    Allocation:     30.88 GB
    Available:      364.33 GB

    virsh # pool-destroy images_dir3
    Pool images_dir3 destroyed

At this point the images_dir3 pool should be gone (because it was
transient) and we should be able to create a new pool with the same name:

    virsh # pool-create-as images_dir3 dir - - - - "/home/images2"
    Pool images_dir3 created

    virsh # pool-info images_dir3
    Name:           images_dir3
    UUID:           90301885-94eb-4ca7-14c2-f30b25a29a36
    error: Storage pool not found

The new pool got the same UUID as the first one, but we didn't specify
one. libvirt should have picked a random UUID, but it didn't.

It turned out that virStoragePoolIsPersistent leaks a reference to the
storage pool object (actually remoteDispatchStoragePoolIsPersistent does).
As a result, pool-destroy doesn't remove the virStoragePool for the
"images_dir3" pool from the virConnectPtr's storagePools hash on libvirtd's
side. Then the second pool-create-as get's the stale virStoragePool object
associated with the "images_dir3" name. But this object has the old UUID.

This commit ensures that all get_nonnull_* and make_nonnull_* calls for
libvirt objects are matched properly with vir*Free calls. This fixes the
reference leaks and the reported problem.

All remoteDispatch*IsActive and remoteDispatch*IsPersistent functions were
affected. But also remoteDispatchDomainMigrateFinish2 was affected in the
success path. I wonder why that didn't surface earlier. Probably because
domainMigrateFinish2 is executed on the destination host and in the common
case this connection is opened especially for the migration and gets closed
after the migration is done. So there was no chance to run into a problem
because of the leaked reference.

14 years agoesx: Update case insensitive .vmx tests
Matthias Bolte [Wed, 26 May 2010 13:02:01 +0000 (15:02 +0200)]
esx: Update case insensitive .vmx tests

Commit b9efc7dc3b97ef667ab99cee884b8485ebcb2f91 made virFileHasSuffix
case insensitive. Honor this in the tests by switching vmdk to VMDK.

14 years agoesx: Accept 'disk' as harddisk device type in .vmx files
Matthias Bolte [Fri, 11 Jun 2010 21:18:17 +0000 (23:18 +0200)]
esx: Accept 'disk' as harddisk device type in .vmx files

14 years agophyp: sed cleanups
Eric Blake [Wed, 9 Jun 2010 01:12:41 +0000 (19:12 -0600)]
phyp: sed cleanups

* src/phyp/phyp_driver.c (phypNumDomainsGeneric): Avoid glob
collision by quoting sed argument.
(phypDomainSetCPU): Avoid non-portable \+ in sed.
(phypGetVIOSPartitionID, phypDiskType, phypListDomainsGeneric)
(phypListDefinedDomains): Micro-optimize anchored substitutions.

14 years agovirsh: mark autostart answers for translation
Justin Clift [Mon, 14 Jun 2010 09:45:52 +0000 (19:45 +1000)]
virsh: mark autostart answers for translation

This is a trivial fix for several autostart yes/no strings that
weren't correctly marked for translation.

14 years agovirsh: add start --paused support
Eric Blake [Thu, 10 Jun 2010 16:18:02 +0000 (10:18 -0600)]
virsh: add start --paused support

Make 'start --paused' mirror 'create --paused'.

* tools/virsh.c (cmdStart): Use new virDomainCreateWithFlags API
when needed.
* tools/virsh.pod (start): Document --paused.

14 years agoqemu: support starting persistent domain paused
Eric Blake [Thu, 10 Jun 2010 16:04:44 +0000 (10:04 -0600)]
qemu: support starting persistent domain paused

Match earlier change for qemu pause support with virDomainCreateXML.

* src/qemu/qemu_driver.c (qemudDomainObjStart): Add parameter; all
callers changed.
(qemudDomainStartWithFlags): Implement flag support.

14 years agodrivers: add virDomainCreateWithFlags if virDomainCreate exists
Eric Blake [Thu, 10 Jun 2010 15:55:36 +0000 (09:55 -0600)]
drivers: add virDomainCreateWithFlags if virDomainCreate exists

* src/esx/esx_driver.c (esxDomainCreate): Move guts...
(esxDomainCreateWithFlags): ...to new function.
(esxDriver): Trivially support the new API.
* src/lxc/lxc_driver.c (lxcDomainStart, lxcDomainStartWithFlags)
(lxcDriver): Likewise.
* src/opennebula/one_driver.c (oneDomainStart)
(oneDomainStartWithFlags, oneDriver): Likewise.
* src/openvz/openvz_driver.c (openvzDomainCreate)
(openvzDomainCreateWithFlags, openvzDriver): Likewise.
* src/qemu/qemu_driver.c (qemudDomainStart)
(qemudDomainStartWithFlags, qemuDriver): Likewise.
* src/test/test_driver.c (testDomainCreate)
(testDomainCreateWithFlags, testDriver): Likewise.
* src/uml/uml_driver.c (umlDomainStart, umlDomainStartWithFlags)
(umlDriver): Likewise.
* src/vbox/vbox_tmpl.c (vboxDomainCreate)
(vboxDomainCreateWithFlags, Driver): Likewise.
* src/xen/xen_driver.c (xenUnifiedDomainCreate)
(xenUnifiedDomainCreateWithFlags, xenUnifiedDriver): Likewise.
* src/xenapi/xenapi_driver.c (xenapiDomainCreate)
(xenapiDomainCreateWithFlags, xenapiDriver): Likewise.

14 years agoremote: protocol implementation for virDomainCreateWithFlags
Eric Blake [Thu, 10 Jun 2010 14:53:28 +0000 (08:53 -0600)]
remote: protocol implementation for virDomainCreateWithFlags

Define the wire format for the new virDomainCreateWithFlags
API, and implement client and server side of marshaling code.

* daemon/remote.c (remoteDispatchDomainCreateWithFlags): Add
server side dispatch for virDomainCreateWithFlags.
* src/remote/remote_driver.c (remoteDomainCreateWithFlags)
(remote_driver): Client side serialization.
* src/remote/remote_protocol.x
(remote_domain_create_with_flags_args)
(remote_domain_create_with_flags_ret)
(REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS): Define wire format.
* daemon/remote_dispatch_args.h: Regenerate.
* daemon/remote_dispatch_prototypes.h: Likewise.
* daemon/remote_dispatch_table.h: Likewise.
* src/remote/remote_protocol.c: Likewise.
* src/remote/remote_protocol.h: Likewise.
* src/remote_protocol-structs: Likewise.

14 years agolibvirt: introduce domainCreateWithFlags API
Eric Blake [Thu, 10 Jun 2010 13:28:05 +0000 (07:28 -0600)]
libvirt: introduce domainCreateWithFlags API

Persistent domain creation needs the same features as transient
domains, but virDomainCreate lacks the flags argument present in
virDomainCreateXML.  virDomainCreateFlags is already claimed as
a public enum, so we have to break convention and expose
virDomainCreateWithFlags.

* include/libvirt/libvirt.h.in (virDomainCreateWithFlags): Add.
* src/driver.h (virDrvDomainCreateWithFlags): Internal API.
* src/libvirt.c (virDomainCreateWithFlags): Glue public API to
driver API.
* src/libvirt_public.syms (LIBVIRT_0.8.2): Expose public API.
* src/esx/esx_driver.c (esxDriver): Add stub for driver.
* src/lxc/lxc_driver.c (lxcDriver): Likewise.
* src/opennebula/one_driver.c (oneDriver): Likewise.
* src/openvz/openvz_driver.c (openvzDriver): Likewise.
* src/phyp/phyp_driver.c (phypDriver): Likewise.
* src/qemu/qemu_driver.c (qemuDriver): Likewise.
* src/remote/remote_driver.c (remote_driver): Likewise.
* src/test/test_driver.c (testDriver): Likewise.
* src/uml/uml_driver.c (umlDriver): Likewise.
* src/vbox/vbox_tmpl.c (Driver): Likewise.
* src/xen/xen_driver.c (xenUnifiedDriver): Likewise.
* src/xenapi/xenapi_driver.c (xenapiDriver): Likewise.

14 years agomaint: simplify some ignore files
Eric Blake [Wed, 9 Jun 2010 19:52:36 +0000 (13:52 -0600)]
maint: simplify some ignore files

* .hgignore: Delete, no longer used.
* examples/python/.gitignore: Delete, covered globally.
* include/.gitignore: Likewise.
* python/tests/.gitignore: Likewise.
* docs/schemas/.gitignore: Likewise.
* tests/xml2sexprdata/.gitignore: Likewise.
* tests/sexpr2xmldata/.gitignore: Likewise.
* tests/confdata/.gitignore: Likewise.
* tests/xencapsdata/.gitignore: Likewise.
* tests/xmconfigdata/.gitignore: Likewise.
* tests/xml2sexprdata/.gitignore: Likewise.

14 years agoparthelper: fix compilation without optimization
Eric Blake [Mon, 14 Jun 2010 20:54:31 +0000 (14:54 -0600)]
parthelper: fix compilation without optimization

Daniel's patch works with gcc and CFLAGS containing -O (the
autoconf default), but fails with non-gcc or with other
CFLAGS (such as -g), since c-ctype.h declares c_isdigit as
a macro only for certain compilation settings.

* src/Makefile.am (libvirt_parthelper_LDFLAGS): Add gnulib
library, for when c_isdigit is not a macro.
* src/storage/parthelper.c (main): Avoid out-of-bounds
dereference, noticed by Jim Meyering.

14 years agoFix enumeration of partitions in disks with a trailing digit in path
Daniel P. Berrange [Tue, 8 Jun 2010 17:27:24 +0000 (18:27 +0100)]
Fix enumeration of partitions in disks with a trailing digit in path

Disks with a trailing digit in their path (eg /dev/loop0 or
/dev/dm0) have an extra 'p' appended before the partition
number (eg, to form /dev/loop0p1 not /dev/loop01). Fix the
partition lookup to append this extra 'p' when required

* src/storage/parthelper.c: Add a 'p' before partition
  number if required

14 years agouml: sanity check external data before using it
Eric Blake [Wed, 3 Mar 2010 16:31:02 +0000 (09:31 -0700)]
uml: sanity check external data before using it

Otherwise, a malicious packet could cause a DoS via spurious
out-of-memory failure.

* src/uml/uml_driver.c (umlMonitorCommand): Validate that incoming
data is reliable before using it to allocate/dereference memory.
Don't report bogus errno on short read.
Reported by Jim Meyering.

14 years agoImprove error message for disabled client-side drivers
Matthias Bolte [Wed, 9 Jun 2010 22:52:05 +0000 (00:52 +0200)]
Improve error message for disabled client-side drivers

Report that libvirt was built without that driver instead of
trying to connect to a libvirtd, when we know that this is
going to fail.

14 years agovbox: check getenv("DISPLAY") for NULL in vboxDomainDumpXML
Matthias Bolte [Thu, 10 Jun 2010 20:11:39 +0000 (22:11 +0200)]
vbox: check getenv("DISPLAY") for NULL in vboxDomainDumpXML

Otherwise this will segfault if DISPLAY is not defined.

14 years agoCheck getenv("PATH") for NULL in virFindFileInPath
Matthias Bolte [Thu, 10 Jun 2010 19:52:33 +0000 (21:52 +0200)]
Check getenv("PATH") for NULL in virFindFileInPath

Otherwise this will segfault if PATH is not defined.

Reported by Emre Erenoglu

14 years agovirsh: add snapshot backing store support to vol-create-as
Justin Clift [Tue, 8 Jun 2010 16:38:32 +0000 (02:38 +1000)]
virsh: add snapshot backing store support to vol-create-as

This patch adds two new parameters to the vol-create-as command:

 --backing-vol <volume-name-or-key-or-path>
 --backing-vol-format <format-of-backing-vol>

  virsh # vol-create-as guest_images_lvm snapvol1 5G --backing-vol \
              rhel6vm1lun1
  Vol snapvol1 created

  virsh # vol-create-as image_dir qcow2snap2 5G --format qcow2 \
              --backing-vol imagevol1.qcow2 \
              --backing-vol-format qcow2
  Vol qcow2snap2 created

Additionally, the virsh man page update fixes incorrect snapshot
parameters that were included in my prior bulk volume command patch.

14 years agobuild: fix some mingw issues
Eric Blake [Wed, 2 Jun 2010 20:21:45 +0000 (14:21 -0600)]
build: fix some mingw issues

On Fedora 13 with sufficient mingw32-* packages installed, running
./autobuild.sh failed to cross-compile to mingw because
mingw32-pthreads installed a broken <pthread.h>.  With that
issue fixed, the build still failed due to use of O_SYNC.
Meanwhile, recent .spec.in changes got out of sync.

* bootstrap.conf (gnulib_modules): Add fcntl-h, for O_SYNC.
* .gnulib: Update to latest, to work around buggy pthreads-win32
library.
* bootstrap: Import latest from gnulib.
* mingw32-libvirt.spec.in: Distribute new file.

14 years agobuild: avoid pthreads-win32 on mingw
Eric Blake [Wed, 9 Jun 2010 13:12:21 +0000 (07:12 -0600)]
build: avoid pthreads-win32 on mingw

* src/util/threads.c (includes) [WIN32]: On mingw, favor native
threading over pthreads-win32 library.
* src/util/thread.h [WIN32] Likewise.
Suggested by Daniel P. Berrange.

14 years agoFix cgroup setup code to cope with root squashing NFS
Daniel P. Berrange [Wed, 19 May 2010 10:47:47 +0000 (06:47 -0400)]
Fix cgroup setup code to cope with root squashing NFS

When a disk is on a root squashed NFS server, it may not be
possible to stat() the disk file in virCgroupAllowDevice.
The virStorageFileGetMeta method may also fail to extract
the parent backing store. Both of these errors have to be
ignored to avoid breaking NFS deployments

* src/qemu/qemu_driver.c: Ignore errors in cgroup setup to
   keep root squash NFS happy

14 years agovirsh: fixed trivial comment and debug message in vshCommandOptVolBy function
Justin Clift [Tue, 8 Jun 2010 14:46:06 +0000 (00:46 +1000)]
virsh: fixed trivial comment and debug message in vshCommandOptVolBy function

14 years agovirsh: remove xen reference in header comment
Justin Clift [Wed, 9 Jun 2010 09:00:30 +0000 (19:00 +1000)]
virsh: remove xen reference in header comment

With libvirt and virsh now being used for much more than Xen, this
patch removes the outdated reference to Xen in the file header.

14 years agoesx: Add proxy query parameter
Matthias Bolte [Thu, 3 Jun 2010 21:09:12 +0000 (23:09 +0200)]
esx: Add proxy query parameter

Allow to specify a proxy to be used by libcurl.

14 years agoesx: Refactor esxUtil_ParseQuery's parameter handling
Matthias Bolte [Thu, 3 Jun 2010 18:04:15 +0000 (20:04 +0200)]
esx: Refactor esxUtil_ParseQuery's parameter handling

Pass a struct containing the parameters instead of passing each
one individually. This make future extensions a bit simpler.

14 years agovirsh: add the volume commands to the virsh man page
Justin Clift [Tue, 8 Jun 2010 15:00:24 +0000 (01:00 +1000)]
virsh: add the volume commands to the virsh man page

This patch also includes the new vol-pool command.

14 years agovirsh: add new vol-pool command
Justin Clift [Tue, 8 Jun 2010 14:06:29 +0000 (00:06 +1000)]
virsh: add new vol-pool command

This patch adds a new "vol-pool" command to virsh, to round out the
identifier conversion functions for volumes in virsh.  Now it is
possible to work with volumes when starting from just a volume key
or volume path.

14 years agovirsh: add --paused option to create
Eric Blake [Tue, 8 Jun 2010 19:43:01 +0000 (13:43 -0600)]
virsh: add --paused option to create

* tools/virsh.c (opts_create): Add --paused option.
(cmdCreate): Pass appropriate flag.
* tools/virsh.pod: Document it.

14 years agoqemu: allow creation of a paused domain
Eric Blake [Tue, 8 Jun 2010 19:02:40 +0000 (13:02 -0600)]
qemu: allow creation of a paused domain

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

Some guests (eg with badly configured grub, or Windows' installation cd)
require quick response from the console user. That's why we have a
"launchPaused" option in vdsm.

To implement it via libvirt, we need to ask libvirt not to call
qemuMonitorStartCPUs() after starting qemu.  Calling virDomainStop
immediately after the domain is up is inherently raceful.

* src/qemu/qemu_driver.c (qemudStartVMDaemon): Add new parameter;
all callers adjusted.
(qemudDomainCreate): Implement support for new flag.

14 years agovirDomainCreateXML: support new flag
Eric Blake [Tue, 25 May 2010 17:13:13 +0000 (11:13 -0600)]
virDomainCreateXML: support new flag

* include/libvirt/libvirt.h.in (virDomainCreateFlags): Add
VIR_DOMAIN_START_PAUSED.
* src/libvirt.c (virDomainCreateXML): Update documentation.
* src/lxc/lxc_driver.c (lxcDomainCreateAndStart): Reject new flag
as unimplemented.
* src/opennebula/one_driver.c (oneDomainCreateAndStart):
Likewise.
* src/openvz/openvz_driver.c (openvzDomainCreateXML): Likewise.
* src/phyp/phyp_driver.c (phypDomainCreateAndStart): Likewise.
* src/qemu/qemu_driver.c (qemudDomainCreate): Likewise.
* src/test/test_driver.c (testDomainCreateXML): Likewise.
* src/uml/uml_driver.c (umlDomainCreate): Likewise.
* src/vbox/vbox_tmpl.c (vboxDomainCreateXML): Likewise.
* src/xen/xend_internal.c (xenDaemonCreateXML): Likewise.
* src/xenapi/xenapi_driver.c (xenapiDomainCreateXML): Likewise.

14 years agoFix leaks in udev device add/remove v3
David Allan [Sat, 29 May 2010 02:22:05 +0000 (22:22 -0400)]
Fix leaks in udev device add/remove v3

* This patch is a modification of a patch submitted by Nigel Jones.
  It fixes several memory leaks on device addition/removal:

1. Free the virNodeDeviceDefPtr in udevAddOneDevice if the return
   value is non-zero

2. Always release the node device reference after the device has been
   processed.

* Refactored for better readability per the suggestion of clalance

14 years agoAdd multiIQN tests
David Allan [Mon, 7 Jun 2010 20:47:37 +0000 (16:47 -0400)]
Add multiIQN tests

* Fix broken rng schema
* Add test input & output files

14 years agoAdd multiiqn XML dump
David Allan [Mon, 7 Jun 2010 19:06:20 +0000 (15:06 -0400)]
Add multiiqn XML dump

* Use virBufferEscapeString() per Dan B.

14 years agoFix test breakage from virtio serial changes
Daniel P. Berrange [Tue, 8 Jun 2010 15:31:50 +0000 (16:31 +0100)]
Fix test breakage from virtio serial changes

The virtio serial changes broke the test suite because they forgot
to add the new address attribute to the domain XML schema. The
xml2xml test also broke because the XML no longer roundtrips. This
is due to testing of auto-addition of <controller> elements. Split
that test case off into a separate XML file to avoid breakage

* docs/schemas/domain.rng: Allow port number for virtio serial addresses
* tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.args,
  tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.xml: Revert to
  a simple config to avoid breaking xml2xml test
* tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-auto.xml,
  tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-auto.args: Add
  complex test case for auto-controller addition for xml2argv test
* tests/qemuxml2argvtest.c: Add channel-virtio-auto test

14 years agoEnable probing of VPC disk format type
Daniel P. Berrange [Tue, 8 Jun 2010 15:05:36 +0000 (16:05 +0100)]
Enable probing of VPC disk format type

A look at the QEMU source revealed the missing bits of info about
the VPC file format, so we can enable this now

* src/util/storage_file.c: Enable VPC format, providing version
  and disk size offset fields

14 years agoEnsure that PCI device is reattached to host if hotadd fails
Daniel P. Berrange [Fri, 28 May 2010 11:20:24 +0000 (12:20 +0100)]
Ensure that PCI device is reattached to host if hotadd fails

When an attempt to hotplug a PCI device to a guest fails,
the device was left attached to pci-stub. It is neccessary
to reset the device and then attach it to the host driver
again.

* src/qemu/qemu_driver.c: Reattach PCI device to host if
  hotadd fails

14 years agoDon't raise errors in the selinux restore code
Daniel P. Berrange [Fri, 28 May 2010 11:19:13 +0000 (12:19 +0100)]
Don't raise errors in the selinux restore code

The restore code is done in places where errors cannot be
raised, since they will overwrite over pre-existing errors.

* src/security/security_selinux.c: Only warn about failures
  in label restore, don't report errors

14 years agoFix check for errors in device_add command in QEMU text monitor
Daniel P. Berrange [Fri, 28 May 2010 11:18:09 +0000 (12:18 +0100)]
Fix check for errors in device_add command in QEMU text monitor

Any output at all from device_add indicates an error in the
command execution. Thus it needs to check for reply != ""

* src/qemu/qemu_monitor_text.c: Fix reply check for errors
  to treat any output as an error

14 years agoPrefer UDEV to HAL drivers if both a compiled
Daniel P. Berrange [Fri, 28 May 2010 10:16:44 +0000 (11:16 +0100)]
Prefer UDEV to HAL drivers if both a compiled

HAL is deprecated and UDEV is the future. Thus if both
options are compiled, we should prefer use of UDEV over
HAL

* src/node_device/node_device_driver.c: Switch init
  order to try UDEV first, then HAL

14 years agoAdd support for setting socket MLS level in SELinux driver
Daniel J Walsh [Thu, 27 May 2010 15:44:47 +0000 (16:44 +0100)]
Add support for setting socket MLS level in SELinux driver

When SELinux is running in MLS mode, libvirtd will have a
different security level to the VMs. For libvirtd to be
able to connect to the monitor console, the client end of
the UNIX domain socket needs a different label. This adds
infrastructure to set the socket label via the security
driver framework

* src/qemu/qemu_driver.c: Call out to socket label APIs in
  security driver
* src/qemu/qemu_security_stacked.c: Wire up socket label
  drivers
* src/security/security_driver.h: Define security driver
  entry points for socket labelling
* src/security/security_selinux.c: Set socket label based on
  VM label

14 years agoNetwork duplicate UUID/name checking
Daniel P. Berrange [Thu, 27 May 2010 15:44:31 +0000 (16:44 +0100)]
Network duplicate UUID/name checking

The network driver is not doing correct checking for
duplicate UUID/name values. This introduces a new method
virNetworkObjIsDuplicate, based on the previously
written virDomainObjIsDuplicate.

* src/conf/network_conf.c, src/conf/network_conf.c,
  src/libvirt_private.syms: Add virNetworkObjIsDuplicate,
* src/network/bridge_driver.c: Call virNetworkObjIsDuplicate
  for checking uniqueness of uuid/names

14 years agoFix error codes for missing storage pools
Daniel P. Berrange [Thu, 27 May 2010 12:30:34 +0000 (13:30 +0100)]
Fix error codes for missing storage pools

The storage pool driver is mistakenly using the error code
VIR_ERR_INVALID_STORAGE_POOL which is for diagnosing invalid
pointers. This patch switches it to use VIR_ERR_NO_STORAGE_POOL
which is the correct code for cases where the storage pool does
not exist

* src/storage/storage_driver.c: Replace VIR_ERR_INVALID_STORAGE_POOL
  with VIR_ERR_NO_STORAGE_POOL

14 years agoStorage pool duplicate UUID/name checking
Daniel P. Berrange [Thu, 27 May 2010 11:41:30 +0000 (12:41 +0100)]
Storage pool duplicate UUID/name checking

The storage pool driver is not doing correct checking for
duplicate UUID/name values. This introduces a new method
virStoragePoolObjIsDuplicate, based on the previously
written virDomainObjIsDuplicate.

* src/conf/storage_conf.c, src/conf/storage_conf.c,
  src/libvirt_private.syms: Add virStoragePoolObjIsDuplicate,
* src/storage/storage_driver.c: Call virStoragePoolObjIsDuplicate
  for checking uniqueness of uuid/names

14 years agoFix auto-adding of virtio serial controllers
Daniel P. Berrange [Thu, 3 Jun 2010 12:49:35 +0000 (13:49 +0100)]
Fix auto-adding of virtio serial controllers

The domain parsing code would auto-add a virtio serial controller
if it saw any virtio serial channel defined. Unfortunately it
always added a controller with index=0, even if the channel address
specified an index != 0. It only added one controller, even if
multiple controllers were referenced by channels. Finally, it let
the ports+vectors parameters initialize to zero instead of -1, which
prevented the controllers accepting any ports.

* src/conf/domain_conf.c: Initialize ports+vectors when adding
  virtio serial controllers. Add all neccessary virtio serial
  controllers, instead of hardcoding controller 0
* qemuxml2argvdata/qemuxml2argv-channel-virtio.args,
  qemuxml2argvdata/qemuxml2argv-channel-virtio.xml: Expand to
  test controller auto-add behaviour

14 years agoInclude port number with virtio serial devices
Daniel P. Berrange [Wed, 2 Jun 2010 15:58:39 +0000 (16:58 +0100)]
Include port number with virtio serial devices

To ensure that the device addressing scheme is stable across
hotplug/unplug, all virtio serial channels needs to have an
associated port number in their address. This is then specified
to QEMU using the nr=NNN parameter

* src/conf/domain_conf.c, src/conf/domain_conf.h: Parsing
  for port number in vioserial address types.
* src/qemu/qemu_conf.c: Set 'nr=NNN' parameter with virtio
  serial port number
* tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.args,
  tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.xml: Expand
  data set to ensure coverage of port addressing

14 years agoDisable use of 'reason' field in block IO event in QEMU
Daniel P. Berrange [Thu, 3 Jun 2010 14:05:30 +0000 (15:05 +0100)]
Disable use of 'reason' field in block IO event in QEMU

QEMU upstream decided against adding a 'reason' field to
the block IO event in QMP. Disable this code to remove a
annoying warning message. It will be renabled when the
error string reason is re-introduced in QEMU

14 years agoEnsure UNIX domain sockets are removed on daemon shutdown
Daniel P. Berrange [Thu, 3 Jun 2010 13:36:34 +0000 (14:36 +0100)]
Ensure UNIX domain sockets are removed on daemon shutdown

When libvirtd exits it is leaving UNIX domain sockets on
the filesystem. These need to be removed.

The qemudInitPaths() method has signficant code churn to
switch from using a pre-allocated buffer on the stack, to
dynamically allocating on the heap.

* daemon/libvirtd.c, daemon/libvirtd.h: Store a reference
  to the UNIX domain socket path and unlink it on shutdown

14 years agovirsh: fix minor virsh man page typos and formatting problems
Justin Clift [Tue, 8 Jun 2010 00:18:01 +0000 (18:18 -0600)]
virsh: fix minor virsh man page typos and formatting problems

Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agoFix AppArmor save/restore.Add stdin_path to qemudStartVMDaemon() args.
Jamie Strandboge [Fri, 4 Jun 2010 16:20:29 +0000 (12:20 -0400)]
Fix AppArmor save/restore.Add stdin_path to qemudStartVMDaemon() args.

Refactor to update AppArmor security driver to adjust profile for
save/restore. This addresses the following bugs:

 https://bugzilla.redhat.com/show_bug.cgi?id=529363
 https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/457716

14 years agoAdd stdin_path to qemudStartVMDaemon() args.
Jamie Strandboge [Fri, 4 Jun 2010 16:20:29 +0000 (12:20 -0400)]
Add stdin_path to qemudStartVMDaemon() args.

Adjust args to qemudStartVMDaemon() to also specify path to stdin_fd,
so this can be passed to the AppArmor driver via SetSecurityAllLabel().

This updates all calls to qemudStartVMDaemon() as well as setting up
the non-AppArmor security driver *SetSecurityAllLabel() declarations
for the above. This is required for the following
"apparmor-fix-save-restore" patch since AppArmor resolves the passed
file descriptor to the pathname given to open().

14 years agoavoid syntax-check failure
Jim Meyering [Sun, 6 Jun 2010 08:27:28 +0000 (10:27 +0200)]
avoid syntax-check failure

* .mailmap: Map a stray commit-author email address to the canonical one.
Reported by Justin Clift.

14 years agoAdjust block size used by dd to speed QEMU domain save operations.
Laine Stump [Fri, 4 Jun 2010 03:36:00 +0000 (23:36 -0400)]
Adjust block size used by dd to speed QEMU domain save operations.

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

Saving a paused 512MB domain took 3m47s with the old block size of 512
bytes. Changing the block size to 1024*1024 decreased the time to 56
seconds. (Doubling again to 2048*1024 yielded 0 improvement; lowering
to 512k increased the save time to 1m10s, about 20%)

14 years agoFix dereference of potentially freed pointer in qemudDomainSaveFlags
Laine Stump [Fri, 4 Jun 2010 03:25:58 +0000 (23:25 -0400)]
Fix dereference of potentially freed pointer in qemudDomainSaveFlags

The pointer to the xml describing the domain is saved into an object
prior to calling VIR_REALLOC_N() to make the size of the memory it
points to a multiple of QEMU_MONITOR_MIGRATE_TO_FILE_BS. If that
operation needs to allocate new memory, the pointer that was saved is
no longer valid.

To avoid this situation, adjust the size *before* saving the pointer.

(This showed up when experimenting with very large values of
QEMU_MONITOR_MIGRATE_TO_FILE_BS).

14 years agoFixes for commit 211dd1e9
Jim Fehlig [Fri, 4 Jun 2010 16:04:03 +0000 (10:04 -0600)]
Fixes for commit 211dd1e9

Fixes for issues in commit 211dd1e9 noted by by Jim Meyering.

1. Allocate content buffer of size content_length + 1 to ensure
   NUL-termination.
2. Limit content buffer size to 64k
3. Fix whitespace issue

V2:
  - Add comment to clarify allocation of content buffer
  - Add ATTRIBUTE_NONNULL where appropriate
  - User NULLSTR macro

14 years agoautobuild.sh: avoid bashism
Eric Blake [Fri, 4 Jun 2010 03:07:09 +0000 (21:07 -0600)]
autobuild.sh: avoid bashism

* autobuild.sh: Replace 'set -o pipefail' with POSIX alternative.
Reported by Matthias Bolte.

14 years agoAllocate buffer to hold xend response
Jim Fehlig [Thu, 3 Jun 2010 00:07:17 +0000 (18:07 -0600)]
Allocate buffer to hold xend response

There are cases when a response from xend can exceed 4096 bytes, in
which case anything beyond 4096 is ignored. This patch changes the
current fixed-size, stack-allocated buffer to a dynamically allocated
buffer based on Content-Length in HTTP header.

14 years agoUpdate nodedev scsi_host data before use
David Allan [Thu, 3 Jun 2010 03:24:51 +0000 (23:24 -0400)]
Update nodedev scsi_host data before use

* It appears that the udev event for HBA creation arrives before the
  associated sysfs data is fully populated, resulting in bogus data
  for the nodedev entry until the entry is refreshed.  This problem is
  particularly troublesome when creating NPIV vHBAs because it results
  in libvirt failing to find the newly created adapter and waiting for
  the full timeout period before erroneously failing the create
  operation.  This patch forces an update before any attempt to use
  any scsi_host nodedev entry.

14 years agoFix device destroy return value
David Allan [Thu, 3 Jun 2010 01:59:16 +0000 (21:59 -0400)]
Fix device destroy return value

* Set return value in error cases
* Clarify error message when parent device is not vport capable

14 years agophyp: Strict check when listing domains
Eduardo Otubo [Tue, 1 Jun 2010 23:17:49 +0000 (20:17 -0300)]
phyp: Strict check when listing domains

14 years agoadd 802.1Qbh and 802.1Qbg handling
Stefan Berger [Thu, 3 Jun 2010 01:35:22 +0000 (21:35 -0400)]
add 802.1Qbh and 802.1Qbg handling

This patch that adds support for configuring 802.1Qbg and 802.1Qbh
switches. The 802.1Qbh part has been successfully tested with real
hardware. The 802.1Qbg part has only been tested with a (dummy)
server that 'behaves' similarly to how we expect lldpad to 'behave'.

The following changes were made during the development of this patch:

 - Merging Scott's v13-pre1 patch
 - Fixing endptr related bug while using virStrToLong_ui() pointed out
   by Jim Meyering
 - Addressing Jim Meyering's comments to v11
 - requiring mac address to the vpDisassociateProfileId() function to
   pass it further to the 802.1Qbg disassociate part (802.1Qbh untouched)
 - determining pid of lldpad daemon by reading it from /var/run/libvirt.pid
   (hardcode as is hardcode alson in lldpad sources)
 - merging netlink send code for kernel target and user space target
   (lldpad) using one function nlComm() to send the messages
 - adding a select() after the sending and before the reading of the
   netlink response in case lldpad doesn't respond and so we don't hang
 - when reading the port status, in case of 802.1Qbg, no status may be
   received while things are 'in progress' and only at the end a status
   will be there.
 - when reading the port status, use the given instanceId and vf to pick
   the right IFLA_VF_PORT among those nested under IFLA_VF_PORTS.
 - never sending nor parsing IFLA_PORT_SELF type of messages in the
   802.1Qbg case
 - iterating over the elements in a IFLA_VF_PORTS to pick the right
   IFLA_VF_PORT by either IFLA_PORT_PROFILE and given profileId
   (802.1Qbh) or IFLA_PORT_INSTANCE_UUID and given instanceId (802.1Qbg)
   and reading the current status in IFLA_PORT_RESPONSE.
 - recycling a previous patch that adds functionality to interface.c to
   - get the vlan identifier on an interface
   - get the flags of an interface and some convenience function to
     check whether an interface is 'up' or not (not currently used here)
 - adding function to determine the root physical interface of an
   interface. For example if a macvtap is linked to eth0.100, it will
   find eth0. Also adding a function that finds the vlan on the 'way to
   the root physical interface'
 - conveying the root physical interface name and index in case of 802.1Qbg
 - conveying mac address of macvlan device and vlan identifier in
   IFLA_VFINFO_LIST[ IFLA_VF_INFO[ IFLA_VF_MAC(mac), IFLA_VF_VLAN(vlan) ] ]
   to (future) lldpad via netlink
  - To enable build with --without-macvtap rename the
    [dis|]associatePortProfileId functions, prepend 'vp' before their
    name and make them non-static functions.
  - Renaming variable multicast to nltarget_kernel and inverting
    the logic
  - Addressing Jim Meyering's comments; this also touches existing
    code for example for correcting indentation of break statements or
    simplification of switch statements.
  - Renamed occurrencvirVirtualPortProfileDef to virVirtualPortProfileParamses
  - 802.1Qbg part prepared for sending a RTM_SETLINK and getting
    processing status back plus a subsequent RTM_GETLINK to
    get IFLA_PORT_RESPONSE.
    Note: This interface for 802.1Qbg may still change
  - [David Allan] move getPhysfn inside IFLA_VF_PORT_MAX to avoid
compiler
    warning when latest if_link.h isn't available
  - move from Stefan's 802.1Qb{g|h} XML v8 to v9
  - move hostuuid and vf index calcs to inside doPortProfileOp8021Qbh
  - remove debug fprintfs
  - use virGetHostUUID (thanks Stefan!)
  - fix compile issue when latest if_link.h isn't available
  - change poll timeout to 10s, at 1/8 intervals
     - if polling times out, log msg and return -ETIMEDOUT
  - Add Stefan's code for getPortProfileStatus
  - Poll for up to 2 secs for port-profile status, at 1/8 sec intervals:
     - if status indicates error, abort openMacvtapTap
     - if status indicates success, exit polling
     - if status is "in-progress" after 2 secs of polling, exit
       polling loop silently, without error

My patch finishes out the 802.1Qbh parts, which Stefan had mostly complete.
I've tested using the recent kernel updates for VF_PORT netlink msgs and
enic for Cisco's 10G Ethernet NIC.  I tested many VMs, each with several
direct interfaces, each configured with a port-profile per the XML.  VM-to-VM,
and VM-to-external work as expected.  VM-to-VM on same host (using same NIC)
works same as VM-to-VM where VMs are on diff hosts.  I'm able to change
settings on the port-profile while the VM is running to change the virtual
port behaviour.  For example, adjusting a QoS setting like rate limit.  All
VMs with interfaces using that port-profile immediatly see the effect of the
change to the port-profile.

I don't have a SR-IOV device to test so source dev is a non-SR-IOV device,
but most of the code paths include support for specifing the source dev and
VF index.  We'll need to complete this by discovering the PF given the VF
linkdev.  Once we have the PF, we'll also have the VF index.  All this info-
mation is available from sysfs.

14 years agobitmap: reject zero-size bitmap
Eric Blake [Wed, 2 Jun 2010 15:03:57 +0000 (09:03 -0600)]
bitmap: reject zero-size bitmap

* src/util/bitmap.c (virBitmapAlloc): Tighten sanity check.

14 years agohostusb: Properly handle 'usbX' sysfs files
Cole Robinson [Tue, 1 Jun 2010 18:46:26 +0000 (14:46 -0400)]
hostusb: Properly handle 'usbX' sysfs files

Fedora bug https://bugzilla.redhat.com/show_bug.cgi?id=598272

Some files under /sys/bus/usb/devices/ have the format 'usbX', where
X is the USB bus number. Use STRPREFIX to correctly parse the bus numbers.

14 years agoAdd --source-format argument to virsh pool-define-as and pool-create-as
Justin Clift [Sun, 30 May 2010 14:24:51 +0000 (00:24 +1000)]
Add --source-format argument to virsh pool-define-as and pool-create-as

This is the corresponding patch for the virsh man page (virsh.pod).

14 years agoAdd --source-format argument to virsh pool-define-as and pool-create-as
Justin Clift [Sun, 30 May 2010 14:24:45 +0000 (00:24 +1000)]
Add --source-format argument to virsh pool-define-as and pool-create-as

When creating pools from dedicated disks, the existing pool-define-as
and pool-create-as commands are a bit non-optimal.

Ideally, a person would be able to specify all of the required options
directly on the command line instead of having to edit the XML.

At the moment, there is no way to specify the format type (ie gpt) so it
gets included in the XML the pool is constructed with.

Please find attached a simple (tested) patch to add an optional
"--source-format 'type'" to virsh.  This is patched against current git
master and will apply cleanly.

Also created a Red Hat BZ ticket for this (#597790) for tracking.

14 years agoTrivial virsh.pod additions --all for "list" command and similar
Justin Clift [Sun, 30 May 2010 03:28:42 +0000 (13:28 +1000)]
Trivial virsh.pod additions --all for "list" command and similar

This is just a trivial patch to virsh.pod (from git master). It adds the
following pieces to the virsh man page:

  + Shows the --inactive and --all optional parameters for the list
    command.

    Closes Bugzilla #575512, reported by Renich Bon Ciric
    https://bugzilla.redhat.com/show_bug.cgi?id=575512

  + Corrects the existing description of the list command, to now say
    that only running domains are listed if no domains are specified.

    The man page up until this point has said all domains are listed if
    no domains are specified, which is incorrect.

  + Adds the "shut off" state to the list of states for the list
    command.

  + Adds a missing =back around line 755, that pod2man was complaining
    was missing.

14 years agobuild: fix VPATH 'make syntax-check'
Eric Blake [Tue, 1 Jun 2010 22:34:25 +0000 (16:34 -0600)]
build: fix VPATH 'make syntax-check'

* cfg.mk (sc_check_author_list): Look in correct location.

14 years agobuild: depend on correct file
Eric Blake [Tue, 1 Jun 2010 20:39:24 +0000 (14:39 -0600)]
build: depend on correct file

Otherwise, VPATH builds fail with:

make[1]: *** No rule to make target `libvirt-guests.init', needed by `all'.

Regression introduced in commit 482e08a9.

* daemon/Makefile.am (%.init): Look in correct place for
config.status.

14 years agoqemu: Add a qemu.conf option for clearing capabilities
Cole Robinson [Thu, 27 May 2010 23:17:55 +0000 (19:17 -0400)]
qemu: Add a qemu.conf option for clearing capabilities

Currently there is no way to opt out of libvirt dropping POSIX
capabilities for qemu. This at least is a useful debugging tool, but
is also wanted by users (and distributors):

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

v2: Clarify qemu.conf comment, warn about security implications

v3: Add .aug changes

14 years agobuild: make cpp indentation conform
Jim Meyering [Sat, 29 May 2010 07:45:21 +0000 (09:45 +0200)]
build: make cpp indentation conform

* src/storage/storage_backend.h (VIR_STORAGE_VOL_OPEN_DEFAULT):
Adjust s/#define/# define/, and align continued lines.

14 years agostorage: Check for invalid storage mode before opening
Cole Robinson [Thu, 20 May 2010 18:25:01 +0000 (14:25 -0400)]
storage: Check for invalid storage mode before opening

If a directory pool contains pipes or sockets, a pool start can fail or hang:

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

We already try to avoid these special files, but only attempt after
opening the path, which is where the problems lie. Unify volume opening
into helper functions, which use the proper open() flags to avoid error,
followed by fstat to validate storage mode.

Previously, virStorageBackendUpdateVolTargetInfoFD attempted to enforce the
storage mode check, but allowed callers to detect this case and silently
continue. In practice, only the FS backend was using this feature, the rest
were treating unknown mode as an error condition. Unfortunately the InfoFD
function wasn't raising an error message here, so error reporting was
busted.

This patch adds 2 functions: virStorageBackendVolOpen, and
virStorageBackendVolOpenModeSkip. The latter retains the original opt out
semantics, the former now throws an explicit error.

This patch maintains the previous volume mode checks: allowing specific
modes for specific pool types requires a bit of surgery, since VolOpen
is called through several different helper functions.

v2: Use ATTRIBUTE_NONNULL. Drop stat check, just open with
    O_NONBLOCK|O_NOCTTY.

v3: Move mode check logic back to VolOpen. Use 2 VolOpen functions with
    different error semantics.

v4: Make second VolOpen function more extensible. Didn't opt to change
    FS backend defaults, this can just be to fix the original bug.

v5: Prefix default flags with VIR_, use ATTRIBUTE_RETURN_CHECK

14 years agomacvtap: cannot support target device name
Stefan Berger [Fri, 28 May 2010 17:00:58 +0000 (13:00 -0400)]
macvtap: cannot support target device name

Since the macvtap device needs active tear-down and the teardown logic
is based on the interface name, it can happen that if for example 1 out
of 3 interfaces was successfully created, that during the failure path
the macvtap's target device name is used to tear down an interface that
is doesn't own (owned by another VM).

So, in this patch, the target interface name is reset so that there is
no target interface name and the interface name is always cleared after
a tear down.

14 years agoImprove nodedev parent/child relationships
David Allan [Thu, 27 May 2010 21:36:54 +0000 (17:36 -0400)]
Improve nodedev parent/child relationships

* If a nodedev has a parent that we don't want to display, we should
  continue walking up the udev device tree to see if any of its
  earlier ancestors are devices that we display.  It makes the tree
  much nicer looking than having a whole lot of devices hanging off
  the root node.

14 years agoFix libvirt-guests init script
Jiri Denemark [Thu, 27 May 2010 12:47:11 +0000 (14:47 +0200)]
Fix libvirt-guests init script

Firstly, the init script has to touch its file under /var/lock/subsys
when started, otherwise the system would think it's not running and
won't stop it during shutdown.

Secondly, for some reason there is a policy to automatically enable
init scripts when they are installed, so let the specfile do this. We
also need to start the init script to ensure it will be stopped during
the first shutdown after installing the package.

Also $LISTFILE should be enclosed by quotes everywhere as suggested by
Eric.

14 years agomaint: new syntax-check rule to ensure that AUTHORS stays in sync
Jim Meyering [Fri, 28 May 2010 09:27:12 +0000 (11:27 +0200)]
maint: new syntax-check rule to ensure that AUTHORS stays in sync

* cfg.mk (sc_check_AUTHOR_list): New rule.
* .mailmap: New file, to tell git log how to map email addresses.

14 years agohooks: fix typo
Paolo Smiraglia [Fri, 28 May 2010 12:54:28 +0000 (06:54 -0600)]
hooks: fix typo

* src/util/hooks.c (virHookLxcOp): Use correct bound.

14 years agobuild: silence cppi warning, clarify vbox headers
Eric Blake [Thu, 27 May 2010 22:35:06 +0000 (16:35 -0600)]
build: silence cppi warning, clarify vbox headers

These files are borrowed from upstream release versions, and should
not need further edits in the context of libvirt (instead, a new
upstream vbox release would entail adding a new header file).  We do
not re-generate these files as part of libvirt, nor do we want to lose
our minor edits (such as cppi cleanups).

* src/vbox/vbox_CAPI_v2_2.h: Clarify file origins.
* src/vbox/vbox_CAPI_v3_0.h: Likewise.
* src/vbox/vbox_CAPI_v3_1.h: Likewise.
* src/vbox/vbox_CAPI_v3_2.h: Likewise.  Reindent with cppi.

14 years agonetwork: bridge: Don't start network if it collides with host routing
Cole Robinson [Thu, 20 May 2010 23:31:16 +0000 (19:31 -0400)]
network: bridge: Don't start network if it collides with host routing

Fedora bug https://bugzilla.redhat.com/show_bug.cgi?id=235961

If using the default virtual network, an easy way to lose guest network
connectivity is to install libvirt inside the VM. The autostarted
default network inside the guest collides with host virtual network
routing. This is a long standing issue that has caused users quite a
bit of pain and confusion.

On network startup, parse /proc/net/route and compare the requested
IP+netmask against host routing destinations: if any matches are found,
refuse to start the network.

v2: Drop sscanf, fix a comment typo, comment that function could use
    libnl instead of /proc

v3: Consider route netmask. Compare binary data rather than convert to
    string.

v4: Return to using sscanf, drop inet functions in favor of virSocket,
    parsing safety checks. Don't make parse failures fatal, in case
    expected format changes.

v5: Try and continue if we receive unexpected. Delimit parsed lines to
    prevent scanning past newline

14 years agomaint: update AUTHORS with recent contributors
Eric Blake [Thu, 27 May 2010 21:24:19 +0000 (15:24 -0600)]
maint: update AUTHORS with recent contributors

git shortlog $(git log -1 --format=%H AUTHORS).. | grep -v "^ "

then add missing entries to AUTHORS.

* AUTHORS: Update.

14 years agoxen: Fix chardev listen sexpr formatting
Cole Robinson [Wed, 26 May 2010 02:31:27 +0000 (22:31 -0400)]
xen: Fix chardev listen sexpr formatting

'listen' isn't a valid qemu-dm option, as reported a long time ago here:

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

Matches the near identical logic in qemu_conf.c

v2: When parsing sexpr, only match on ",server", rather than
    full ',server,nowait'.

14 years agoxen: Remove unused function
Cole Robinson [Wed, 26 May 2010 02:27:53 +0000 (22:27 -0400)]
xen: Remove unused function

Signed-off-by: Cole Robinson <crobinso@redhat.com>
14 years agov2 of Cole's wlan support
David Allan [Thu, 27 May 2010 14:44:02 +0000 (10:44 -0400)]
v2 of Cole's wlan support

* Incorporated Jim's feedback (v1 & v2)

* Moved case of DEVTYPE == "wlan" up as it's definitive that we have a network interface.

* Made comment more detailed about the wired case to explain better
  how it differentiates between wired network interfaces and USB
  devices.

14 years agoAdd docs on drive <serial> element
Марк Коренберг [Thu, 27 May 2010 11:44:41 +0000 (12:44 +0100)]
Add docs on drive <serial> element

* docs/formatdomain.html.in: Document <serial> element within
  <disk> and fix typo on <driver/> element

14 years agoesx: Simplify goto usage
Matthias Bolte [Wed, 19 May 2010 20:59:32 +0000 (22:59 +0200)]
esx: Simplify goto usage

Eliminate almost all backward jumps by replacing this common pattern:

int
some_random_function(void)
{
    int result = 0;
    ...

  cleanup:
    <unconditional cleanup code>
    return result;

  failure:
    <cleanup code in case of an error>
    result = -1;
    goto cleanup
}

with this simpler pattern:

int
some_random_function(void)
{
    int result = -1;
    ...
    result = 0;

  cleanup:
    if (result < 0) {
        <cleanup code in case of an error>
    }

    <unconditional cleanup code>
    return result;
}

Add a bool success variable in functions that don't have a int result
that can be used for the new pattern.

Also remove some unnecessary memsets in error paths.

14 years agoSupport for VirtualBox version 3.2
Jean-Baptiste Rouault [Wed, 26 May 2010 11:54:16 +0000 (13:54 +0200)]
Support for VirtualBox version 3.2

14 years agoUse printf instead of echo -e in libvirt.spec.in
Matthias Bolte [Wed, 26 May 2010 21:06:09 +0000 (23:06 +0200)]
Use printf instead of echo -e in libvirt.spec.in

make rpm created dummy tests containing '-e #!/bin/sh' for me.

14 years agoInstall, distribute and package domainsnapshot.rng
Matthias Bolte [Wed, 26 May 2010 21:03:47 +0000 (23:03 +0200)]
Install, distribute and package domainsnapshot.rng