]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agoMove virProcessKill into virprocess.{h,c}
Daniel P. Berrange [Mon, 24 Sep 2012 16:54:51 +0000 (17:54 +0100)]
Move virProcessKill into virprocess.{h,c}

There are a number of process related functions spread
across multiple files. Start to consolidate them by
creating a virprocess.{c,h} file

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRename virCommandTranslateStatus to virProcessTranslateStatus
Daniel P. Berrange [Mon, 24 Sep 2012 17:01:26 +0000 (18:01 +0100)]
Rename virCommandTranslateStatus to virProcessTranslateStatus

The virCommand prefix was inappropriate because the API
does not use any virCommandPtr object instance. This
API closely related to waitpid/exit, so use virProcess
as the prefix

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRename virPid{Abort,Wait} to virProcess{Abort,Wait}
Daniel P. Berrange [Mon, 24 Sep 2012 16:59:31 +0000 (17:59 +0100)]
Rename virPid{Abort,Wait} to virProcess{Abort,Wait}

Change "Pid" to "Process" to align with the virProcessKill
API naming prefix

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRename virKillProcess to virProcessKill
Daniel P. Berrange [Mon, 24 Sep 2012 15:29:20 +0000 (16:29 +0100)]
Rename virKillProcess to virProcessKill

Changing naming to follow the convention of "object" followed
by "action"

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix start of containers with custom root filesystem
Daniel P. Berrange [Tue, 25 Sep 2012 15:24:10 +0000 (16:24 +0100)]
Fix start of containers with custom root filesystem

A prefix change to unmount the SELinux filesystem broke starting
of LXC containers with a custom root filesystem

12 years agoUpdate how to compile with -Werror
Doug Goldstein [Mon, 24 Sep 2012 23:44:34 +0000 (18:44 -0500)]
Update how to compile with -Werror

--enable-compile-warnings=error has been renamed to --enable-werror so
update the HACKING and the hacking.html to reflect that.

12 years agoqemu: Avoid holding the driver lock in trivial snapshot API's
Peter Krempa [Mon, 24 Sep 2012 20:31:35 +0000 (22:31 +0200)]
qemu: Avoid holding the driver lock in trivial snapshot API's

In most of the snapshot API's there's no need to hold the driver lock
the whole time.

This patch adds helper functions that get the domain object in functions
that don't require the driver lock and simplifies call paths from
snapshot-related API's.

12 years agostorage: Add timeout for iscsi volume's stable path discovery
Osier Yang [Mon, 24 Sep 2012 08:44:20 +0000 (16:44 +0800)]
storage: Add timeout for iscsi volume's stable path discovery

It might need some time till the LUN's stable path shows up on
initiator host, and although the time window is not foreseeable,
as a better than nothing fix, this patch adds timeout for the
stable path discovery process.

12 years agobuild: fix detection of netcf linked with libnl1
Christophe Fergeau [Wed, 19 Sep 2012 15:00:55 +0000 (17:00 +0200)]
build: fix detection of netcf linked with libnl1

Commit 9298bfbcb introduced code to detect if netcf is linked with
libnl1, and to prefer libnl1 over libnl3 when this is the case.
This behaviour can be disabled by setting LIBNL_CFLAGS to any value,
including the empty string.
However, configure.ac sets LIBNL_CFLAGS to "" before attempting
libnl detection, so the libnl1 detection code is always disabled.
This caused issues on my f17 system where netcf is linked with libnl1
but libvirt got built with libnl3.

This commit removes the setting of the LIBNL_* variables to "" as
this does not appear to be needed. After this change, libnl1 is
used when building libvirt on my f17 system.

12 years agonode_memory: Improve the docs
Osier Yang [Mon, 24 Sep 2012 15:08:31 +0000 (23:08 +0800)]
node_memory: Improve the docs

To declare that it's not recommended to use the tuning API while
the outside tuning program (such as ksmtuned under Linux) is running.

12 years agotests: test previous commit
Eric Blake [Mon, 24 Sep 2012 23:04:46 +0000 (17:04 -0600)]
tests: test previous commit

Add a test to avoid virCommand regressions.

* tests/commandtest.c (test8): Explicitly test env-var overrides.

12 years agocommand: Change virCommandAddEnv so it replaces existing environment variables.
Richard W.M. Jones [Mon, 24 Sep 2012 16:35:47 +0000 (17:35 +0100)]
command: Change virCommandAddEnv so it replaces existing environment variables.

12 years agocommand: Move environ-adding code to common function virCommandAddEnv.
Richard W.M. Jones [Mon, 24 Sep 2012 16:30:18 +0000 (17:30 +0100)]
command: Move environ-adding code to common function virCommandAddEnv.

This is just code motion.  The semantics of the code should be
identical after this change.

12 years agoRelease of libvirt-0.10.2
Daniel Veillard [Mon, 24 Sep 2012 04:06:05 +0000 (12:06 +0800)]
Release of libvirt-0.10.2

* configure.ac docs/news.html.in libvirt.spec.in: update for the release
* po/*.po*: update from transifex and regenerate

12 years agoFix another rpmbuild failure
Daniel Veillard [Mon, 24 Sep 2012 04:41:56 +0000 (12:41 +0800)]
Fix another rpmbuild failure

without systemd we should not try to package the non-installed
%{_sysconfdir}/rc.d/init.d/libvirtd

12 years agoFix an rpmbuild failure
Daniel Veillard [Mon, 24 Sep 2012 04:37:02 +0000 (12:37 +0800)]
Fix an rpmbuild failure

$RPM_BUILD_ROOT was embedded in /etc/rc.d/init.d/libvirt-guests

12 years agoDon't install legacy initscripts at same time as systemd ones
Daniel P. Berrange [Fri, 21 Sep 2012 10:24:31 +0000 (11:24 +0100)]
Don't install legacy initscripts at same time as systemd ones

The Fedora policies don't want us installing the legacy initscripts
in parallel with the systemd ones, so switch to only install the
systemd unit

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agonetwork: log error for unknown virNetworkUpdate command codes
Laine Stump [Fri, 21 Sep 2012 16:11:51 +0000 (12:11 -0400)]
network: log error for unknown virNetworkUpdate command codes

Every level of the code for virNetworkUpdate was assuming that some
other level was checking for validity of the "command" arg, but none
actually were. The result was that an invalid command code would do
nothing, but also report success.

Since the command code isn't used until the very lowest level backend
functions, that's where I put the check. I made a separate one-line
function to log the error. The compiler would have combined the
identical strings used by multiple calls if I'd just called
virReportError directly in each location, but sending them all to the
same string in the source guards against inadvertant divergence (which
would lead to extra work for translators.)

12 years agonetwork: make virNetworkObjUpdate error detection/recovery better
Laine Stump [Fri, 21 Sep 2012 18:48:17 +0000 (14:48 -0400)]
network: make virNetworkObjUpdate error detection/recovery better

1) virNetworkObjUpdate should be an all or none operation, but in the
case that we want to update both the live state and persistent config
versions of the network, it was committing the update to the live
state before starting to update the persistent config. If update of
the persistent config failed, we would leave with things in an
inconsistent state - the live state would be updated (even though an
error was returned), but persistent config unchanged.

This patch changed virNetworkObjUpdate to use a separate pointer for
each copy of the virNetworkDef, and not commit either of them in the
virNetworkObj until both live and config parts of the update have
successfully completed.

2) The parsers for various pieces of the virNetworkDef have all sorts
of subtle limitations on them that may not be known by the
Update[section] function, making it possible for one of these
functions to make a modification directly to the object that may not
pass the scrutiny of a subsequent parse. But normally another parse
wouldn't be done on the data until the *next* time the object was
updated (which could leave the network definition in an unusable
state).

Rather than fighting the losing battle of trying to duplicate all the
checks from the parsers into the update functions as well, the more
foolproof solution to this is to simply do an extra
virNetworkDefCopy() operation on the updated networkdef -
virNetworkDefCopy() does a virNetworkFormat() followed by a
virNetworkParseString(), so it will do all the checks we need. If this
fails, then we don't commit the changed def.

12 years agonetwork: don't "refresh" iptables rules on rule-less networks
Laine Stump [Fri, 21 Sep 2012 19:28:11 +0000 (15:28 -0400)]
network: don't "refresh" iptables rules on rule-less networks

The bridge driver implementation of virNetworkUpdate() removes and
re-adds iptables rules any time a network has an <ip>, <forward>, or
<forward>/<interface> element updated. There are some types of
networks that have those elements and yet have no iptables rules
associated with them, and unfortunately the functions that remove/add
iptables rules don't check the type of network before attempting to
remove/add the rules, sometimes leading to an erroneous failure of the
entire update operation.

Under normal circumstances I would refactor the lower level functions
to be more robust, but to avoid code churn as much as possible, I've
just added extra checks directly to networkUpdate().

12 years agoDrop unused return value of virLogOutputFunc
Miloslav Trmač [Thu, 20 Sep 2012 18:24:00 +0000 (20:24 +0200)]
Drop unused return value of virLogOutputFunc

Nothing uses the return value, and creating it requries otherwise
unnecessary strlen () calls.

This cleanup is conceptually independent from the rest of the series
(although the later patches won't apply without it).  This just seems
a good opportunity to clean this up, instead of entrenching the unnecessary
return value in the virLogOutputFunc instance that will be added in this
series.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
12 years agoRemove redundant lines in src/qemu/qemu_driver.c
Tang Chen [Fri, 21 Sep 2012 09:50:10 +0000 (17:50 +0800)]
Remove redundant lines in src/qemu/qemu_driver.c

maxcpu and hostcpus are defined and calculated in qemudDomainPinVcpuFlags()
and qemudDomainPinEmulator(), but never used. So remove them including nodeinfo.

Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
12 years agoAdd <seclabel> to character devices.
Richard W.M. Jones [Thu, 20 Sep 2012 13:16:17 +0000 (14:16 +0100)]
Add <seclabel> to character devices.

This allows the user to control labelling of each character device
separately (the default is to inherit from the VM).

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
12 years agoMake virSecurityDeviceLabelDefParseXML into generic device <seclabel> parser.
Richard W.M. Jones [Thu, 20 Sep 2012 13:58:12 +0000 (14:58 +0100)]
Make virSecurityDeviceLabelDefParseXML into generic device <seclabel> parser.

This is just code motion, allowing us to reuse the same function to
parse the <seclabel> from character devices too.

However it also fixes a possible segfault in the original code if
VIR_ALLOC_N returns an error and the cleanup code (at the error:
label) tries to iterate over the unallocated array (thanks Michal
Privoznik for spotting this).

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
12 years agoqemu: Fix failure path in disk hotplug
Jiri Denemark [Thu, 20 Sep 2012 20:28:35 +0000 (22:28 +0200)]
qemu: Fix failure path in disk hotplug

Disk hotplug is a two phase action: qemuMonitorAddDrive followed by
qemuMonitorAddDevice. When the first part succeeds but the second one
fails, we need to rollback the drive addition.

12 years agolocking: Remove README file in favor of internals/locking.html
Jiri Denemark [Mon, 17 Sep 2012 13:18:57 +0000 (15:18 +0200)]
locking: Remove README file in favor of internals/locking.html

The README file seems to be a leftover from some previous version of
locking driver. It is not consistent with what the code does nor is it
consistent with existing documentation in internals/locking.html.

12 years agoImprove some debugging log messages in LXC mount setup
Daniel P. Berrange [Tue, 18 Sep 2012 11:27:07 +0000 (12:27 +0100)]
Improve some debugging log messages in LXC mount setup

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoEnsure existing selinux mount is removed before mounting new one in LXC
Daniel P. Berrange [Tue, 18 Sep 2012 11:25:56 +0000 (12:25 +0100)]
Ensure existing selinux mount is removed before mounting new one in LXC

Some kernel versions (at least RHEL-6 2.6.32) do not let you over-mount
an existing selinuxfs instance with a new one. Thus we must unmount the
existing instance inside our namespace.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix crash accessing a NULL URI when looking up auth credentials
Daniel P. Berrange [Wed, 12 Sep 2012 15:40:08 +0000 (16:40 +0100)]
Fix crash accessing a NULL URI when looking up auth credentials

When auto-probing hypervisor drivers, the conn->uri field will
initially be NULL. Care must be taken not to access members
when doing auth lookups in the config file

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove a redundant line in src/qemu/qemu_driver.c
Tang Chen [Fri, 21 Sep 2012 03:50:08 +0000 (11:50 +0800)]
Remove a redundant line in src/qemu/qemu_driver.c

Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
12 years agonetwork: backend for virNetworkUpdate of portgroups
Laine Stump [Fri, 21 Sep 2012 02:25:41 +0000 (22:25 -0400)]
network: backend for virNetworkUpdate of portgroups

portgroup elements are located in the toplevel of <network>
objects. There can be multiple <portgroup> elements, and they each
have a unique name attribute.

Add, delete, and modify are all supported for portgroup. When deleting
a portgroup, only the name must be specified in the provided xml - all
other attributes and subelements are ignored for the purposes of
matching and existing portgroup.

The bridge driver and virsh already know about the portgroup element,
so providing this backend should cause the entire stack to work. Note
that in the case of portgroup, there is no external daemon based on
the portgroup config, so nothing must be restarted.

It is important to note that guests make a copy of the appropriate
network's portgroup data when they are started, so although an updated
portgroup's configuration will have an affect on new guests started
after the cahange, existing guests won't magically have their
bandwidth changed, for example. If something like that is desired, it
will take a lot of redesign work in the way network devices are setup
(there is currently no link from the network back to the individual
interfaces using it, much less from a portgroup within a network back
to the individual interfaces).

12 years agonetwork: backend for virNetworkUpdate of dhcp range
Laine Stump [Fri, 21 Sep 2012 02:25:40 +0000 (22:25 -0400)]
network: backend for virNetworkUpdate of dhcp range

The dhcp range element is contained in the <dhcp> element of one of a
network's <ip> elements. There can be multiple <range>
elements. Because there are only two attributes (start and end), and
those are exactly what you would use to identify a particular range,
it doesn't really make sense to modify an existing element, so
VIR_NETWORK_UPDATE_COMMAND_MODIFY isn't supported for this section,
only ADD_FIRST, ADD_LAST, and DELETE.

Since virsh already has support for understanding all the defined
sections, this new backend is automatically supported by virsh. You
would use it like this:

  virsh net-update mynet add ip-dhcp-range \
        "<range start='1.2.3.4' end='1.2.3.20'/>" --live --config

The bridge driver also already supports all sections, so it's doing
the correct thing in this case as well - since the dhcp range is
placed on the dnsmasq commandline, the bridge driver recreates the
dnsmasq commandline, and re-runs dnsmasq whenever a range is
added/deleted (and AFFECT_LIVE is specified in the flags).

12 years agovirsh: new net-update command
Laine Stump [Wed, 19 Sep 2012 11:38:43 +0000 (07:38 -0400)]
virsh: new net-update command

This command uses the new virNetworkUpdate() API to modify an existing
network definition, and optionally have those modifications take
effect immediately without restarting the network.

An example usage:

  virsh net-update mynet add-last ip-dhcp-host \
   "<host mac='00:11:22:33:44:55' ip='192.168.122.45'/>" \
   --live --config

If you like, you can instead put the xml into a file, and call like
this:

  virsh net-update mynet add ip-dhcp-host /tmp/myxml.xml
   --live --config

virsh will autodetect whether the argument is itself an xml element,
or if it's a file, by looking at the first character - the first
character of an xml element is always "<", and the first character of
a file is almost always *not* "<" (in the rare case that it is, the
user could specify "./<filename...").

A --parent-index option is also available (to give the index within a
list of parent objects, e.g. the index of the parent <ip> element when
updating ip-dhcp-host elements), but is optional and at least for now
will probably be used rarely.

--live, --config, and --current options - if you specify --live, only
the live state of the network will be updated. If you also specify
--config, then the persistent configuration will also be updated;
these two commands can be given separately, or both together. If you
don't specify either (you can optionally specify "--current" for the
same effect), then the "current" config will be updated (i.e. if the
network is active, then only its live config is affected, but if the
network is inactive, only the persistent config is affected).

12 years agodocs: fix typo in filesystem docs
Eric Blake [Fri, 21 Sep 2012 01:41:13 +0000 (19:41 -0600)]
docs: fix typo in filesystem docs

Noticed this by reading the page.  It would be so much nicer if our
tools could automatically flag things like this as part of 'make'.

* docs/formatdomain.html.in: Remove extra '>'.

12 years agomaint: fix up copyright notice inconsistencies
Eric Blake [Thu, 20 Sep 2012 22:30:55 +0000 (16:30 -0600)]
maint: fix up copyright notice inconsistencies

https://www.gnu.org/licenses/gpl-howto.html recommends that
the 'If not, see <url>.' phrase be a separate sentence.

* tests/securityselinuxhelper.c: Remove doubled line.
* tests/securityselinuxtest.c: Likewise.
* globally: s/;  If/.  If/

12 years agodoc: include article about libvirt+audit in relatedlinks.html
Marcelo Cerri [Thu, 20 Sep 2012 21:31:41 +0000 (18:31 -0300)]
doc: include article about libvirt+audit in relatedlinks.html

This patch adds to relatedlinks.html a link to an article about libvirt
describing how the Linux audit subsystem can be used to track qemu
guest's life-cycle.

12 years agoEnsure autogen.sh exists if bootstrap fails
Daniel P. Berrange [Wed, 19 Sep 2012 17:45:24 +0000 (18:45 +0100)]
Ensure autogen.sh exists if bootstrap fails

If any of the bootstrap tasks (autoconf/automake/etc) failed,
autogen.sh carried on running any pre-existing configure anyway.
Use 'set -e' to ensure autogen.sh immediately exists on error.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agotests: Add tests for dump-core option
Martin Kletzander [Wed, 15 Aug 2012 08:16:36 +0000 (10:16 +0200)]
tests: Add tests for dump-core option

12 years agoqemu: add support for dump-guest-core option
Martin Kletzander [Wed, 15 Aug 2012 07:59:24 +0000 (09:59 +0200)]
qemu: add support for dump-guest-core option

The "dump-guest-core' option is new option for the machine type
(-machine pc,dump-guest-core) that controls whether the guest memory
will be marked as dumpable.

While testing this, I've found out that the value for the '-M' options
is not parsed correctly when additional parameters are used. However,
when '-machine' is used for the same options, it gets parsed as
expected. That's why this patch also modifies the parsing and creating
of the command line, so both '-M' and '-machine' are recognized. In
QEMU's help there is only mention of the 'machine parameter now with
no sign of the older '-M'.

12 years agoAdd support for limiting guest coredump
Martin Kletzander [Wed, 15 Aug 2012 07:51:58 +0000 (09:51 +0200)]
Add support for limiting guest coredump

Sometimes when guest machine crashes, coredump can get huge due to the
guest memory. This can be limited using madvise(2) system call and is
being used in QEMU hypervisor. This patch adds an option for configuring
that in the domain XML and related documentation.

12 years agoQEMU Tests for reboot-timeout
Martin Kletzander [Tue, 18 Sep 2012 10:32:07 +0000 (12:32 +0200)]
QEMU Tests for reboot-timeout

12 years agoqemu: Add support for reboot-timeout
Martin Kletzander [Tue, 18 Sep 2012 10:31:30 +0000 (12:31 +0200)]
qemu: Add support for reboot-timeout

This patch adds support for "-boot reboot-timeout=rb_time" that is
added in QEMU.

12 years agoAdd support for reboot-timeout
Martin Kletzander [Tue, 18 Sep 2012 10:30:52 +0000 (12:30 +0200)]
Add support for reboot-timeout

Whenever the guest machine fails to boot, new parameter (reboot-timeout)
controls whether it should reboot and after how many ms it should do so.

Docs included.

12 years agosecurity: Don't ignore errors when parsing DAC security labels
Peter Krempa [Tue, 18 Sep 2012 10:20:41 +0000 (12:20 +0200)]
security: Don't ignore errors when parsing DAC security labels

The DAC security driver silently ignored errors when parsing the DAC
label and used default values instead.

With a domain containing the following label definition:

<seclabel type='static' model='dac' relabel='yes'>
  <label>sdfklsdjlfjklsdjkl</label>
</seclabel>

the domain would start normaly but the disk images would be still owned
by root and no error was displayed.

This patch changes the behavior if the parsing of the label fails (note
that a not present label is not a failure and in this case the default
label should be used) the error isn't masked but is raised that causes
the domain start to fail with a descriptive error message:

virsh #  start tr
error: Failed to start domain tr
error: internal error invalid argument: failed to parse DAC seclabel
'sdfklsdjlfjklsdjkl' for domain 'tr'

I also changed the error code to "invalid argument" from "internal
error" and tweaked the various error messages to contain correct and
useful information.

12 years agosimplify xenXMDomainPinVcpu function
liguang [Thu, 20 Sep 2012 05:31:57 +0000 (13:31 +0800)]
simplify xenXMDomainPinVcpu function

supersede tedious statements getting cpu bitmap
from parameter cpumap by virBitmapNewData function

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
12 years agoCleanup of domain_conf sentinels
Martin Kletzander [Wed, 19 Sep 2012 07:16:58 +0000 (09:16 +0200)]
Cleanup of domain_conf sentinels

This patch removes all commas after *_LAST sentinels in the enums.

12 years agoqemu: Cleanup boot parameter building
Martin Kletzander [Tue, 18 Sep 2012 09:38:18 +0000 (11:38 +0200)]
qemu: Cleanup boot parameter building

This patch cleans up building the "-boot" parameter and while on that
fixes one inconsistency by modifying these things:

 - I completed the unfinished virDomainBootMenu enum by specifying
   LAST, declaring it and also declaring the TypeFromString and
   TypeToString parameters.
 - Previously mentioned TypeFromString and TypeToString are used when
   parsing the XML.
 - Last, but not least, visible change is that the "-boot" parameter
   is built and parsed properly:
    - The "order=" prefix is used only when additional parameters are
      used (menu, etc.).
    - It's rewritten in a way that other parameters can be added
      easily in the future (used in following patch).
    - The "order=" parameter is properly parsed regardless to where it
      is placed in the string (e.g. "menu=on,order=nc").
    - The "menu=" parameter (and others in the future) are created
      when they should be (i.e. even when bootindex is supported and
      used, but not when bootloader is selected).

12 years agoqemu: Transition domain to PAUSED after 'stop' command
Michal Privoznik [Wed, 19 Sep 2012 09:23:11 +0000 (11:23 +0200)]
qemu: Transition domain to PAUSED after 'stop' command

Currently, we mark domain PAUSED (but not emit an event)
just before we issue 'stop' on monitor; This command can
take ages to finish, esp. when domain's doing a lot of
IO - users can enforce qemu to open files with O_DIRECT
which doesn't return from write() until data reaches the
block device. Having said that, we report PAUSED even if
domain is not paused yet.

12 years agonetwork: fix element size / length in memmove
Laine Stump [Wed, 19 Sep 2012 22:45:58 +0000 (18:45 -0400)]
network: fix element size / length in memmove

The memmove to move elements in the dhcp hosts array when inserting
and deleting items was mistakenly basing the length of the copy on the
size of a virNetworkDHCPHostDefPtr rather than virNetworkDHCPHostDef,
with the expected disastrous results.

The memmove to delete an entry commits two errors - along with the
size of each element being wrong, it also omits some required
parentheses.

12 years agovirsh: Move daemon to misc since its not a network
Doug Goldstein [Sun, 9 Sep 2012 22:07:27 +0000 (17:07 -0500)]
virsh: Move daemon to misc since its not a network

Move the 'Daemon' entry to the Miscellaneous section since its not a
networking driver or component.

12 years agonetwork: fix incorrect VIR_NETWORK_UPDATE_COMMAND_* values
Laine Stump [Wed, 19 Sep 2012 11:40:30 +0000 (07:40 -0400)]
network: fix incorrect VIR_NETWORK_UPDATE_COMMAND_* values

These enums originally were put into the flags for virNetworkUpdate,
and when they were moved into their own enum, the numbers weren't
appropriately changed, causing the commands to start with value 2
instead of 1. This causes problems for things like ENUM_IMPL, which
wants a string for every value in the requested range, including those
not used in the enum.

12 years agobuild: define WITH_INTERFACE for the driver
Doug Goldstein [Tue, 18 Sep 2012 01:27:06 +0000 (20:27 -0500)]
build: define WITH_INTERFACE for the driver

Based exclusively on work by Eric Blake in a patch posted with the same
subject. However some modifications related to comments and my plans to
add another backend.

Added WITH_INTERFACE as the only automake variable deciding whether to
build the driver and using WITH_NETCF to identify that we're wanting to
use the netcf library as the backend.

* configure.ac: Added with_interface
* src/interface/netcf_driver.c: Renamed..
* src/interface/interface_backend_netcf.c: ..to this to match storage.
* src/interface/netcf_driver.h: Renamed..
* src/interface/interface_driver.h: ..to this.
* daemon/Makefile.am: Respect WITH_INTERFACE and WITH_NETCF.
* libvirt.spec.in: Add RPM support for --with-interface

12 years agovirsh: Rename QEmu to QEMU to match upstream
Doug Goldstein [Sun, 9 Sep 2012 22:07:28 +0000 (17:07 -0500)]
virsh: Rename QEmu to QEMU to match upstream

Match upstream's naming of QEMU. There was a notice on the ML that said
the preferred spelling was QEMU a while back.

12 years agovirsh: Fix resource leaks when editing files.
Peter Krempa [Wed, 19 Sep 2012 09:31:44 +0000 (11:31 +0200)]
virsh: Fix resource leaks when editing files.

The cleanup path in virsh-edit helper was never reached when the edit
was successful leaking the document in memory as well as the temporary
file.

12 years agoutil: don't print free'd dmidecode path
Eric Blake [Tue, 18 Sep 2012 23:34:25 +0000 (17:34 -0600)]
util: don't print free'd dmidecode path

The path was freed before printing the error message, resulting in:
error : virSysinfoRead:773 : internal error Failed to execute command
(null)
But virCommandRun already gives a better error message.

* src/util/sysinfo.c (virSysinfoRead): Avoid overwriting error.

12 years agobuild: avoid unused symbol
Eric Blake [Tue, 18 Sep 2012 23:09:00 +0000 (17:09 -0600)]
build: avoid unused symbol

Commit f36309d added an export with no matching implementation;
probably a misspelling of an earlier version of the final addition
of virNetworkObjSetDefTransient.

* src/libvirt_private.syms (network_conf.h): Drop bogus
virNetworkSetDefTransient.

12 years agobuild: fix nodeinfo build on non-Linux platforms
Eric Blake [Tue, 18 Sep 2012 23:04:50 +0000 (17:04 -0600)]
build: fix nodeinfo build on non-Linux platforms

Commit aaa8ab3 added new static functions that are only used on Linux;
but commit 22acfdc didn't go far enough to fix compiler issues.

* src/nodeinfo.c (nodeSetMemoryParameterValue)
(nodeGetMemoryParameterValue): Conditionally compile based on use.

12 years agobitmap: fix problems in previous commit
Eric Blake [Tue, 18 Sep 2012 23:20:03 +0000 (17:20 -0600)]
bitmap: fix problems in previous commit

Commit ee3d3893 missed the fact that (unsigned char)<<(int)
is truncated to int, and therefore failed for any bitmap data
longer than four bytes.

Also, I failed to run 'make syntax-check' on my commit 4bba6579;
for whatever odd reason, ffs lives in a different header than ffsl.

* src/util/bitmap.c (virBitmapNewData): Use correct shift type.
(includes): Glibc (and therefore gnulib) decided ffs is in
<strings.h>, but ffsl is in <string.h>.
* tests/virbitmaptest.c (test5): Test it.

12 years agobuild: avoid non-portable byte-swapping
Eric Blake [Tue, 18 Sep 2012 19:53:15 +0000 (13:53 -0600)]
build: avoid non-portable byte-swapping

Commit 0fc89098 used functions only available on glibc, completely
botched 32-bit environments, and risked SIGBUS due to unaligned
memory access on platforms that aren't as forgiving as x86_64.

* bootstrap.conf (gnulib_modules): Import ffsl.
* src/util/bitmap.c (includes): Use <strings.h> for ffsl.
(virBitmapNewData, virBitmapToData): Avoid 64-bit assumptions and
non-portable functions.

12 years agoFix minor details not only in apic eoi
Martin Kletzander [Tue, 18 Sep 2012 09:40:52 +0000 (11:40 +0200)]
Fix minor details not only in apic eoi

The introduction of APIC EOI patches had a few little details that
could look better, so this patch fixes that and one more place in the
file as well (same problem).

12 years agosecret: Fix error for private secrets
Martin Kletzander [Tue, 18 Sep 2012 10:01:46 +0000 (12:01 +0200)]
secret: Fix error for private secrets

When trying to get the value of a private secret, the code used
'operation denied' error. That error is specified as a error for
read-only connections trying to perform denied operation. The
following error seems more accurate.

To compare the difference:
 - BEFORE
error: operation secret is private forbidden for read only access

 - AFTER
error: Invalid secret: secret is private

12 years agovirNetDevBandwidthClear: Improve error handling
Martin Kletzander [Tue, 18 Sep 2012 10:01:18 +0000 (12:01 +0200)]
virNetDevBandwidthClear: Improve error handling

Two changes are introduced in this patch:

 - The first change removes ATTRIBUTE_RETURN_CHECK from
   virNetDevBandwidthClear, because it was called with ignore_value
   always, anyway. The function is used even when it's not necessary
   to call it, just for cleanup purposes.

 - The second change is added ignoring of the command's exit status,
   since it may report an error even when run just as "to be sure we
   clean up" function. No libvirt errors are suppresed by this.

12 years agosyntax-check: fix run.in
Martin Kletzander [Tue, 18 Sep 2012 11:59:53 +0000 (13:59 +0200)]
syntax-check: fix run.in

Two more problems in "run.in" made the syntax-check fail.

12 years agoAdhere to copyright_address check
Guido Günther [Tue, 18 Sep 2012 11:07:26 +0000 (13:07 +0200)]
Adhere to copyright_address check

to fix "make syntax-check"

Found by http://honk.sigxcpu.org:8001/job/libvirt-syntax-check/

12 years agoAdd a ./run script for running programs from the local directory.
Richard W.M. Jones [Fri, 14 Sep 2012 09:08:54 +0000 (10:08 +0100)]
Add a ./run script for running programs from the local directory.

With this script you can run libvirt programs without needing to
install them first.  You just have to do for example:

  ./run ./tools/virsh [args ...]

If you are already in the tools/ subdirectory, then the following
command will also work:

  ../run ./virsh [...]

You can also run the C programs under valgrind like this:

  ./run valgrind [valgrind opts...] ./program

or under gdb:

  ./run gdb --args ./program

This also works with sudo (eg. if you need root access for libvirt):

  sudo ./run ./tools/virsh list --all

Derived from libguestfs and simplified.  The ./run script in
libguestfs is much more sophisticated:

https://github.com/libguestfs/libguestfs/blob/master/run.in

12 years agorpc: Fix name of member in remote_protocol-structs
Peter Krempa [Tue, 18 Sep 2012 09:42:03 +0000 (11:42 +0200)]
rpc: Fix name of member in remote_protocol-structs

Commit 7a99b0abafb69e1686198ac3473892a9aaeb8255 adds a new RPC struct
but one of the members has different names in remote_protocol.x and
remote_protocol-struct breaking make check.

12 years agovirBitmap: fix build without HAVE_NUMACTL
Ján Tomko [Tue, 18 Sep 2012 09:13:20 +0000 (11:13 +0200)]
virBitmap: fix build without HAVE_NUMACTL

Commit 75b198b3e7b2c8b4106afbd42f8bb795c4773511 forgot to change
arguments of dummy qemuProcessInitNumaMemoryPolicy from char* to
virBitmapPtr.

12 years agoqemuhelptest: convert runaway tab to spaces
Ján Tomko [Tue, 18 Sep 2012 09:17:26 +0000 (11:17 +0200)]
qemuhelptest: convert runaway tab to spaces

Make syntax-check happy and smiling again.

12 years agodaemon: Fix error message when libvirtd is missing.
Richard W.M. Jones [Fri, 14 Sep 2012 09:32:18 +0000 (10:32 +0100)]
daemon: Fix error message when libvirtd is missing.

Currently we search along the hard-coded names:
  SBINDIR "/libvirtd"
  SBINDIR "/libvirtd_dbg"
but if the environment variable $LIBVIRTD_PATH is set to the
name of the libvirtd binary, that is used instead.  Fix the
error message so it accurately reflects current behaviour
($PATH is NOT searched).

12 years agogitignore: Ignore .gdb_history file.
Richard W.M. Jones [Fri, 14 Sep 2012 09:09:51 +0000 (10:09 +0100)]
gitignore: Ignore .gdb_history file.

12 years agoFix the augea test for qemu libvirtd options
Daniel Veillard [Tue, 18 Sep 2012 08:28:43 +0000 (16:28 +0800)]
Fix the augea test for qemu libvirtd options

Commit 1ccf22277be013beb3f26f0083867c9c9eddca18 forgot to
add the output to the augeas test

12 years agonetwork: implement backend of virNetworkUpdate(IP_DHCP_HOST)
Laine Stump [Mon, 17 Sep 2012 21:03:11 +0000 (17:03 -0400)]
network: implement backend of virNetworkUpdate(IP_DHCP_HOST)

This patch fills in the first implementation for one of the
virNetworkUpdate sections. With this code, you can now add/delete/edit
<host> entries in a network's <ip> address <dhcp> element (by
specifying a section of VIR_NETWORK_SECTION_IP_DHCP_HOST).

If you pass in a parentIndex of -1, the code will automatically find
the one ip element that has a <dhcp> section and make the updates
there. Otherwise, you can specify an index >= 0, and libvirt will look
for that particular instance of <ip> in the network, and modify its
<dhcp> element. (This currently isn't very useful, because libvirt
only supports having dhcp information on a single IP address, but that
could change in the future).

When adding a new host entry
(VIR_NETWORK_UPDATE_COMMAND_ADD_(FIRST|LAST)), the existing entries
will be compared to the new entry, and if any non-empty attribute
matches, the add will fail. When updating an existing entry
(VIR_NETWORK_UPDATE_COMMAND_MODIFY), the mac address or name will be
used to find the existing entry, and other fields will only be updated
(note there is some potential for ambiguity here if you specify the
mac address from one entry and the name from another).  When deleting
an existing entry (VIR_NETWORK_UPDATE_COMMAND_DELETE), all non-empty
attributes in the supplied xml arg will be compared - all of them must
match before libvirt will delete the host.

The xml should be a fully formed <host> element as it would appear in
a network definition, e.g. "<host mac=00:11:22:33:44:55 ip=10.1.23.22
name='testbox'/>" (when adding/updating, ip and one of mac|name is
required; when deleting, you can specify any one, two, or all
attributes, but they all must match the target element).

As with the update of any other section, you can choose to affect the
live config (with flag VIR_NETWORK_UPDATE_AFFECT_LIVE), the persistent
config (VIR_NETWORK_UPDATE_AFFECT_CONFIG), or both. If you've chosen
to affect the live config, those changes will take effect immediately,
with no need to destroy/restart the network.

An example of adding a host entry:

   virNetworkUpdate(net, VIR_NETWORK_UPDATE_COMMAND_ADD_LAST,
                     VIR_NETWORK_SECTION_IP_DHCP_HOST, -1,
                    "<host mac='00:11:22:33:44:55' ip='192.168.122.5'/>",
                    VIR_NETWORK_UPDATE_AFFECT_LIVE
                    | VIR_NETWORK_UPDATE_AFFECT_CONFIG);

To delete that same entry:

   virNetworkUpdate(net, VIR_NETWORK_UPDATE_COMMAND_DELETE,
                    VIR_NETWORK_SECTION_IP_DHCP_HOST, -1,
                    "<host mac='00:11:22:33:44:55'/>",
                    VIR_NETWORK_UPDATE_AFFECT_LIVE
                    | VIR_NETWORK_UPDATE_AFFECT_CONFIG);

(you could also delete it by replacing "mac='00:11:22:33:44:55'" with
"ip='192.168.122.5'".)

12 years agonetwork: restart radvd/dnsmasq if needed when libvirtd is restarted
Laine Stump [Mon, 17 Sep 2012 01:22:27 +0000 (21:22 -0400)]
network: restart radvd/dnsmasq if needed when libvirtd is restarted

A user on IRC had accidentally killed all of his libvirt-started
dnsmasq instances (due to a buggy dnsmasq service script in Fedora
16), and had hoped that libvirtd would notice this on restart and
reload all the dnsmasq daemons (as it does with iptables
rules). Unfortunately this was not the case - as long as the network
object had a pid registered for dnsmasq and/or radvd, it assumed that
the processes were running.

This patch takes advantage of the new utility functions in
bridge_driver.c to do a "refresh" of all radvd and dnsmasq processes
started by libvirt each time libvirtd is restarted - this function
attempts to do a SIGHUP of each existing process, and if that fails,
it restarts the process, rebuilding all the associated config files
and commandline parameters in the process. This normally has no
effect, but will be useful in solving the occasional "odd situation"
without needing to take the drastic step of destroying/re-starting the
network.

12 years agonetwork: implement virNetworkUpdate for test_driver
Laine Stump [Mon, 20 Aug 2012 05:01:53 +0000 (01:01 -0400)]
network: implement virNetworkUpdate for test_driver

The test driver does nothing outside of keeping track of each
network's config/state in the in-memory database maintained by
network_conf functions, so all we have to do is call the function that
updates the network's entry in the in-memory database.

12 years agonetwork: implement virNetworkUpdate for bridge_driver
Laine Stump [Sun, 16 Sep 2012 20:42:01 +0000 (16:42 -0400)]
network: implement virNetworkUpdate for bridge_driver

Call the network_conf function that modifies the live/persistent/both
config, then refresh/restart dnsmasq/radvd if necessary, and finally
save the config in the proper place(s).

This patch also needed to uncomment a few utility functions that were
added inside #if 0 in the previous commit (to avoid compiler errors
due to unreferenced static functions).

12 years agonetwork: reorganize dnsmasq and radvd config file / startup
Laine Stump [Mon, 20 Aug 2012 04:59:46 +0000 (00:59 -0400)]
network: reorganize dnsmasq and radvd config file / startup

This patch splits the starting of dnsmasq and radvd into multiple
files, and adds new networkRefreshXX() and networkRestartXX()
functions for each. These new functions are currently commented out
because they won't be used until the next commit, and the compile options
require all static functions to be used.

networkRefreshXX() - rewrites any file-based config for dnsmasq/radvd,
and sends SIGHUP to the process to make it reread its config. If the
program isn't already running, it's just started.

networkRestartXX() - kills the given program, waits for it to exit
(see the comments in the function networkKillDaemon()), then calls
networkStartXX().

This commit is here mostly as a checkpoint to verify no change in
functional behavior after refactoring networkStartXX() functions to
fit in with these new functions.

12 years agoconf: implement NetworkObj backend of virNetworkUpdate API
Laine Stump [Fri, 14 Sep 2012 19:14:57 +0000 (15:14 -0400)]
conf: implement NetworkObj backend of virNetworkUpdate API

virNetworkObjUpdate takes care of all virNetworkUpdate-related changes
to the data stored in the in-memory virNetworkObj list. It should be
called by network drivers that use this in-memory list.

virNetworkObjUpdate *does not* take care of updating any disk-based
copies of the config, nor does it perform any other operations
necessary to have the new config data take effect (e.g. it won't
re-write dnsmasq host files, nor will it send a SIGHUP to dnsmasq) -
those things should all be taken care of in the network driver
function that calls virNetworkObjUpdate (assuming that it returns
success).

12 years agonetwork: utility functions for updating network config
Laine Stump [Fri, 14 Sep 2012 15:35:35 +0000 (11:35 -0400)]
network: utility functions for updating network config

These new functions are highly inspired by those in domain_conf.c (but
not identical), and are intended to make it simpler to update the
various combinations of live/persistent network configs.

The network driver wasn't previously as careful about the separation
between the live "status" in network->def and the persistent "config"
in network->newDef (or sometimes in network->def). This series
attempts to remedy some of that, but probably doesn't go all the way
(enough to get these functions working and enable continued work on
virNetworkUpdate though).

bridge_driver.c and test_driver.c were updated in a few places to take
advantage of the new functions and/or account for changes in argument
lists.

12 years agonetwork: implement RPC calls for virNetworkUpdate
Laine Stump [Mon, 20 Aug 2012 03:54:57 +0000 (23:54 -0400)]
network: implement RPC calls for virNetworkUpdate

This is very short, because almost everything is autogenerated. All
that's needed are:

* src/remote/remote_driver.c: add pointer to autogenerated
    remoteNetworkUpdate to the function table for the remote
    network driver.

* src/remote/remote_protocol.x: add the "args" struct and add one more
    item to the remote_procedure enum for this function.

* src/remote_protocol-struct: update to match remote_protocol.x

12 years agonetwork: define new API virNetworkUpdate
Laine Stump [Mon, 20 Aug 2012 03:35:47 +0000 (23:35 -0400)]
network: define new API virNetworkUpdate

This patch adds a new public API virNetworkUpdate that will permit
updating an existing network configuration without requiring that the
network be destroyed/restarted for the changes to take effect.

12 years agotests: add qemu-1.2.0 help data
Ján Tomko [Mon, 17 Sep 2012 07:59:55 +0000 (09:59 +0200)]
tests: add qemu-1.2.0 help data

Generated with:

qemu-system-x86_64 -help >tests/qemuhelpdata/qemu-1.2.0
qemu-system-x86_64 \
    -device ? \
    -device pci-assign,? \
    -device virtio-blk-pci,? \
    -device virtio-net-pci,? \
    -device scsi-disk,? 2>tests/qemuhelpdata/qemu-1.2.0-device

12 years agoqemu: add -sandbox to command line if requested
Ján Tomko [Mon, 17 Sep 2012 07:59:54 +0000 (09:59 +0200)]
qemu: add -sandbox to command line if requested

12 years agoqemu: conf: add seccomp_sandbox option
Ján Tomko [Mon, 17 Sep 2012 07:59:53 +0000 (09:59 +0200)]
qemu: conf: add seccomp_sandbox option

12 years agoqemu: add capability flag for seccomp sandbox
Ján Tomko [Tue, 18 Sep 2012 07:24:51 +0000 (15:24 +0800)]
qemu: add capability flag for seccomp sandbox

This series adds support to run QEMU with seccomp sandbox enabled. It can be
configured in qemu.conf to on, off, or the QEMU default, which is off in 1.2.
Default value is the QEMU default.

12 years agoqemu: Avoid deadlock on HandleAgentEOF
Michal Privoznik [Fri, 14 Sep 2012 08:53:00 +0000 (10:53 +0200)]
qemu: Avoid deadlock on HandleAgentEOF

On agent EOF the qemuProcessHandleAgentEOF() callback is called
which locks virDomainObjPtr. Then qemuAgentClose() is called
(with domain object locked) which eventually calls qemuAgentDispose()
and qemuProcessHandleAgentDestroy(). This tries to lock the
domain object again. Hence the deadlock.

12 years agoqemu: Use disk wwn in qemu command line
Osier Yang [Tue, 11 Sep 2012 08:57:04 +0000 (16:57 +0800)]
qemu: Use disk wwn in qemu command line

All of ide-drive, ide-hd, ide-cd, scsi-disk, scsi-hd, and scsi-cd
supports wwn property. (NB, scsi-block doesn't support to set wwn).

* src/qemu/qemu_command.c: Error out if underlying QEMU doesn't
support wwn property for the device; Set wwn for the device otherwise.

* tests/qemuxml2argvdata/qemuxml2argv-disk-ide-wwn.args: New test
* tests/qemuxml2argvdata/qemuxml2argv-disk-ide-wwn.xml: Likewise
* tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-disk-wwn.args: Likewise
* tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-disk-wwn.xml: Likewise
* tests/qemuxml2argvtest.c: Add the new tests.

12 years agoqemu: Add caps to indentify if setting wwn is supported by qemu
Osier Yang [Tue, 18 Sep 2012 02:12:11 +0000 (10:12 +0800)]
qemu: Add caps to indentify if setting wwn is supported by qemu

This assumes ide-drive.wwn, ide-hd.wwn, ide-cd.wwn were supported
at the same time, similar for scsi-disk.wwn, scsi-hd.wwn, and
scsi-cd.wwn. So only two new caps (QEMU_CAPS_IDE_DRIVE_WWN,
and QEMU_CAPS_SCSI_DISK_WWN) are introduced.

12 years agoconf: Parse and format disk <wwn>
Osier Yang [Tue, 11 Sep 2012 08:57:02 +0000 (16:57 +0800)]
conf: Parse and format disk <wwn>

Validates the wwn while parsing, error out if it's malformed.

* src/util/util.h: Declare virValidateWWN
* src/util/util.c: Implement virValidateWWN
* src/libvirt_private.syms: Export virValidateWWN.
* src/conf/domain_conf.h: New member 'wwn' for disk def.
* src/conf/domain_conf.c: Parse and format disk <wwn>

12 years agoschema: Add schema for disk <wwn>
Osier Yang [Tue, 11 Sep 2012 08:57:01 +0000 (16:57 +0800)]
schema: Add schema for disk <wwn>

* docs/formatdomain.html.in: Add document.
* docs/schemas/nodedev.rng: Move definition of "wwn" to ...
* docs/schemas/basictypes.rng: ...Here
* docs/schemas/domaincommon.rng: Add schema for disk <wwn>

12 years agoblockjob: add blockcommit support to rpc
Eric Blake [Mon, 17 Sep 2012 20:07:18 +0000 (14:07 -0600)]
blockjob: add blockcommit support to rpc

Relatively straightforward.  Our decision to make block job
speed a long keeps haunting us on new API.

* src/remote/remote_protocol.x (remote_domain_block_commit_args):
New struct.
* src/remote/remote_driver.c (remote_driver): Enable it.
* src/remote_protocol-structs: Regenerate.
* src/rpc/gendispatch.pl (long_legacy): Exempt another bandwidth.

12 years agoblockjob: add virsh blockcommit
Eric Blake [Mon, 17 Sep 2012 20:56:01 +0000 (14:56 -0600)]
blockjob: add virsh blockcommit

The new command 'virsh blockcommit $dom $disk' requests the start
of an asynchronous commit operation across the entire chain of
$disk.  Further arguments can fine-tune which portion of the
chain is committed.  Existing 'virsh blockjob' commands can then
track the status, change the bandwidth, or abort the commit job.

With a bit more on the command line, 'virsh blockcommit $dom $disk
--wait --verbose' can be used for blocking behavior, with visual
feedback on the overall status, and can be canceled with Ctrl-C.

The overall design, including the wait loop logic, borrows heavily
from the existing blockpull command.

* tools/virsh-domain.c (cmdBlockCommit): New function.
* tools/virsh.pod (blockcommit): Document it.

12 years agoblockjob: add virDomainBlockCommit
Eric Blake [Mon, 17 Sep 2012 17:56:27 +0000 (11:56 -0600)]
blockjob: add virDomainBlockCommit

A block commit moves data in the opposite direction of block pull.
Block pull reduces the chain length by dropping backing files after
data has been pulled into the top overlay, and is always safe; block
commit reduces the chain length by dropping overlays after data has
been committed into the backing file, and any files that depended
on base but not on top are invalidated at any point where they have
unallocated data that is now pointing to changed contents in base.
Both directions are useful, however: a qcow2 layer that is more than
50% allocated will typically be faster with a pull operation, while
a qcow2 layer with less than 50% allocation will be faster as a
commit operation.  Committing across multiple layers can be more
efficient than repeatedly committing one layer at a time, but
requires extra support from the hypervisor.

This API matches Jeff Cody's proposed qemu command 'block-commit':
https://lists.gnu.org/archive/html/qemu-devel/2012-09/msg02226.html

Jeff's command is still in the works for qemu 1.3, and may gain
further enhancements, such as the ability to control on-error
handling (it will be comparable to the error handling Paolo is
adding to 'drive-mirror', so a similar solution will be needed
when I finally propose virDomainBlockCopy with more functionality
than the basics supported by virDomainBlockRebase).  However, even
without qemu support, this API will be useful for _offline_ block
commits, by wrapping qemu-img calls and turning them into a block
job, so this API is worth committing now.

For some examples of how this will be implemented, all starting
with the chain: base <- snap1 <- snap2 <- active

+ These are equivalent:
 virDomainBlockCommit(dom, disk, NULL, NULL, 0, 0)
 virDomainBlockCommit(dom, disk, NULL, "active", 0, 0)
 virDomainBlockCommit(dom, disk, "base", NULL, 0, 0)
 virDomainBlockCommit(dom, disk, "base", "active", 0, 0)
but cannot be implemented for online qemu with round 1 of
Jeff's patches; and for offline images, it would require
three back-to-back qemu-img invocations unless qemu-img
is patched to allow more efficient multi-layer commits;
the end result would be 'base' as the active disk with
contents from all three other files, where 'snap1' and
'snap2' are invalid right away, and 'active' is invalid
once any further changes to 'base' are made.

+ These are equivalent:
 virDomainBlockCommit(dom, disk, "snap2", NULL, 0, 0)
 virDomainBlockCommit(dom, disk, NULL, NULL, 0, _SHALLOW)
they cannot be implemented for online qemu, but for offline,
it is a matter of 'qemu-img commit active', so that 'snap2'
is now the active disk with contents formerly in 'active'.

+ Similarly:
 virDomainBlockCommit(dom, disk, "snap2", NULL, 0, _DELETE)
for an offline domain will merge 'active' into 'snap2', then
delete 'active' to avoid leaving a potentially invalid file
around.

+ This version:
 virDomainBlockCommit(dom, disk, NULL, "snap2", 0, _SHALLOW)
can be implemented online with 'block-commit' passing a base of
snap1 and a top of snap2; and can be implemented offline by
'qemu-img commit snap2' followed by 'qemu-img rebase -u
-b snap1 active'

* include/libvirt/libvirt.h.in (virDomainBlockCommit): New API.
* src/libvirt.c (virDomainBlockCommit): Implement it.
* src/libvirt_public.syms (LIBVIRT_0.10.2): Export it.
* src/driver.h (virDrvDomainBlockCommit): New driver callback.
* docs/apibuild.py (CParser.parseSignature): Add exception.

12 years agoqemu: drop unused arguments for dump-guest-memory
Eric Blake [Mon, 17 Sep 2012 19:05:29 +0000 (13:05 -0600)]
qemu: drop unused arguments for dump-guest-memory

Upstream qemu has raised a concern about whether dumping guest
memory by reading guest paging tables is a security hole:
https://lists.gnu.org/archive/html/qemu-devel/2012-09/msg02607.html

While auditing libvirt to see if we would be impacted, I noticed
that we had some dead code.  It is simpler to nuke the dead code
and limit our monitor code to just the subset we make use of.

* src/qemu/qemu_monitor.h (QEMU_MONITOR_DUMP): Drop poorly named
and mostly-unused enum.
* src/qemu/qemu_monitor.c (qemuMonitorDumpToFd): Drop arguments.
* src/qemu/qemu_monitor_json.h (qemuMonitorJSONDump): Likewise.
* src/qemu/qemu_monitor_json.c (qemuMonitorJSONDump): Likewise.
* src/qemu/qemu_driver.c (qemuDumpToFd): Update caller.

12 years agobuild: Fix build failure on non-linux platform
Osier Yang [Mon, 17 Sep 2012 14:05:48 +0000 (22:05 +0800)]
build: Fix build failure on non-linux platform

12 years agoconf: avoid freeing network object with undestroyed mutex
Laine Stump [Fri, 14 Sep 2012 08:53:54 +0000 (04:53 -0400)]
conf: avoid freeing network object with undestroyed mutex

virNetworkAssignDef was allocating a new network object, initing and
grabbing its lock, then potentially freeing it without unlocking or
destroying the lock. In practice 1) this will probably never happen,
and 2) even if it did, the lock implementation used on most (all?)
platforms doesn't actually hold any resources for an initialized or
held lock, but it still bothered me, so I moved the realloc that could
lead to this bad situation earlier in the function, and now the mutex
isn't inited or locked until we are assured of complete success.

12 years agoconf: separate functions to parse DHCPHostDef and DHCPRangeDef
Laine Stump [Fri, 14 Sep 2012 18:57:34 +0000 (14:57 -0400)]
conf: separate functions to parse DHCPHostDef and DHCPRangeDef

These two objects were previously always parsed as a part of an IpDef,
but we will now need to be able to parse them on their own for
virNetworkUpdate(). Split the parsing functions out, with no
functional changes.

12 years agoremove virDomainCpuSetFormat and virDomainCpuSetParse
Hu Tao [Fri, 14 Sep 2012 07:47:04 +0000 (15:47 +0800)]
remove virDomainCpuSetFormat and virDomainCpuSetParse

virBitmap is recommanded to store cpuset info, and
virBitmapFormat/virBitmapParse can do the format/parse
jobs.

12 years agoxen: eliminate remaining uses of virDomainCpuSetParse
Laine Stump [Mon, 17 Sep 2012 18:38:20 +0000 (14:38 -0400)]
xen: eliminate remaining uses of virDomainCpuSetParse

The final patch in Hu Tao's series to enhance virBitmap actually
removes virDomainCpuSetParse and virDomainCpuSetFormat as "no longer
used", and the rest of the series hadn't taken care of two uses of
virDomainCpuSetParse in the xen code.

This patch replaces those with appropriate virBitmap functions. It
should be pushed prior to the patch removing virDomainCpuSetParse.

12 years agouse virBitmap to store nodeinfo.
Hu Tao [Fri, 14 Sep 2012 07:47:03 +0000 (15:47 +0800)]
use virBitmap to store nodeinfo.

12 years agouse virBitmap to store cells' cpumask info.
Hu Tao [Fri, 14 Sep 2012 07:47:02 +0000 (15:47 +0800)]
use virBitmap to store cells' cpumask info.