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

14 years agobuild: support 'make check' in pristine tree
Eric Blake [Wed, 26 May 2010 21:56:04 +0000 (15:56 -0600)]
build: support 'make check' in pristine tree

Otherwise, 'make check' in the python dir tries to reference a file in
docs that is built by 'make' but not by 'make check'.

* docs/Makefile.am (check-local): New rule.
Reported by Matthias Bolte.

14 years agoesx: Expose host UUID in the capabilities XML
Matthias Bolte [Wed, 26 May 2010 11:05:49 +0000 (13:05 +0200)]
esx: Expose host UUID in the capabilities XML

Parse the BIOS UUID. This information may not be available, in that
case no host UUID is exposed in the capabilities XML.

14 years agoFix integer overflow in hotplug methods
Daniel P. Berrange [Wed, 26 May 2010 12:34:45 +0000 (13:34 +0100)]
Fix integer overflow in hotplug methods

The hotplug methods still had the qemuCmdFlags variable declared
as an int, instead of unsigned long long. This caused flag checks
to be incorrect for flags > 31

* src/qemu/qemu_driver.c: Fix integer overflow in hotplug

14 years agoPass pre-opened PCI device sysfs config file to QEMU
Alex Williamson [Wed, 26 May 2010 12:32:38 +0000 (13:32 +0100)]
Pass pre-opened PCI device sysfs config file to QEMU

This allows libvirt to open the PCI device sysfs config file prior
to dropping privileges so qemu can access the full config space.
Without this, a de-privileged qemu can only access the first 64
bytes of config space.

* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Detect support
  for pci-assign.configfd option. Use this option when formatting
  PCI device string if possible
* src/qemu/qemu_driver.c: Pre-open PCI sysfs config file and pass
  to QEMU

14 years agodaemon: sysconf: Update comment about VNC audio
Cole Robinson [Wed, 26 May 2010 14:51:36 +0000 (10:51 -0400)]
daemon: sysconf: Update comment about VNC audio

14 years agoFix failing virGetHostname.
Chris Lalancette [Thu, 20 May 2010 17:16:30 +0000 (13:16 -0400)]
Fix failing virGetHostname.

We've been running into a lot of situations where
virGetHostname() is returning "localhost", where a plain
gethostname() would have returned the correct thing.  This
is because virGetHostname() is *always* trying to canonicalize
the name returned from gethostname(), even when it doesn't
have to.

This patch changes virGetHostname so that if the value returned
from gethostname() is already FQDN or localhost, it returns
that string directly.  If the value returned from gethostname()
is a shortened hostname, then we try to canonicalize it.  If
that succeeds, we returned the canonicalized hostname.  If
that fails, and/or returns "localhost", then we just return
the original string we got from gethostname() and hope for
the best.

Note that after this patch it is up to clients to check whether
"localhost" is an allowed return value.  The only place
where it's currently not is in qemu migration.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoxen-proxy build broken
Matthias Bolte [Wed, 26 May 2010 10:45:28 +0000 (06:45 -0400)]
xen-proxy build broken

The virVirtualPortProfileFormat just went below the
virVirtualPortProfileParamsParseXML function and got inside the

The attached patch moves virVirtualPortProfileFormat below the #ifndef
PROXY block.

14 years agoesx: Add read-only storage pool access
Matthias Bolte [Tue, 18 May 2010 16:11:59 +0000 (18:11 +0200)]
esx: Add read-only storage pool access

Allows listing existing pools and requesting information about them.

Alter the esxVI_ProductVersion enum in a way that allows to check for
product type by masking.

14 years agobuild: fix HTML errors in nwfilter docs
Eric Blake [Tue, 25 May 2010 23:20:51 +0000 (17:20 -0600)]
build: fix HTML errors in nwfilter docs

A build on Ubuntu reported:

|| Generating formatnwfilter.html.tmp
/dados/develop/libvirt/docs/formatnwfilter.html.in|390| HTML parser error : Unexpected end tag : p
||     </p>
||         ^
/dados/develop/libvirt/docs/formatnwfilter.html.in|705| HTML parser error : Unexpected end tag : code
||          <td>End of range of valid source ports</code></td>
||                                                       ^
/dados/develop/libvirt/docs/formatnwfilter.html.in|710| HTML parser error : Unexpected end tag : code
||          <td>Start of range of valid destination ports</code></td>
||                                                              ^

* docs/formatnwfilter.html.in: Fix invalid HTML constructs.
Reported by Eduardo Otubo.

14 years agobuild: fix compilation without macvtap
Eric Blake [Tue, 25 May 2010 22:44:05 +0000 (16:44 -0600)]
build: fix compilation without macvtap

* src/util/macvtap.c: (associatePortProfileId)
(disassociatePortProfileId): Move inside HAVE_MACVTAP
conditional.
Reported by Eduardo Otubo.

14 years agotests: avoid new failure of the daemon-conf test
Jim Meyering [Tue, 25 May 2010 19:12:01 +0000 (21:12 +0200)]
tests: avoid new failure of the daemon-conf test

* tests/daemon-conf: Accommodate the fact that out template,
daemon/libvirtd.conf now contains an invalid host_uuid.
Convert it to a valid one before the final libvirtd-running
test that must terminate normally.

14 years agolibvirtd: diagnose invalid host UUID
Jim Meyering [Tue, 25 May 2010 19:12:01 +0000 (21:12 +0200)]
libvirtd: diagnose invalid host UUID

* daemon/libvirtd.c (remoteReadConfigFile): Diagnose an invalid
host UUID rather than silently exiting with status 7.

14 years agovepa: parsing for 802.1Qb{g|h} XML
Stefan Berger [Tue, 25 May 2010 21:37:00 +0000 (17:37 -0400)]
vepa: parsing for 802.1Qb{g|h} XML

This patch parses the following two XML descriptions, one for
802.1Qbg and one for 802.1Qbh, and stores the data internally.
The actual triggering of the switch setup protocol has not been
implemented here but the relevant code to do that should go into
the functions associatePortProfileId() and disassociatePortProfileId().

   <interface type='direct'>
      <source dev='eth0.100' mode='vepa'/>
      <model type='virtio'/>
      <virtualport type='802.1Qbg'>
        <parameters managerid='12' typeid='0x123456' typeidversion='1'
         instanceid='fa9b7fff-b0a0-4893-8e0e-beef4ff18f8f'/>
      </virtualport>
      <filterref filter='clean-traffic'/>
    </interface>

    <interface type='direct'>
      <source dev='eth0.100' mode='vepa'/>
      <model type='virtio'/>
      <virtualport type='802.1Qbh'>
        <parameters profileid='my_profile'/>
      </virtualport>
    </interface>

I'd suggest to use this patch as a base for triggering the setup
protocol with the 802.1Qb{g|h} switch.

Several rounds of changes were made to this patch. The
following is a list of these changes.
- Renamed structure virVirtualPortProfileDef to virVirtualPortProfileParams
  as per Daniel Berrange's request
- Addressing Daniel Berrange's comments:
 - removing macvtap.h's dependency on domain_conf.h by
   moving the virVirtualPortProfileDef structure into macvtap.h
   and not passing virtDomainNetDefPtr to any functions in
   macvtap.c
- Addressed most of Chris Wright's comments:
  - indicating error in case virtualport XML node cannot be parsed
    properly
  - parsing hex and decimal numbers using virStrToLong_ui() with
    parameter '0' for base
  - tgifname (target interface name) variable wasn't necessary
    to pass to openMacvtapTap function anymore
- assigning the virtual port data structure to the virDomainNetDef
  only if it was previously parsed
- make sure that the error code returned by openMacvtapTap() is a negative n
  in case the associatePortProfileId() function failed.
- renaming vsi in the XML to virtualport
- replace all occurrences of vsi in the source as well
- removing mode and MAC address parameters from the functions that
  will communicate with the hareware diretctly or indirectly
- moving the associate and disassociate functions to the end of the
  file for subsequent patches to easier make them generally available
  for export
- passing the macvtap interface name rather than the link device since
  this otherwise gives funny side effects when using netlink messages
  where IFLA_IFNAME and IFLA_ADDRESS are specified and the link dev
  all of a sudden gets the MAC address of the macvtap interface.
- Removing rc = -1 error indications in the case of 802.1Qbg|h setup in case
  we wanted to use hook scripts for the setup and so the setup doesn't fail
  here.
- if instance ID UUID is not supplied it will automatically be generated
  - adapted schema to make instance ID UUID optional
  - added test case
- parser and XML generator have been separated into their own
  functions so they can be re-used elsewhere (passthrough case
  for example)
- Adapted XML parser and generator support the above shown type
  (802.1Qbg, 802.1Qbh).
- Adapted schema to above XML
- Adapted test XML to above XML
- Passing through the VM's UUID which seems to be necessary for
  802.1Qbh -- sorry no host UUID
- adding virtual function ID to association function, in case it's
  necessary to use (for SR-IOV)

14 years agovepa+vsi: Introduce dependency on libnl
Stefan Berger [Tue, 25 May 2010 19:31:38 +0000 (15:31 -0400)]
vepa+vsi: Introduce dependency on libnl

This patch introduces a dependency on libnl, which subsequent patches
will then use.

Changes from V1 to V2:
- added diffstats
- following changes in tree

14 years agostorage: Sanitize pool target paths
Cole Robinson [Thu, 20 May 2010 15:41:31 +0000 (11:41 -0400)]
storage: Sanitize pool target paths

Spurious / in a pool target path makes life difficult for apps using the
GetVolByPath, and doing other path based comparisons with pools. This
has caused a few issues for virt-manager users:

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

Add a new util API which removes spurious /, virFileSanitizePath. Sanitize
target paths when parsing pool XML, and for paths passed to GetVolByPath.

v2: Leading // must be preserved, properly sanitize path=/, sanitize
    away /./ -> /

v3: Properly handle starting ./ and ending /.

v4: Drop all '.' handling, just sanitize / for now.

14 years agoExpose a host UUID in the capabilities XML
Daniel P. Berrange [Tue, 25 May 2010 14:33:51 +0000 (15:33 +0100)]
Expose a host UUID in the capabilities XML

Allow for a host UUID in the capabilities XML. Local drivers
will initialize this from the SMBIOS data. If a sanity check
shows SMBIOS uuid is invalid, allow an override from the
libvirtd.conf configuration file

* daemon/libvirtd.c, daemon/libvirtd.conf: Support a host_uuid
  configuration option
* docs/schemas/capability.rng: Add optional host uuid field
* src/conf/capabilities.c, src/conf/capabilities.h: Include
  host UUID in XML
* src/libvirt_private.syms: Export new uuid.h functions
* src/lxc/lxc_conf.c, src/qemu/qemu_driver.c,
  src/uml/uml_conf.c: Set host UUID in capabilities
* src/util/uuid.c, src/util/uuid.h: Support for host UUIDs
* src/node_device/node_device_udev.c: Use the host UUID functions
* tests/confdata/libvirtd.conf, tests/confdata/libvirtd.out: Add
  new host_uuid config option to test

14 years agoFix handling of disk backing stores with cgroups
Daniel P. Berrange [Wed, 28 Apr 2010 15:25:42 +0000 (16:25 +0100)]
Fix handling of disk backing stores with cgroups

The cgroups ACL code was only allowing the primary disk image.
It is possible to chain images together, so we need to search
for backing stores and add them to the ACL too. Since the ACL
only handles block devices, we ignore the EINVAL we get from
plain files. In addition it was missing code to teardown the
cgroup when hot-unplugging a disk

* src/qemu/qemu_driver.c: Allow backing stores in cgroup ACLs
  and add missing teardown code in unplug path

14 years agoFix up basic migration.
Chris Lalancette [Thu, 20 May 2010 19:25:41 +0000 (15:25 -0400)]
Fix up basic migration.

Basic live migration was broken by the commit that added
non-shared block support in two ways:

1)  It added a virCheckFlags() to doNativeMigrate().  Besides
the fact that typical usage of virCheckFlags() is in driver
entry points, and doNativeMigrate() is not an entry point,
it was missing important flags like VIR_MIGRATE_LIVE.  Move
the virCheckFlags to the top-level qemuDomainMigratePrepare2
and friends.

2)  It also added a memory leak in qemuMonitorTextMigrate()
by not freeing the memory used by virBufferContentAndReset().
This is fixed by storing the pointer in a temporary variable
and freeing it at the end.

With this patch in place, normal live migration works again.

v3: Instead of the churn for virCheckFlagsUI and UL, instead
always promote flags to an unsigned long and always use %lx
for the fprintf.
v2: Add back flags check, which required adding virCheckFlagsUI
and virCheckFlagsUL

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoqemu: Allow using regular audio backends with VNC
Cole Robinson [Wed, 19 May 2010 20:41:01 +0000 (16:41 -0400)]
qemu: Allow using regular audio backends with VNC

Currently all host audio backends are disabled if a VM is using VNC, in
favor of the QEMU VNC audio extension. Unfortunately no released VNC
client supports this extension, so users have no way of getting audio
to work if using VNC.

Add a new config option in qemu.conf which allows changing libvirt's
behavior, but keep the default intact.

v2: Fix doc typos, change name to vnc_allow_host_audio

14 years agostorage: mpath: Fix incorrect VIR_ERROR use
Cole Robinson [Mon, 24 May 2010 18:41:14 +0000 (14:41 -0400)]
storage: mpath: Fix incorrect VIR_ERROR use

14 years agoAllow nwfilter functions to be compiled with C++
Chris Lalancette [Mon, 24 May 2010 15:55:55 +0000 (11:55 -0400)]
Allow nwfilter functions to be compiled with C++

Unfortunately the NWFilter functions were outside of the
"extern C { ... }" declaration in include/libvirt/libvirt.h.in,
which means that they couldn't be properly used with C++.  Move
them inside of the braces, which should fix the problem.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agonwfilter: documentation
Stefan Berger [Tue, 25 May 2010 11:09:31 +0000 (07:09 -0400)]
nwfilter: documentation

This patch adds documentation of the nwfilter subsystem of libvirt to
the existing (web) docs.

14 years agomaint: update AUTHORS with recent contributors
Eric Blake [Mon, 24 May 2010 22:29:06 +0000 (16:29 -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 agoqemu: Release bus address on PCI host device remove
Alex Williamson [Mon, 24 May 2010 17:33:48 +0000 (13:33 -0400)]
qemu: Release bus address on PCI host device remove

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
14 years agoqemu: avoid corrupting guest info struct on host device PCI hot add
Alex Williamson [Mon, 24 May 2010 17:33:27 +0000 (13:33 -0400)]
qemu: avoid corrupting guest info struct on host device PCI hot add

The device path doesn't make use of guestAddr, so the memcpy corrupts
the guest info struct.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
14 years agoQuery block allocation extent from QEMU monitor
Daniel P. Berrange [Fri, 14 May 2010 13:10:01 +0000 (09:10 -0400)]
Query block allocation extent from QEMU monitor

The virDomainGetBlockInfo API allows query physical block
extent and allocated block extent. These are normally the
same value unless storing a special format like qcow2
inside a block device. In this scenario we can query QEMU
to get the actual allocated extent.

Since last time:

 - Return fatal error in text monitor
 - Only invoke monitor command for block devices
 - Fix error handling JSON code

* src/qemu/qemu_driver.c: Fill in block aloction extent when VM
  is running
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
  src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
  API to query the highest block extent via info blockstats

14 years agolxcSetSchedulerParameters: reverse order of tests; diagnose a failure
Jim Meyering [Tue, 11 May 2010 13:51:46 +0000 (15:51 +0200)]
lxcSetSchedulerParameters: reverse order of tests; diagnose a failure

* src/lxc/lxc_driver.c (lxcSetSchedulerParameters): Ensure that
"->field" is "cpu_shares" before possibly giving a diagnostic about
a type for a "cpu_shares" value.
Also, virCgroupSetCpuShares could fail without evoking a diagnostic.
Add one.

14 years agoDon't overwrite virDomainAssignDef errors.
Chris Lalancette [Tue, 11 May 2010 20:44:09 +0000 (16:44 -0400)]
Don't overwrite virDomainAssignDef errors.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agostorage: Combine some duplicate code
Cole Robinson [Thu, 20 May 2010 17:29:24 +0000 (13:29 -0400)]
storage: Combine some duplicate code

Volume detection in the scsi backend was duplicating code already
present in storage_backend.c. Let's drop the duplicate code.

Also, change the shared function name to be less generic, and remove
some error squashing in the other call site.

14 years agostorage: mpath: Clean up some error handling
Cole Robinson [Thu, 20 May 2010 18:16:54 +0000 (14:16 -0400)]
storage: mpath: Clean up some error handling

We were squashing error messages in a few cases. Recode to follow common
ret = -1 convention.

v2: Handle more error squashing issues further up in MakeNewVol and
    CreateVols. Use ret = -1 convention in MakeVols.

14 years agoRemove dead code after refactoring qemudDomainStart
Jiri Denemark [Fri, 21 May 2010 09:32:03 +0000 (11:32 +0200)]
Remove dead code after refactoring qemudDomainStart

The event is already generated and sent by qemudDomainObjStart, no need
to do anything about here.

14 years agolibvirtd: start each diagnostic with "argv0: "
Jim Meyering [Thu, 20 May 2010 19:40:54 +0000 (21:40 +0200)]
libvirtd: start each diagnostic with "argv0: "

Some diagnostics had a hard-coded "libvirtd: " prefix, some used
"error: " and some used "argv[0]: ".  Always use "argv[0]: ".
* daemon/libvirtd.c (argv0): New global.
(main): Set it.
(version, usage): Remove argv0 parameter.  Use global; update callers.
(daemonForkIntoBackground): Use argv0:, not error:.
(qemudWritePidFile): Start each diagnostic with argv0:.
Suggested by Eric Blake.

14 years agolibvirtd: mark strings for translation, including --help output
Jim Meyering [Thu, 20 May 2010 08:01:32 +0000 (10:01 +0200)]
libvirtd: mark strings for translation, including --help output

* daemon/libvirtd.c (daemonForkIntoBackground, main): Mark strings
for translation.
(usage): Rework --help so that it is translatable, replacing
each embedded, configuration-dependent, macro with an `%s'.

libvirtd: don't ignore virInitialize failure
* daemon/libvirtd.c (main): Diagnose virInitialize failure
and exit nonzero.

14 years agobuild: fix cppi warnings
Eric Blake [Fri, 21 May 2010 22:02:18 +0000 (16:02 -0600)]
build: fix cppi warnings

* src/util/bitmap.h (includes): Placate cppi.

14 years agobuild: force init scripts to rebuild on changed --prefix
Eric Blake [Fri, 21 May 2010 21:18:24 +0000 (15:18 -0600)]
build: force init scripts to rebuild on changed --prefix

Otherwise, './configure --prefix=/foo && make &&
 ./configure --prefix=/bar && make' leaves the wrong files
in libvirtd.init (/foo instead of /bar).

* daemon/Makefile.am (libvirtd.init): Add dependency on
config.status.  Reported by Cole Robinson.

14 years agobuild: Distribute the whole tests/qemuhelpdata directory
Matthias Bolte [Fri, 21 May 2010 18:00:24 +0000 (20:00 +0200)]
build: Distribute the whole tests/qemuhelpdata directory

Instead of distributing the individual files.

Now it's less error prone and consistent with the rest of
the data directories in the tests directory.

14 years ago.gitignore: Add libvirt-guests.init
Cole Robinson [Fri, 21 May 2010 17:58:08 +0000 (13:58 -0400)]
.gitignore: Add libvirt-guests.init

14 years agoFix race in finding available vnc port
Jim Fehlig [Fri, 21 May 2010 13:52:09 +0000 (07:52 -0600)]
Fix race in finding available vnc port

The qemu driver contains a subtle race in the logic to find next
available vnc port.  Currently it iterates through all available ports
and returns the first for which bind(2) succeeds.  However it is possible
that a previously issued port has not yet been bound by qemu, resulting
in the same port used for a subsequent domain.

This patch addresses the race by using a simple bitmap to "reserve" the
ports allocated by libvirt.

V2:
  - Put port bitmap in struct qemud_driver
  - Initialize bitmap in qemudStartup

V3:
  - Check for failure of virBitmapGetBit
  - Additional check for port != -1 before calling virbitmapClearBit

V4:
  - Check for failure of virBitmap{Set,Clear}Bit

14 years agoAdd defines for QEMU_VNC_PORT_{MIN,MAX} and use them
Jim Fehlig [Fri, 21 May 2010 04:25:16 +0000 (22:25 -0600)]
Add defines for QEMU_VNC_PORT_{MIN,MAX} and use them

14 years agoAdd simple bitmap operations to utils
Jim Fehlig [Fri, 21 May 2010 04:23:48 +0000 (22:23 -0600)]
Add simple bitmap operations to utils

V2:
  - Move bitmap impl to src/util/bitmap.[ch]
  - Use CHAR_BIT instead of explicit '8'
  - Use size_t instead of unsigned int
  - Fix calculation of bitmap size in virBitmapAlloc
  - Ensure bit is within range of map in the set, clear, and get
    operations
  - Use bool in virBitmapGetBit
  - Add virBitmapFree to free-like funcs in cfg.mk

V3:
  - Check for overflow in virBitmapAlloc
  - Fix copy and paste bug in virBitmapAlloc
  - Use size_t in prototypes
  - Add ATTRIBUTE_NONNULL in prototypes where appropriate
    and remove NULL check from impl

V4:
  - Add ATTRIBUTE_RETURN_CHECK in prototypes where appropriate.

14 years agodaemon: Export SDL audio environment variables
Cole Robinson [Wed, 19 May 2010 20:03:52 +0000 (16:03 -0400)]
daemon: Export SDL audio environment variables

/etc/sysconfig/libvirtd has a few environment variables for configuring
libvirt SDL audio. The libvirtd process doesn't see these, however, because
they are never exported. Let's export the variables after sourcing the
sysconfig script.

There is another problem here that the commented out values in the
sysconfig script are not neccessarily the actual defaults, we are qemus
mercy here. Not sure how to solve that.

14 years agoRemove isValidIfname.
Chris Lalancette [Thu, 20 May 2010 17:20:24 +0000 (13:20 -0400)]
Remove isValidIfname.

We shouldn't be checking validity in domain_conf, since
it can be used by multiple different hosts and hypervisors.
Remove the check completely.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoInit script for handling guests on shutdown/boot
Jiri Denemark [Fri, 14 May 2010 13:37:55 +0000 (15:37 +0200)]
Init script for handling guests on shutdown/boot

Example output during shutdown:

Running guests on default URI: console, rhel6-1, rhel5-64
Running guests on lxc:/// URI: lxc-shell
Running guests on xen:/// URI: error: no hypervisor driver available for xen:///
error: failed to connect to the hypervisor
Running guests on vbox+tcp://orkuz/system URI: no running guests.
Suspending guests on default URI...
Suspending console: done
Suspending rhel6-1: done
Suspending rhel5-64: done
Suspending guests on lxc:/// URI...
Suspending lxc-shell: error: Failed to save domain 9cba8bfb-56f4-6589-2d12-8a58c886dd3b state
error: this function is not supported by the hypervisor: virDomainManagedSave

Note, the "Suspending $guest: " shows progress during the suspend phase
if domjobinfo gives meaningful output.

Example output during boot:

Resuming guests on default URI...
Resuming guest rhel6-1: done
Resuming guest rhel5-64: done
Resuming guest console: done
Resuming guests on lxc:/// URI...
Resuming guest lxc-shell: already active

Configuration used for generating the examples above:
URIS='default lxc:/// xen:/// vbox+tcp://orkuz/system'

The script uses /var/lib/libvirt/libvirt-guests files to note all active
guest it should try to resume on next boot. It's content looks like:

default 7f8b9d93-30e1-f0b9-47a7-cb408482654b 085b4c95-5da2-e8e1-712f-6ea6a4156af2 fb4d8360-5305-df3a-2da1-07d682891b8c
lxc:/// 9cba8bfb-56f4-6589-2d12-8a58c886dd3b

14 years agoAutostart domains using virDomainObjStart
Jiri Denemark [Thu, 20 May 2010 10:02:58 +0000 (12:02 +0200)]
Autostart domains using virDomainObjStart

14 years agoRefactor qemudDomainStart
Jiri Denemark [Thu, 20 May 2010 10:01:16 +0000 (12:01 +0200)]
Refactor qemudDomainStart

We need a common internal function for starting managed domains to be
used during autostart. This patch factors out relevant code from
qemudDomainStart into qemudDomainObjStart and makes it use the
refactored code for domain restore instead of calling qemudDomainRestore
API directly.

14 years agoFactor out def assignment to existing domain from virDomainAssignDef
Jiri Denemark [Thu, 20 May 2010 09:36:24 +0000 (11:36 +0200)]
Factor out def assignment to existing domain from virDomainAssignDef

We need to be able to assign new def to an existing virDomainObj which
is already locked. This patch factors out the relevant code from
virDomainAssignDef into virDomainObjAssignDef.

14 years agoRefactor qemudDomainRestore
Jiri Denemark [Thu, 20 May 2010 09:55:32 +0000 (11:55 +0200)]
Refactor qemudDomainRestore

We need to be able to restore a domain which we already locked and
started a job for it without undoing these steps. This patch factors
out internals of qemudDomainRestore into separate functions which work
for locked objects.

14 years agomaint: update po/POTFILES.in
Jim Meyering [Thu, 20 May 2010 06:59:01 +0000 (08:59 +0200)]
maint: update po/POTFILES.in

* po/POTFILES.in: Add 3 files.

14 years agomaint: enforce policy wrt VIR_DEBUG and VIR_DEBUG0
Jim Meyering [Thu, 20 May 2010 06:56:48 +0000 (08:56 +0200)]
maint: enforce policy wrt VIR_DEBUG and VIR_DEBUG0

* cfg.mk (sc_prohibit_gettext_markup): Just like VIR_WARN*.

14 years agomaint: don't mark VIR_DEBUG or VIR_DEBUG0 diagnostics for translation
Jim Meyering [Thu, 20 May 2010 06:57:06 +0000 (08:57 +0200)]
maint: don't mark VIR_DEBUG or VIR_DEBUG0 diagnostics for translation

Run this command:
  git grep -l VIR_DEBUG|xargs perl -pi -e \
    's/(VIR_DEBUG0?)\s*\(_\((".*?")\)/$1($2/'

14 years agomaint: enforce policy wrt VIR_ERROR and VIR_ERROR0
Jim Meyering [Thu, 20 May 2010 06:44:23 +0000 (08:44 +0200)]
maint: enforce policy wrt VIR_ERROR and VIR_ERROR0

* cfg.mk (msg_gen_function): Add VIR_ERROR and VIR_ERROR0,
so that sc_libvirt_unmarked_diagnostics will check them, too.

14 years agomaint: change "" in err ? err->message : "" to _("unknown error"), ...
Jim Meyering [Thu, 20 May 2010 06:44:27 +0000 (08:44 +0200)]
maint: change "" in err ? err->message : "" to _("unknown error"), ...

These changes avoid false-positive syntax-check failure,
and also make the resulting diagnostics more comprehensible.

14 years agomaint: more of same, but manual: convert VIR_ERROR("%s" to VIR_ERROR0(
Jim Meyering [Thu, 20 May 2010 06:40:16 +0000 (08:40 +0200)]
maint: more of same, but manual: convert VIR_ERROR("%s" to VIR_ERROR0(

14 years agomaint: VIR_ERROR/VIR_ERROR0: mark up the remaining ones manually
Jim Meyering [Thu, 20 May 2010 06:28:53 +0000 (08:28 +0200)]
maint: VIR_ERROR/VIR_ERROR0: mark up the remaining ones manually

Handle concatenated strings manually.

14 years agomaint: mark translatable string args of VIR_ERROR
Jim Meyering [Thu, 20 May 2010 06:15:46 +0000 (08:15 +0200)]
maint: mark translatable string args of VIR_ERROR

Run this:
  git grep -l 'VIR_ERROR\s*("'|xargs perl -pi -e \
    's/(VIR_ERROR)\s*\((".*?"),/$1(_($2),/'

14 years agomaint: mark translatable string args of VIR_ERROR0
Jim Meyering [Thu, 20 May 2010 06:14:50 +0000 (08:14 +0200)]
maint: mark translatable string args of VIR_ERROR0

Run this:
  git grep -l 'VIR_ERROR0\s*("'|xargs perl -pi -e \
    's/(VIR_ERROR0)\s*\((".*?")\)/$1(_($2))/'

14 years agomaint: use VIR_ERROR0 rather than VIR_ERROR with a bare "%s"
Jim Meyering [Thu, 20 May 2010 06:10:38 +0000 (08:10 +0200)]
maint: use VIR_ERROR0 rather than VIR_ERROR with a bare "%s"

Change VIR_ERROR("%s", "..."
to     VIR_ERROR0("..."

and

Change VIR_ERROR("%s", _("...")
to     VIR_ERROR0(_("...")

Use this command:
  git grep -E -l 'VIR_ERROR\("%s", (_\()?"'|xargs perl -pi -e \
  's/VIR_ERROR\("%s", (_\()?"/VIR_ERROR0($1"/'

14 years agoqemu driver: fix version check typos
Chris Wright [Wed, 19 May 2010 22:37:26 +0000 (15:37 -0700)]
qemu driver: fix version check typos

* src/qemu/qemu_conf.c (qemudParseHelpStr): Fix errors that made
it impossible to diagnose invalid minor and micro version number
components.

Signed-off-by: Chris Wright <chrisw@redhat.com>
14 years agodaemon: A few initscript corrections
Cole Robinson [Wed, 19 May 2010 19:57:56 +0000 (15:57 -0400)]
daemon: A few initscript corrections

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

- Avahi service is called 'avahi-daemon'
- chkconfig descriptions must use \ for line continuations

14 years agoqemu: Use ShutdownVMDaemon for all startup cleanup paths
Cole Robinson [Mon, 17 May 2010 16:37:52 +0000 (12:37 -0400)]
qemu: Use ShutdownVMDaemon for all startup cleanup paths

The current cleanup: in StartVMDaemon path is a poor duplication.
qemuShutdownVMDaemon can handle teardown for inactive VMs, so let's use it.

v2: Remove old abort: label, only use cleanup:

14 years agoDomain snapshot RNG and tests.
Chris Lalancette [Mon, 3 May 2010 21:15:18 +0000 (17:15 -0400)]
Domain snapshot RNG and tests.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoFix up the python bindings for snapshotting.
Chris Lalancette [Wed, 19 May 2010 13:02:30 +0000 (09:02 -0400)]
Fix up the python bindings for snapshotting.

This involved a few fixes.  To start with,
an virDomainSnapshot object is really tied to a
domain, not a connection, so we have to generate
a slightly different object so that we can get
at self._dom for the object.

Next, we had to "dummy" up an override piece of
XML with a bogus argument that the function doesn't
actually take.  That's so that the generator places
virDomainRevertToSnapshot underneath the correct
class (namely, the virDomain class).

Finally, we had to hand-implement the
virDomainRevertToSnapshot implementation, ignoring the
bogus pointer we are being passed.

With all of this in place, I was able to successfully
take a snapshot and revert to it using only the
Python bindings.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoqemu_conf.c: also recognize new first line of qemu -help output
Jim Meyering [Thu, 20 May 2010 13:43:47 +0000 (15:43 +0200)]
qemu_conf.c: also recognize new first line of qemu -help output

* src/qemu/qemu_conf.c (QEMU_VERSION_STR_1, QEMU_VERSION_STR_2):
Define these instead of...
(QEMU_VERSION_STR): ... this.  Remove definition.
(qemudParseHelpStr): Check first for the new, shorter prefix,
"QEMU emulator version", and then for the old one,
"QEMU PC emulator version" when trying to parse the version number.
Based on a patch by Chris Wright.

14 years agolxc_controller.c: don't ignore failed "accept"
Jim Meyering [Thu, 20 May 2010 12:30:36 +0000 (14:30 +0200)]
lxc_controller.c: don't ignore failed "accept"

* src/lxc/lxc_controller.c (ignorable_epoll_accept_errno): New function.
(lxcControllerMain): Handle a failed accept carefully:
most errno values indicate legitimate failure and must be fatal.
However, ignore a special case: that in which an incoming client quits
between the poll() indicating its presence, and our accept() which
is trying to process it.

14 years agoqemu: Don't deny ShutdownVMDaemon for non-running VMs
Cole Robinson [Mon, 17 May 2010 16:48:47 +0000 (12:48 -0400)]
qemu: Don't deny ShutdownVMDaemon for non-running VMs

Clients that require this already seem to do so. Calling this function
with pid < 1 also should not cause problems.

14 years agoqemu: Remove explicit VNC XML cleanup
Cole Robinson [Mon, 17 May 2010 15:47:21 +0000 (11:47 -0400)]
qemu: Remove explicit VNC XML cleanup

This only exists for a certain cleanup path in StartVMDaemon, but is
unneeded since domain_conf.c handles this for us automatically.

14 years agoqemu: Properly cleanup in security startup error path
Cole Robinson [Mon, 17 May 2010 15:24:16 +0000 (11:24 -0400)]
qemu: Properly cleanup in security startup error path

Everything after hostdev setup needs to jump to cleanup on error.

14 years agolibvirtd: don't ignore virInitialize failure
Jim Meyering [Thu, 20 May 2010 07:52:20 +0000 (09:52 +0200)]
libvirtd: don't ignore virInitialize failure

* daemon/libvirtd.c (main): Diagnose virInitialize failure
and exit nonzero.

14 years agoRename qemuBuildCommandLine tapfds -> vmfds.
Alex Williamson [Thu, 20 May 2010 14:03:17 +0000 (10:03 -0400)]
Rename qemuBuildCommandLine tapfds -> vmfds.

There doesn't seem to be anything specific to tap devices for this
array of file descriptors which need to stay open of the guest to use.
Rename then for others to make use of.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agomaint: prohibit newline at end of diagnostic
Jim Meyering [Thu, 20 May 2010 09:13:41 +0000 (11:13 +0200)]
maint: prohibit newline at end of diagnostic

* cfg.mk (sc_prohibit_newline_at_end_of_diagnostic): New rule.
Idea proposed by Jiri Denemark.

14 years agomaint: remove unwanted newline at end of diagnostic
Jim Meyering [Thu, 20 May 2010 09:12:17 +0000 (11:12 +0200)]
maint: remove unwanted newline at end of diagnostic

* src/xen/xend_internal.c (xenDaemonDomainDefineXML): Remove \n.
* src/network/bridge_driver.c (networkAddMasqueradingIptablesRules):
Likewise.

14 years agoqemudDomainMigrateFinish2: handle a case of virDomainSaveStatus failure
Jim Meyering [Wed, 19 May 2010 15:48:03 +0000 (17:48 +0200)]
qemudDomainMigrateFinish2: handle a case of virDomainSaveStatus failure

* src/qemu/qemu_driver.c (qemudDomainMigrateFinish2): Don't ignore
virDomainSaveStatus failure.
* src/conf/domain_conf.h (virDomainSaveStatus): Use
ATTRIBUTE_RETURN_CHECK, so this doesn't happen again.

14 years agodocs: distribute more coding convention documentation
Eric Blake [Wed, 19 May 2010 17:51:49 +0000 (11:51 -0600)]
docs: distribute more coding convention documentation

These files may be useful for anyone making modifications to
source files in a tarball distribution.

* src/Makefile.am (EXTRA_DIST): Add THREADS.txt.
* daemon/Makefile.am (EXTRA_DIST): Add THREADING.txt.