]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agonodeinfo: port nodecpumap to RHEL5
Eric Blake [Thu, 15 Nov 2012 14:04:33 +0000 (07:04 -0700)]
nodeinfo: port nodecpumap to RHEL5

Prior to this patch, 'virsh nodecpumap' on older kernels reported:
error: Unable to get cpu map
error: out of memory

* src/nodeinfo.c (linuxParseCPUmax): Don't overwrite error.
(nodeGetCPUBitmap): Provide backup implementation.

12 years agonodeinfo: support kernels that lack socket information
Eric Blake [Thu, 1 Nov 2012 22:20:09 +0000 (16:20 -0600)]
nodeinfo: support kernels that lack socket information

On RHEL 5, I was getting a segfault trying to start libvirtd,
because we were failing virNodeParseSocket but not checking
for errors, and then calling CPU_SET(-1, &sock_map) as a result.
But if you don't have a topology/physical_package_id file,
then you can just assume that the cpu belongs to socket 0.

* src/nodeinfo.c (virNodeGetCpuValue): Change bool into
default_value.
(virNodeParseSocket): Allow for default value when file is missing,
different from fatal error on reading file.
(virNodeParseNode): Update call sites to fail on error.

12 years agoRevert "virsh: add aliases 'boot', 'stop', and 'restart'"
Eric Blake [Fri, 16 Nov 2012 15:23:17 +0000 (08:23 -0700)]
Revert "virsh: add aliases 'boot', 'stop', and 'restart'"

This reverts commits 5f63a5cb42642f945696c51bbce7fdc160325510
and ff86b0c97b0525a2cd26048a0dbf16e600aaeb7b.  After much list
discussion, consensus was that libvirt aliases should be reserved
to correct typos, otherwise it risks confusion.  Rather, we
should implement a way for users to provide their own aliases
as part of their virsh configuration preferences.

12 years agosnapshot: require user to supply external memory file name
Eric Blake [Thu, 15 Nov 2012 23:38:13 +0000 (16:38 -0700)]
snapshot: require user to supply external memory file name

For disk snapshots, the user could request an external snapshot
but not supply a filename; later on, we would check this condition
and generate a suitable name if possible, or gracefully error out
when not possible (such as when the original file was a block
device).  But unless we come up with a suitable way to generate
external memory file names, we have no later code point that was
checking for NULL, so we should forbid this up front.

* src/conf/snapshot_conf.c (virDomainSnapshotDefParseString):
Avoid NULL deref, since we don't generate names yet.

12 years agoqemu: Beautify code indent in migration codes
liguang [Fri, 16 Nov 2012 08:03:42 +0000 (16:03 +0800)]
qemu: Beautify code indent in migration codes

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
12 years agosanlock: Retry after EINPROGRESS
Michal Privoznik [Thu, 15 Nov 2012 10:19:08 +0000 (11:19 +0100)]
sanlock: Retry after EINPROGRESS

It may take some time for sanlock to add a lockspace. And if user
restart libvirtd service meanwhile, the fresh daemon can fail adding
the same lockspace with EINPROGRESS. Recent sanlock has
sanlock_inq_lockspace() function which should block until lockspace
changes state. If we are building against older sanlock we should
retry a few times before claiming an error. This issue can be easily
reproduced:

for i in {1..1000} ; do echo $i; service libvirtd restart; sleep 2; done
20
Stopping libvirtd daemon:                                  [FAILED]
Starting libvirtd daemon:                                  [  OK  ]
21
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]
22
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]

 error : virLockManagerSanlockSetupLockspace:334 : Unable to add
 lockspace /var/lib/libvirt/sanlock/__LIBVIRT__DISKS__: Operation now in
 progress

12 years agovirsh: save: report an error if XML file can't be read
Ján Tomko [Thu, 15 Nov 2012 13:25:09 +0000 (14:25 +0100)]
virsh: save: report an error if XML file can't be read

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

12 years agovirsh: Use virNodeGetCPUMap if possible
Viktor Mihajlovski [Tue, 13 Nov 2012 12:54:39 +0000 (13:54 +0100)]
virsh: Use virNodeGetCPUMap if possible

Modified the places where virNodeGetInfo was used for the purpose
of obtaining the maximum node CPU number. Transparently falling
back to virNodeGetInfo in case of failure.
Wrote utility function vshNodeGetCPUCount to compute node CPU
number.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agopython: Use virNodeGetCPUMap where possible
Viktor Mihajlovski [Tue, 13 Nov 2012 12:54:38 +0000 (13:54 +0100)]
python: Use virNodeGetCPUMap where possible

Modified the places where virNodeGetInfo was used for the purpose
of obtaining the maximum node CPU number. Transparently falling
back to virNodeGetInfo in case of failure.
Wrote a utility function getPyNodeCPUCount for that purpose.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoqemu, lxc: Change host CPU number detection logic.
Viktor Mihajlovski [Tue, 13 Nov 2012 12:54:37 +0000 (13:54 +0100)]
qemu, lxc: Change host CPU number detection logic.

The drivers for QEMU and LXC use virNodeGetInfo only to determine
the number of host CPUs. On Linux hosts nodeGetCPUCount has less
overhead.

12 years agovirsh: fix uninitialized variable in cmdSnapshotEdit
Ján Tomko [Thu, 15 Nov 2012 10:37:32 +0000 (11:37 +0100)]
virsh: fix uninitialized variable in cmdSnapshotEdit

If the domain can't be looked up, name is used unitialized after the
cleanup label.

Found by coverity.

12 years agonodeinfo: enable nodeGetCPUCount for older kernels
Viktor Mihajlovski [Tue, 13 Nov 2012 12:54:36 +0000 (13:54 +0100)]
nodeinfo: enable nodeGetCPUCount for older kernels

Since /sys/devices/system/cpu/present is not available on
older kernels like on RHEL 5.x nodeGetCPUCount will
fail there. The fallback implemented is to scan for
/sys/devices/system/cpu/cpuNN entries.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoUse helper functions to format the journal iov array
Miloslav Trmač [Wed, 17 Oct 2012 18:17:16 +0000 (20:17 +0200)]
Use helper functions to format the journal iov array

This simplifies the top-level code, at the cost of using a little more
stack space.  The primary benefit is being able to send more fields
without knowing in advance how many of them, and of which types, these
fields will be, and without having to individually add buffer variables.

The code imposes an upper limit on the total number of iovs/buffers
used, and fields that wouldn't fit are silently dropped.  This is not
significant in this patch, but will affect the following one.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
12 years agoAdd metadata to virLogOutputFunc
Miloslav Trmač [Wed, 17 Oct 2012 18:17:15 +0000 (20:17 +0200)]
Add metadata to virLogOutputFunc

... and update all users.  No change in functionality, the parameter
will be used in the next patch.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
12 years agoAdd a metadata parameter to virLog{, V}Message
Miloslav Trmač [Wed, 17 Oct 2012 18:17:14 +0000 (20:17 +0200)]
Add a metadata parameter to virLog{, V}Message

... and update all users.  No change in functionality, the parameter
will be used later.

The metadata representation is as minimal as possible, but requires
the caller to allocate an array on stack explicitly.

The alternative of using varargs in the virLogMessage() callers:
* Would not allow the caller to optionally omit some metadata elements,
  except by having two calls to virLogMessage.
* Would not be as type-safe (e.g. using int vs. size_t), and the compiler
  wouldn't be able to do type checking
* Depending on parameter order:
  a) virLogMessage(..., message format, message params...,
                   metadata..., NULL)
     can not be portably implemented (parse_printf_format() is a glibc
     function)
  b) virLogMessage(..., metadata..., NULL,
                   message format, message params...)
     would prevent usage of ATTRIBUTE_FMT_PRINTF and the associated
     compiler checking.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
12 years agoqemu: add bootindex for usb-host and usb-redir devices
Ján Tomko [Wed, 14 Nov 2012 14:51:30 +0000 (15:51 +0100)]
qemu: add bootindex for usb-host and usb-redir devices

Allow bootindex to be specified for redirected USB devices and host USB
devices.

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

12 years agoDoug Goldstein gained commit capability
Daniel Veillard [Thu, 15 Nov 2012 01:34:01 +0000 (09:34 +0800)]
Doug Goldstein gained commit capability

12 years agobuild: rerun bootstrap if AUTHORS is missing
Eric Blake [Wed, 14 Nov 2012 20:20:55 +0000 (13:20 -0700)]
build: rerun bootstrap if AUTHORS is missing

Ever since commit 7b21981c started generating AUTHORS, we now have
the situation that if you flip between two branches in the same
git repository that cross that commit boundary, then 'make' will
fail due to automake complaining about AUTHORS not existing.  The
simplest solution is to realize that if AUTHORS does not exist,
then we flipped branches so we will need to rerun bootstrap
anyways; and rerunning bootstrap ensures AUTHORS will exist in time.

* cfg.mk (_update_required): Also depend on AUTHORS.

12 years agoutil: fix index when building lock owners array
Laine Stump [Wed, 14 Nov 2012 17:07:13 +0000 (12:07 -0500)]
util: fix index when building lock owners array

The "restart" function for locks allocates a new array according to
and pre-sets its length, then reads the owner pids from a JSON
document in a loop. Rather than adding each owner at a different
index, though, it repeatedly overwrites the last element of the array
with all the owners.

12 years agoFix uninitialized variable in virLXCControllerSetupDevPTS
Daniel P. Berrange [Wed, 14 Nov 2012 15:39:48 +0000 (15:39 +0000)]
Fix uninitialized variable in virLXCControllerSetupDevPTS

The lack of initialization of 'opts' caused a SEGV in the
cleanup: path if the root->src directory did not exist

12 years agoqemu: Don't force port=0 for SPICE
Michal Privoznik [Mon, 12 Nov 2012 17:03:24 +0000 (18:03 +0100)]
qemu: Don't force port=0 for SPICE

If domain uses only TLS port we don't want to add
'port=0' explicitly to command line.

12 years agosnapshot: qemu: Fix detection of external snapshots when deleting
Peter Krempa [Fri, 19 Oct 2012 09:55:36 +0000 (11:55 +0200)]
snapshot: qemu: Fix detection of external snapshots when deleting

This patch adds a helper to determine if snapshots are external and uses
the helper to fix detection of those in snapshot deletion code.

Snapshots are external if they have an external memory image or if the
disk locations are external. As mixed snapshots are forbidden for now
we need to check just one disk to know.

12 years agotests: Remove temporary directories in qemumonitorjsontest
Peter Krempa [Mon, 12 Nov 2012 14:33:55 +0000 (15:33 +0100)]
tests: Remove temporary directories in qemumonitorjsontest

qemumonitorjsontest creates a temporary directory to hold the socket
that is simulating the monitor socket. The directory containing the
socket wasn't disposed properly at the end of the test leaving garbage
in the temporary folder.

12 years agotests: Fix qemumonitorjsontest deadlock when the machine is under load
Peter Krempa [Mon, 12 Nov 2012 10:34:41 +0000 (11:34 +0100)]
tests: Fix qemumonitorjsontest deadlock when the machine is under load

When doing the qemumonitorjsontest on a machine under heavy load the
test tends to deadlock from time to time. This patch adds the hack to
break the event loop that is used in virsh.

12 years agonodeinfotest: Add test data from a AMD bulldozer machine.
Peter Krempa [Wed, 7 Nov 2012 14:50:56 +0000 (15:50 +0100)]
nodeinfotest: Add test data from a AMD bulldozer machine.

The AMD Bulldozer architecture uses so called "Clustered integer core
modules" that count both as threads and cores. This patch expects the
cpu to be detected using the new fallback condition otherwise twice the
number of processors would be detected.

12 years agonodeinfotest: Add test data for 2 processor host with broken NUMA
Peter Krempa [Wed, 7 Nov 2012 14:19:47 +0000 (15:19 +0100)]
nodeinfotest: Add test data for 2 processor host with broken NUMA

This test data was gathered on an AMD MagnyCours machine that reports it
has only one NUMA node although the hardware is consisting of 4. As
duplicate core id's are ignored the reported topology was bogous. This
should be fixed by the previous patch.

Reported and data provided by George-Cristian Bîrzan.

12 years agonodeinfo: Add check and workaround to guarantee valid cpu topologies
Peter Krempa [Wed, 7 Nov 2012 13:53:36 +0000 (14:53 +0100)]
nodeinfo: Add check and workaround to guarantee valid cpu topologies

Lately there were a few reports of the output of the virsh nodeinfo
command being inaccurate. This patch tries to avoid that by checking if
the topology actually makes sense. If it doesn't we then report a
synthetic topology that indicates to the user that the host capabilities
should be checked for the actual topology.

12 years agoAbortJob: Fix documentation
Michal Privoznik [Thu, 8 Nov 2012 14:11:41 +0000 (15:11 +0100)]
AbortJob: Fix documentation

This API was never synchronous and probably doesn't even need to be.

12 years agoqemu: Allow migration to be cancelled at prepare phase
Michal Privoznik [Thu, 8 Nov 2012 13:49:55 +0000 (14:49 +0100)]
qemu: Allow migration to be cancelled at prepare phase

Currently, if user calls virDomainAbortJob we just issue
'migrate_cancel' and hope for the best. However, if user calls
the API in wrong phase when migration hasn't been started yet
(perform phase) the cancel request is just ignored. With this
patch, the request is remembered and as soon as perform phase
starts, migration is cancelled.

12 years agocapabilities: defaultConsoleTargetType can depend on architecture
Viktor Mihajlovski [Fri, 9 Nov 2012 15:00:36 +0000 (16:00 +0100)]
capabilities: defaultConsoleTargetType can depend on architecture

For S390, the default console target type cannot be of type 'serial'.
It is necessary to at least interpret the 'arch' attribute
value of the os/type element to produce the correct default type.

Therefore we need to extend the signature of defaultConsoleTargetType
to account for architecture. As a consequence all the drivers
supporting this capability function must be updated.

Despite the amount of changed files, the only change in behavior is
that for S390 the default console target type will be 'virtio'.

N.B.: A more future-proof approach could be to to use hypervisor
specific capabilities to determine the best possible console type.
For instance one could add an opaque private data pointer to the
virCaps structure (in case of QEMU to hold capsCache) which could
then be passed to the defaultConsoleTargetType callback to determine
the console target type.
Seems to be however a bit overengineered for the use case...

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoqemu: Fix domain ID numbering race condition
Peter Krempa [Thu, 8 Nov 2012 12:48:37 +0000 (13:48 +0100)]
qemu: Fix domain ID numbering race condition

When the libvirt daemon is restarted it tries to reconnect to running
qemu domains. Since commit d38897a5d4b1880e1998394b2a37bba979bbdff1 the
re-connection code runs in separate threads. In the original
implementation the maximum of domain ID's (that is used as an
initializer for numbering guests created next) while libvirt was
reconnecting to the guest.

With the threaded implementation this opens a possibility for race
conditions with the thread that is autostarting guests. When there's a
guest running with id 1 and the daemon is restarted. The autostart code
is reached first and spawns the first guest that should be autostarted
as id 1. This results into the following unwanted situation:

 # virsh list
   Id    Name                           State
  ----------------------------------------------------
   1     guest1                         running
   1     guest2                         running

This patch extracts the detection code before the re-connection threads
are started so that the maximum id of the guests being reconnected to is
known.

The only semantic change created by this is if the guest with greatest ID
quits before we are able to reconnect it's ID is used anyway as the
greatest one as without this patch the greatest ID of a process we could
successfuly reconnect to would be used.

12 years agostorage: fix broken backing chain
Philipp Hahn [Wed, 7 Nov 2012 13:53:49 +0000 (14:53 +0100)]
storage: fix broken backing chain

82507838 refactored the code to keep both the raw and canonicalized form
of the backingStore, which breaks badly when the storage pool contains a
storage volume, which is missing its backing store file:
 # ./daemon/libvirtd -l
 2012-11-07 12:43:33.279+0000: 22175: info : libvirt version: 1.0.0
 2012-11-07 12:43:33.279+0000: 22175: error : absolutePathFromBaseFile:542 : Can't canonicalize path '/var/lib/libvirt/images/base.qcow2': No such file or directory
 2012-11-07 12:43:33.280+0000: 22175: error : storageDriverAutostart:115 : Failed to autostart storage pool 'default': Can't canonicalize path '/var/lib/libvirt/images/base.qcow2': No such file or directory

This is because virStorageFileGetMetadataFromBuf() aborts with -1 if the
filename of the backingStore can not be canonicalized:
 #0  absolutePathFromBaseFile () at util/storage_file.c:541
 #1  virStorageFileGetMetadataFromBuf () at util/storage_file.c:728
 #2  virStorageFileGetMetadataFromFD () at util/storage_file.c:932
 #3  virStorageBackendProbeTarget () at storage/storage_backend_fs.c:94
 #4  virStorageBackendFileSystemRefresh () at storage/storage_backend_fs.c:849
 #5  storagePoolStart () at storage/storage_driver.c:700
 #6  virStoragePoolCreate () at libvirt.c:12471
 ...

Treat files which miss their backing file as standalone files.

Signed-off-by: Philipp Hahn <hahn@univention.de>
12 years agoqemu: Fix function header formating of 2 functions
Peter Krempa [Thu, 8 Nov 2012 12:45:45 +0000 (13:45 +0100)]
qemu: Fix function header formating of 2 functions

Headers of qemuDomainSnapshotLoad and qemuDomainNetsRestart were
improperly formatted.

12 years agosnapshot: qemu: Add support for external inactive snapshots
Peter Krempa [Mon, 15 Oct 2012 15:35:24 +0000 (17:35 +0200)]
snapshot: qemu: Add support for external inactive snapshots

This patch adds support for external disk snapshots of inactive domains.
The snapshot is created by calling using qemu-img by calling:

 qemu-img create -f format_of_snapshot -o
 backing_file=/path/to/src,backing_fmt=format_of_backing_image
 /path/to/snapshot

in case the backing image format is known or probing is allowed and
otherwise:

 qemu-img create -f format_of_snapshot -o  backing_file=/path/to/src
 /path/to/snapshot

on each of the disks selected for snapshotting. This patch also modifies
the snapshot preparing function to support creating external snapshots
and to sanitize arguments. For now the user isn't able to mix external
and internal snapshots but this restriction might be lifted in the
future.

12 years agoFix "virsh create" example
Guido Günther [Wed, 7 Nov 2012 20:35:55 +0000 (21:35 +0100)]
Fix "virsh create" example

We require a file and don't accept standard input:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=692322

12 years agovirsh: add snapshot-create-as memspec support
Eric Blake [Wed, 7 Nov 2012 03:55:53 +0000 (20:55 -0700)]
virsh: add snapshot-create-as memspec support

External checkpoints could be created with snapshot-create, but
without libvirt supplying a default name for the memory file,
it is essential to add a new argument to snapshot-create-as to
allow the user to choose the memory file name.  This adds the
option --memspec [file=]name[,snapshot=type], where type can
be none, internal, or external.  For an example,

virsh snapshot-create-as $dom --memspec /path/to/file

is the shortest possible command line for creating an external
checkpoint, named after the current timestamp.

* tools/virsh-snapshot.c (vshParseSnapshotMemspec): New function.
(cmdSnapshotCreateAs): Use it.
* tests/virsh-optparse (test_url): Test it.
* tools/virsh.pod (snapshot-create-as): Document it.

12 years agovirsh: make ,, escape parsing common
Eric Blake [Wed, 7 Nov 2012 00:45:09 +0000 (17:45 -0700)]
virsh: make ,, escape parsing common

So far, none of the existing callers of vshStringToArray expected
the user to ever pass a literal comma; meanwhile, snapshot parsing
had rolled its own array parser.  Moving the comma escaping into
the common function won't affect any existing callers, and will make
this function reusable for adding memory handling to snapshot parsing.

As a bonus, the testsuite was already testing snapshot parsing, so
the fact that the test still passes means that we are now giving
testsuite exposure to vshStringToArray.

* tools/virsh-snapshot.c (vshParseSnapshotDiskspec): Move ,,
parsing...
* tools/virsh.c (vshStringToArray): ...into common function.
Also, vshStrdup can't fail.

12 years agoqemu: Emit event if 'cont' fails
Michal Privoznik [Mon, 5 Nov 2012 14:33:12 +0000 (15:33 +0100)]
qemu: Emit event if 'cont' fails

Some operations, APIs needs domain to be paused prior operation can be
performed, e.g. (managed-) save of a domain. The processors should be
restored in the end. However, if 'cont' fails for some reason, we log a
message but this is not sufficient as an event should be emitted as
well. Mgmt application can then decide what to do.

12 years agoIntroduce new VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR event
Michal Privoznik [Tue, 6 Nov 2012 17:39:18 +0000 (18:39 +0100)]
Introduce new VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR event

This is supposed to be thrown every time we need to pause domain
because of API execution (e.g. qemuDomainSaveInternal) but fails
to restore it back after. In this case, domain remains paused,
however, none of existing reasons can fit this scenario.

12 years agovirsh: document which term is older
Eric Blake [Tue, 6 Nov 2012 15:09:32 +0000 (08:09 -0700)]
virsh: document which term is older

Make it clear that the alternate terms have no difference except
for length of time they were supported.

* tools/virsh.pod (start, shutdown, reboot): More documentation.

12 years agovirsh: add aliases 'boot', 'stop', and 'restart'
Eric Blake [Mon, 5 Nov 2012 19:54:59 +0000 (12:54 -0700)]
virsh: add aliases 'boot', 'stop', and 'restart'

https://bugzilla.redhat.com/show_bug.cgi?id=873344 suggested that
the grouping 'boot', 'shutdown', 'reboot'; as well as the grouping
'start', 'stop', 'restart'; might be easier to remember than the
current mix of 'start', 'shutdown', 'reboot'.

Also, touch up the wording of 'reboot' to be more accurate.

* tools/virsh-domain.c (domManagementCmds): Add other command names.
* tools/virsh.pod (start, shutdown, reboot): Document the aliases.

12 years agoqemu: Don't corrupt pointer in qemuDomainSaveMemory()
Peter Krempa [Tue, 6 Nov 2012 09:55:26 +0000 (10:55 +0100)]
qemu: Don't corrupt pointer in qemuDomainSaveMemory()

The code that was split out into the qemuDomainSaveMemory expands the
pointer containing the XML description of the domain that it gets from
higher layers. If the pointer changes the old one is invalid and the
upper layer function tries to free it causing an abort.

This patch changes the expansion of the original string to a new
allocation and copy of the contents.

12 years agoesx: Yet another connection fix for 5.1
Martin Kletzander [Tue, 6 Nov 2012 09:08:43 +0000 (10:08 +0100)]
esx: Yet another connection fix for 5.1

After the connection to ESX 5.1 being broken since g1e7cd39, the fix
in bab7752c helped a bit, but still missed a spot, so the connection
is now successful, but some APIs (for example defineXML) don't work.
Two cases missing are added in this patch to avoid that.

12 years agotests: Add test for controller order
Michal Privoznik [Mon, 5 Nov 2012 11:12:04 +0000 (12:12 +0100)]
tests: Add test for controller order

12 years agoqemu: Add controllers in specified order
Michal Privoznik [Mon, 5 Nov 2012 10:51:44 +0000 (11:51 +0100)]
qemu: Add controllers in specified order

qemu is sensitive to the order of arguments passed. Hence, if a
device requires a controller, the controller cmd string must
precede device cmd string. The same apply for controllers, when
for instance ccid controller requires usb controller. So
controllers create partial ordering in which they should be added
to qemu cmd line.

12 years agoqemu: Wrap controllers code into dummy loop
Michal Privoznik [Mon, 5 Nov 2012 10:42:51 +0000 (11:42 +0100)]
qemu: Wrap controllers code into dummy loop

which just re-indent code and prepare it for next patch.

12 years agospec: replace scriptlets with new systemd macros
Václav Pavlín [Thu, 25 Oct 2012 10:10:55 +0000 (12:10 +0200)]
spec: replace scriptlets with new systemd macros

https://bugzilla.redhat.com/850186

I added %with_systemd_macros so it should now work in F17 with old
scriptlets and in F18+/RHEL7+ with systemd macros
(see https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd)

I missed libvirt-guests.service because there is no systemctl call for
it. So I only added systemd macros calls.

12 years agospec: don't enable cgconfig under systemd
Eric Blake [Mon, 5 Nov 2012 16:48:28 +0000 (09:48 -0700)]
spec: don't enable cgconfig under systemd

In Fedora 16, we quit enabling cgconfig because systemd set up
default cgroups that were good enough for our use.  But in F17,
when we switched to systemd, we reverted and started up cgconfig
again.  See also the tail of this thread:
https://www.redhat.com/archives/libvir-list/2012-October/msg01657.html

* libvirt.spec.in (with_systemd): Rely on systemd for cgroups.

12 years agoiohelper: Don't report errors on special FDs
Michal Privoznik [Mon, 5 Nov 2012 14:42:53 +0000 (15:42 +0100)]
iohelper: Don't report errors on special FDs

Some FDs may not implement fdatasync() functionality,
e.g.  pipes. In that case EINVAL or EROFS is returned.
We don't want to fail then nor report any error.

Reported-by: Christophe Fergeau <cfergeau@redhat.com>
12 years agogitignore: ignore more files
liguang [Mon, 5 Nov 2012 04:59:53 +0000 (12:59 +0800)]
gitignore: ignore more files

ignore cscope.in.out, cscope.po.out

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
12 years agosnapshot: qemu: Remove restrictions preventing external checkpoints
Peter Krempa [Mon, 8 Oct 2012 17:28:08 +0000 (19:28 +0200)]
snapshot: qemu: Remove restrictions preventing external checkpoints

Some of the pre-snapshot check have restrictions wired in regarding
configuration options that influence taking of external checkpoints.

This patch removes restrictions that would inhibit taking of such a
snapshot.

12 years agosnapshot: qemu: Add support for external checkpoints
Peter Krempa [Mon, 8 Oct 2012 17:38:44 +0000 (19:38 +0200)]
snapshot: qemu: Add support for external checkpoints

This patch adds support to take external system checkpoints.

The functionality is layered on top of the previous disk-only snapshot
code. When the checkpoint is requested the domain memory is saved to the
memory image file using migration to file. (The user may specify to
take the memory image while the guest is live with the
VIR_DOMAIN_SNAPSHOT_CREATE_LIVE flag.)

The memory save image shares format with the image created by
virDomainSave() API.

12 years agosnapshot: qemu: Rename qemuDomainSnapshotCreateActive
Peter Krempa [Mon, 8 Oct 2012 14:45:04 +0000 (16:45 +0200)]
snapshot: qemu: Rename qemuDomainSnapshotCreateActive

Before now, libvirt supported only internal snapshots for active guests.
This patch renames this function to qemuDomainSnapshotCreateActiveInternal
to prepare the grounds for external active snapshots.

12 years agosnapshot: qemu: Add async job type for snapshots
Peter Krempa [Mon, 8 Oct 2012 14:34:19 +0000 (16:34 +0200)]
snapshot: qemu: Add async job type for snapshots

The new external system checkpoints will require an async job while the
snapshot is taken. This patch adds QEMU_ASYNC_JOB_SNAPSHOT to track this
job type.

12 years agosnapshot: Add flag to enable creating checkpoints in live state
Peter Krempa [Tue, 9 Oct 2012 10:11:56 +0000 (12:11 +0200)]
snapshot: Add flag to enable creating checkpoints in live state

The default behavior while creating external checkpoints is to pause the
guest while the memory state is captured. We want the users to sacrifice
space saving for creating the memory save image while the guest is live
to minimize downtime.

This patch adds a flag that causes the guest not to be paused before
taking the snapshot.
 *include/libvirt/libvirt.h.in:
    - add new paused reason: VIR_DOMAIN_PAUSED_SNAPSHOT
    - add new flag for taking snapshot: VIR_DOMAIN_SNAPSHOT_CREATE_LIVE
 *tools/virsh-domain-monitor.c:
    - add string representation for VIR_DOMAIN_PAUSED_SNAPSHOT
 *tools/virsh-snapshot.c:
    - add support for VIR_DOMAIN_SNAPSHOT_CREATE_LIVE
 *tools/virsh.pod:
    - add docs for --live option added to use
    VIR_DOMAIN_SNAPSHOT_CREATE_LIVE flag

12 years agoqemu: Split out domain memory saving code to allow reuse
Peter Krempa [Wed, 26 Sep 2012 12:10:56 +0000 (14:10 +0200)]
qemu: Split out domain memory saving code to allow reuse

The code that saves domain memory by migration to file can be reused
while doing external checkpoints of a machine. This patch extracts the
common code and places it in a separate function.

12 years agoqemu: Clean up snapshot retrieval to use the new helper
Peter Krempa [Thu, 11 Oct 2012 09:59:40 +0000 (11:59 +0200)]
qemu: Clean up snapshot retrieval to use the new helper

Two other places were left with the old code to look up snapshots.
Change them to use the snapshot lookup helper.

12 years agocpu: Add AMD Opteron G5 cpu model
Peter Krempa [Tue, 30 Oct 2012 15:15:35 +0000 (16:15 +0100)]
cpu: Add AMD Opteron G5 cpu model

12 years agocpu: Add newly added cpu flags
Peter Krempa [Tue, 30 Oct 2012 13:58:55 +0000 (14:58 +0100)]
cpu: Add newly added cpu flags

This patch adds a few new processor feature flags. Namely:
 f16c rdrand lwp tbm topoext perfctr_core perfctr_nb fsgsbase bmi1 hle
 avx2 bmi2 erms invpcid rtm rdseed adx tce

12 years agoqemu: Fix possible race when pausing guest
Peter Krempa [Thu, 1 Nov 2012 14:45:47 +0000 (15:45 +0100)]
qemu: Fix possible race when pausing guest

When pausing the guest while migration is running (to speed up
convergence) the virDomainSuspend API checks if the migration job is
active before entering the job. This could cause a possible race if the
virDomainSuspend is called while the job is active but ends before the
Suspend API enters the job (this would require that the migration is
aborted). This would cause a incorrect event to be emitted.

12 years agosnapshot: merge pre-snapshot checks
Eric Blake [Tue, 23 Oct 2012 15:12:26 +0000 (17:12 +0200)]
snapshot: merge pre-snapshot checks

Both system checkpoint snapshots and disk snapshots were iterating
over all disks, doing a final sanity check before doing any work.
But since future patches will allow offline snapshots to be either
external or internal, it makes sense to share the pass over all
disks, and then relax restrictions in that pass as new modes are
implemented.  Future patches can then handle external disks when
the domain is offline, then handle offline --disk-snapshot, and
finally, combine with migration to file to gain a complete external
system checkpoint snapshot of an active domain without using 'savevm'.

* src/qemu/qemu_driver.c (qemuDomainSnapshotDiskPrepare)
(qemuDomainSnapshotIsAllowed): Merge...
(qemuDomainSnapshotPrepare): ...into one function.
(qemuDomainSnapshotCreateXML): Update caller.

12 years agosnapshot: populate new XML info for qemu snapshots
Eric Blake [Tue, 23 Oct 2012 15:12:25 +0000 (17:12 +0200)]
snapshot: populate new XML info for qemu snapshots

Now that the XML supports listing internal snapshots, it is worth
always populating the <memory> and <disks> element to match.

* src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Always
parse disk info and set memory info.

12 years agosnapshot: improve disk align checking
Eric Blake [Tue, 23 Oct 2012 15:12:24 +0000 (17:12 +0200)]
snapshot: improve disk align checking

There were not previous callers with require_match set to true.
I originally implemented this bool with the intent of supporting
ESX snapshot semantics, where the choice of internal vs. external
vs. non-checkpointable must be made at domain start, but as ESX
has not been wired up to use it yet, we might as well fix it to
work with our next qemu patch for now, and worry about any further
improvements (changing the bool to a flags argument) if the ESX
driver decides to use this function in the future.

* src/conf/snapshot_conf.c (virDomainSnapshotAlignDisks): Alter
logic when require_match is true to deal with new XML.

12 years agosnapshot: new XML for external system checkpoint
Eric Blake [Tue, 23 Oct 2012 15:12:23 +0000 (17:12 +0200)]
snapshot: new XML for external system checkpoint

Each <domainsnapshot> can now contain an optional <memory>
element that describes how the VM state was handled, similar
to disk snapshots.  The new element will always appear in
output; for back-compat, an input that lacks the element will
assume 'no' or 'internal' according to the domain state.

Along with this change, it is now possible to pass <disks> in
the XML for an offline snapshot; this also needs to be wired up
in a future patch, to make it possible to choose internal vs.
external on a per-disk basis for each disk in an offline domain.
At that point, using the --disk-only flag for an offline domain
will be able to work.

For some examples below, remember that qemu supports the
following snapshot actions:

qemu-img: offline external and internal disk
savevm: online internal VM and disk
migrate: online external VM
transaction: online external disk

=====
<domainsnapshot>
  <memory snapshot='no'/>
  ...
</domainsnapshot>

implies that there is no VM state saved (mandatory for
offline and disk-only snapshots, not possible otherwise);
using qemu-img for offline domains and transaction for online.

=====
<domainsnapshot>
  <memory snapshot='internal'/>
  ...
</domainsnapshot>

state is saved inside one of the disks (as in qemu's 'savevm'
system checkpoint implementation).  If needed in the future,
we can also add an attribute pointing out _which_ disk saved
the internal state; maybe disk='vda'.

=====
<domainsnapshot>
  <memory snapshot='external' file='/path/to/state'/>
  ...
</domainsnapshot>

This is not wired up yet, but future patches will allow this to
control a combination of 'virsh save /path/to/state' plus disk
snapshots from the same point in time.

=====

So for 1.0.1 (and later, as needed), I plan to implement this table
of combinations, with '*' designating new code and '+' designating
existing code reached through new combinations of xml and/or the
existing DISK_ONLY flag:

domain  memory  disk   disk-only | result
-----------------------------------------
offline omit    omit   any       | memory=no disk=int, via qemu-img
offline no      omit   any       |+memory=no disk=int, via qemu-img
offline omit/no no     any       | invalid combination (nothing to snapshot)
offline omit/no int    any       |+memory=no disk=int, via qemu-img
offline omit/no ext    any       |*memory=no disk=ext, via qemu-img
offline int/ext any    any       | invalid combination (no memory to save)
online  omit    omit   off       | memory=int disk=int, via savevm
online  omit    omit   on        | memory=no disk=default, via transaction
online  omit    no/ext off       | unsupported for now
online  omit    no     on        | invalid combination (nothing to snapshot)
online  omit    ext    on        | memory=no disk=ext, via transaction
online  omit    int    off       |+memory=int disk=int, via savevm
online  omit    int    on        | unsupported for now
online  no      omit   any       |+memory=no disk=default, via transaction
online  no      no     any       | invalid combination (nothing to snapshot)
online  no      int    any       | unsupported for now
online  no      ext    any       |+memory=no disk=ext, via transaction
online  int/ext any    on        | invalid combination (disk-only vs. memory)
online  int     omit   off       |+memory=int disk=int, via savevm
online  int     no/ext off       | unsupported for now
online  int     int    off       |+memory=int disk=int, via savevm
online  ext     omit   off       |*memory=ext disk=default, via migrate+trans
online  ext     no     off       |+memory=ext disk=no, via migrate
online  ext     int    off       | unsupported for now
online  ext     ext    off       |*memory=ext disk=ext, via migrate+transaction

* docs/schemas/domainsnapshot.rng (memory): New RNG element.
* docs/formatsnapshot.html.in: Document it.
* src/conf/snapshot_conf.h (virDomainSnapshotDef): New fields.
* src/conf/domain_conf.c (virDomainSnapshotDefFree)
(virDomainSnapshotDefParseString, virDomainSnapshotDefFormat):
Manage new fields.
* tests/domainsnapshotxml2xmltest.c: New test.
* tests/domainsnapshotxml2xmlin/*.xml: Update existing tests.
* tests/domainsnapshotxml2xmlout/*.xml: Likewise.

12 years agosnapshot: simplify OOM checking during parse
Eric Blake [Thu, 25 Oct 2012 22:26:41 +0000 (16:26 -0600)]
snapshot: simplify OOM checking during parse

* src/conf/snapshot_conf.c (virDomainSnapshotDefParseString):
Simplify OOM reporting.

12 years agoDocument bracket whitespace rules & add syntax-check rule
Daniel P. Berrange [Wed, 17 Oct 2012 09:25:35 +0000 (10:25 +0100)]
Document bracket whitespace rules & add syntax-check rule

This documents the following whitespace rules

      if(foo)   // Bad
      if (foo)  // Good

      int foo (int wizz)  // Bad
      int foo(int wizz)   // Good

      bar = foo (wizz);  // Bad
      bar = foo(wizz);   // Good

      typedef int (*foo) (int wizz);  // Bad
      typedef int (*foo)(int wizz);   // Good

      int foo( int wizz );  // Bad
      int foo(int wizz);    // Good

There is a syntax-check rule extension to validate all these rules.
Checking for 'function (...args...)' is quite difficult since it
needs to ignore valid usage with keywords like 'if (...test...)'
and while/for/switch. It must also ignore source comments and
quoted strings.

It is not possible todo this with a simple regex in the normal
syntax-check style. So a short Perl script is created instead
to analyse the source. In practice this works well enough. The
only thing it can't cope with is multi-line quoted strings of
the form

 "start of string\
more lines\
more line\
the end"

but this can and should be written as

 "start of string"
 "more lines"
 "more line"
 "the end"

with this simple change, the bracket checking script does not
have any false positives across libvirt source, provided it
is only run against .c files. It is not practical to run it
against .h files, since those use whitespace extensively to
get alignment (though this is somewhat inconsistent and could
arguably be fixed).

The only limitation is that it cannot detect a violation where
the first arg starts with a '*', eg

   foo(*wizz);

since this generates too many false positives on function
typedefs which can't be supressed efficiently.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove spurious whitespace between function name & open brackets
Daniel P. Berrange [Wed, 17 Oct 2012 09:23:12 +0000 (10:23 +0100)]
Remove spurious whitespace between function name & open brackets

The libvirt coding standard is to use 'function(...args...)'
instead of 'function (...args...)'. A non-trivial number of
places did not follow this rule and are fixed in this patch.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agonet: Mark network persistent when assigning persistent definition
Peter Krempa [Fri, 26 Oct 2012 12:37:26 +0000 (14:37 +0200)]
net: Mark network persistent when assigning persistent definition

When assigning the new persistent definition for a transient network
(thus making it persistent) the network needs to be marked persistent
before actually atempting to assign the definition.

12 years agonet: Add support for changing persistent networks to transient
Peter Krempa [Thu, 25 Oct 2012 14:32:29 +0000 (16:32 +0200)]
net: Add support for changing persistent networks to transient

Until now, the network undefine API was able to undefine only inactive
networks. The restriction doesn't make sense any more so this patch
implements changing networks to transient.

12 years agonet: Re-use checks when creating transient networks
Peter Krempa [Thu, 25 Oct 2012 14:27:07 +0000 (16:27 +0200)]
net: Re-use checks when creating transient networks

When a transient network was created some of the checks weren't run on
the definition allowing to start invalid networks.

This patch splits out code to the network validation function and
re-uses that code when creating transient networks.

12 years agonet: Remove dnsmasq and radvd files also when destroying transient nets
Peter Krempa [Thu, 25 Oct 2012 14:13:57 +0000 (16:13 +0200)]
net: Remove dnsmasq and radvd files also when destroying transient nets

The network driver didn't care about config files when a network was
destroyed, just when it was undefined leaving behind files for transient
networks.

This patch splits out the cleanup code to a helper function that handles
the cleanup if the inactive network object is being removed and re-uses
this code when getting rid of inactive networks.

12 years agonet: Move creation of dnsmasq hosts file to function starting dnsmasq
Peter Krempa [Thu, 25 Oct 2012 12:41:28 +0000 (14:41 +0200)]
net: Move creation of dnsmasq hosts file to function starting dnsmasq

The hosts file was created in the network definition function. This
patch moves the place the file is being created to the point where
dnsmasq is being started.

12 years agonet: Change argument type of virNetworkObjIsDuplicate()
Peter Krempa [Thu, 25 Oct 2012 12:19:59 +0000 (14:19 +0200)]
net: Change argument type of virNetworkObjIsDuplicate()

The argument check_active is used only as a boolean so this patch
changes the type and updates callers.

12 years agoconf: net: Fix deadlock if assignment of network def fails
Peter Krempa [Fri, 26 Oct 2012 12:33:13 +0000 (14:33 +0200)]
conf: net: Fix deadlock if assignment of network def fails

When the assignment fails, the network object is not unlocked and next
call that would use it deadlocks.

12 years agoconf: net: Fix helper for applying new network definition
Peter Krempa [Thu, 25 Oct 2012 15:06:04 +0000 (17:06 +0200)]
conf: net: Fix helper for applying new network definition

When there's no new definition the helper overwrote the old one with
NULL.

12 years agobuild: Do not ignore logging.c in sc_prohibit_mkstemp
Jiri Denemark [Fri, 2 Nov 2012 11:06:57 +0000 (12:06 +0100)]
build: Do not ignore logging.c in sc_prohibit_mkstemp

Now that the offending code was removed, we may remove this as well.

12 years agoRemove a chunk which should not have been pushed as part of 1.0.0
Daniel Veillard [Fri, 2 Nov 2012 11:23:13 +0000 (19:23 +0800)]
Remove a chunk which should not have been pushed as part of 1.0.0

I didn't noticed that that small old patch was still applied locally

12 years agologging.c: Properly indent and ignore one syntax-check rule
Michal Privoznik [Fri, 2 Nov 2012 10:07:54 +0000 (11:07 +0100)]
logging.c: Properly indent and ignore one syntax-check rule

With our fix of mkostemp (pushed as 2b435c15) we define a macro
to compile with uclibc. However, this definition is conditional
and thus needs to be properly indented. Moreover, with this definition
sc_prohibit_mkstemp syntax-check rule keeps yelling:

  src/util/logging.c:63:# define mkostemp(x,y) mkstemp(x)
  maint.mk: use mkostemp with O_CLOEXEC instead of mkstemp

Therefore we should ignore this file for this rule.

12 years agoqemu: use default machine type if missing it in qemu command line
Guannan Ren [Thu, 1 Nov 2012 11:43:03 +0000 (19:43 +0800)]
qemu: use default machine type if missing it in qemu command line

BZ:https://bugzilla.redhat.com/show_bug.cgi?id=871273
when using virsh qemu-attach to attach an existing qemu process,
if it misses the -M option in qemu command line, libvirtd crashed
because the NULL value of def->os.machine in later use.

Example:
/usr/libexec/qemu-kvm -name foo \
                      -cdrom /var/lib/libvirt/images/boot.img \
                      -monitor unix:/tmp/demo,server,nowait \

error: End of file while reading data: Input/output error
error: Failed to reconnect to the hypervisor

This patch tries to set default machine type if the value of
def->os.machine is still NULL after qemu command line parsing.

12 years agoRelease of libvirt-1.0.0
Daniel Veillard [Fri, 2 Nov 2012 04:08:11 +0000 (12:08 +0800)]
Release of libvirt-1.0.0

* configure.ac docs/news.html.in libvirt.spec.in: update for the new release
* po/*.po*: update from transifex, a lot of added support e.g. Indian
  languages, and regenerate

12 years agocpumap: optimize for clients that don't need online count
Eric Blake [Thu, 1 Nov 2012 23:55:43 +0000 (17:55 -0600)]
cpumap: optimize for clients that don't need online count

It turns out that calling virNodeGetCPUMap(conn, NULL, NULL, 0)
is both useful, and with Viktor's patches, common enough to
optimize.  Since this interface hasn't been released yet, we
can change the RPC call.

A bit more background on the optimization - learning the cpu count
is a single file read (/sys/devices/system/cpu/possible), but
learning the number of online cpus can possibly trigger a file
read per cpu, depending on the age of the kernel, and all wasted
if the caller passed NULL for both arguments.

* src/nodeinfo.c (nodeGetCPUMap): Avoid bitmap when not needed.
* src/remote/remote_protocol.x (remote_node_get_cpu_map_args):
Supply two separate flags for needed arguments.
* src/remote/remote_driver.c (remoteNodeGetCPUMap): Update
caller.
* daemon/remote.c (remoteDispatchNodeGetCPUMap): Likewise.
* src/remote_protocol-structs: Regenerate.

12 years agoqemu: QMP capabilities support starts with 1.2
Doug Goldstein [Thu, 1 Nov 2012 22:15:35 +0000 (17:15 -0500)]
qemu: QMP capabilities support starts with 1.2

Per the code comment in qemuCapsInitQMPBasic() and commit 43e23c7, we
should only use QMP for capabilities probing starting with 1.2 and
newer.  The old code had dead logic that probed on 1.0 and newer.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoLinux Containers are not allowed to create device nodes.
Dan Walsh [Thu, 1 Nov 2012 18:54:39 +0000 (14:54 -0400)]
Linux Containers are not allowed to create device nodes.

This needs to be done before the container starts. Turning
off the mknod capability is noticed by systemd, which will
no longer attempt to create device nodes.

This eliminates SELinux AVC messages and ugly failure messages in the journal.

12 years agoqemu: Fix name comparison in qemuMonitorJSONBlockIoThrottleInfo()
Stefan Hajnoczi [Thu, 1 Nov 2012 17:20:56 +0000 (18:20 +0100)]
qemu: Fix name comparison in qemuMonitorJSONBlockIoThrottleInfo()

The string comparison logic was inverted and matched the first drive
that does *not* have the name we search for.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agoqemu: Keep QEMU host drive prefix in BlkIoTune
Stefan Hajnoczi [Thu, 1 Nov 2012 17:20:55 +0000 (18:20 +0100)]
qemu: Keep QEMU host drive prefix in BlkIoTune

The QEMU -drive id= begins with libvirt's QEMU host drive prefix
("drive-"), which is stripped off in several places two convert between
host ("-drive") and guest ("-device") device names.

In the case of BlkIoTune it is unnecessary to strip the QEMU host drive
prefix because we operate on "info block"/"query-block" output that uses
host drive names.

Stripping the prefix incorrectly caused string comparisons to fail since
we were comparing the guest device name against the host device name.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agonet-update docs: s/domain/network/
Michal Privoznik [Thu, 1 Nov 2012 14:51:28 +0000 (15:51 +0100)]
net-update docs: s/domain/network/

A leftover from copy paste.

12 years agoiohelper: fdatasync() at the end
Michal Privoznik [Tue, 30 Oct 2012 18:15:48 +0000 (19:15 +0100)]
iohelper: fdatasync() at the end

Currently, when we are doing (managed) save, we insert the
iohelper between the qemu and OS. The pipe is created, the
writing end is passed to qemu and the reading end to the
iohelper. It reads data and write them into given file. However,
with write() being asynchronous data may still be in OS
caches and hence in some (corner) cases, all migration data
may have been read and written (not physically though). So
qemu will report success, as well as iohelper. However, with
some non local filesystems, where ENOSPACE is polled every X
time units, we may get into situation where all operations
succeeded but data hasn't reached the disk. And in fact will
never do. Therefore we ought sync caches to make sure data
has reached the block device on remote host.

12 years agodaemon: Make the default PolicyKit policy auth_admin_keep.
Richard W.M. Jones [Mon, 15 Oct 2012 08:01:13 +0000 (09:01 +0100)]
daemon: Make the default PolicyKit policy auth_admin_keep.

12 years agoconf: Fix private symbols exported by files in conf
Peter Krempa [Fri, 19 Oct 2012 09:52:54 +0000 (11:52 +0200)]
conf: Fix private symbols exported by files in conf

Some of the functions were moved to other files but the private symbol
file wasn't tweaked to reflect that.

12 years agoFix arch detection for qemu-system-i386 with QMP
Daniel P. Berrange [Wed, 31 Oct 2012 16:49:13 +0000 (16:49 +0000)]
Fix arch detection for qemu-system-i386 with QMP

QEMU uses 'i386' for its 32-bit x86 architecture, but libvirt
wants that to be 'i686', so we must fix it up

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDon't assume pid_t is the same size as an int
Daniel P. Berrange [Wed, 31 Oct 2012 17:00:50 +0000 (17:00 +0000)]
Don't assume pid_t is the same size as an int

virPidFileReadPathIfAlive passed in an 'int *' where a 'pid_t *'
was expected, which breaks on Mingw64 targets. Also a few places
were using '%d' for formatting pid_t, change them to '%lld' and
force a cast to the longer type as done elsewhere in the same
file.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agobuild: Fix RPM build for non-x86 platforms
Viktor Mihajlovski [Wed, 31 Oct 2012 21:21:06 +0000 (22:21 +0100)]
build: Fix RPM build for non-x86 platforms

Make the post install script for the lock-sanlock package optional
to prevent break on non-x86 platforms.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agodocs: libvirtd no longer uses abstract namespace
Eric Blake [Wed, 31 Oct 2012 15:46:36 +0000 (09:46 -0600)]
docs: libvirtd no longer uses abstract namespace

Commit 905be03d2 quit using the abstract namespace, but didn't
update the --help text to match.

* daemon/libvirtd.c (daemonUsage): Correct socket listing.

12 years agobuild: prefer mkostemp for multi-thread safety
Eric Blake [Wed, 31 Oct 2012 14:13:47 +0000 (08:13 -0600)]
build: prefer mkostemp for multi-thread safety

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

Commit cd1e8d1 assumed that systems new enough to have journald
also have mkostemp; but this is not true for uclibc.

For that matter, use of mkstemp[s] is unsafe in a multi-threaded
program.  We should prefer mkostemp[s] in the first place.

* bootstrap.conf (gnulib_modules): Add mkostemp, mkostemps; drop
mkstemp and mkstemps.
* cfg.mk (sc_prohibit_mkstemp): New syntax check.
* tools/virsh.c (vshEditWriteToTempFile): Adjust caller.
* src/qemu/qemu_driver.c (qemuDomainScreenshot)
(qemudDomainMemoryPeek): Likewise.
* src/secret/secret_driver.c (replaceFile): Likewise.
* src/vbox/vbox_tmpl.c (vboxDomainScreenshot): Likewise.

12 years agogitignore: Ignore 'tags'
Michal Privoznik [Wed, 31 Oct 2012 15:47:34 +0000 (16:47 +0100)]
gitignore: Ignore 'tags'

12 years agoqemu: Fix EmulatorPinInfo without emulatorpin
Martin Kletzander [Wed, 31 Oct 2012 14:49:08 +0000 (15:49 +0100)]
qemu: Fix EmulatorPinInfo without emulatorpin

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

Recent fixes made almost all the right steps to make emulator pinned
to the cpuset of the whole domain in case <emulatorpin> isn't
specified, but qemudDomainGetEmulatorPinInfo still reports all the
CPUs even when cpuset is specified.  This patch fixes that.

12 years agoutil: Improve error reporting from absolutePathFromBaseFile helper
Peter Krempa [Wed, 31 Oct 2012 10:17:41 +0000 (11:17 +0100)]
util: Improve error reporting from absolutePathFromBaseFile helper

There are multiple reasons canonicalize_file_name() used in
absolutePathFromBaseFile helper can fail. This patch enhances error
reporting from that helper.

12 years agoMake non-KVM machines work with QMP probing
Martin Kletzander [Wed, 31 Oct 2012 07:31:49 +0000 (08:31 +0100)]
Make non-KVM machines work with QMP probing

When there is no 'qemu-kvm' binary and the emulator used for a machine
is, for example, 'qemu-system-x86_64' that, by default, runs without
kvm enabled, libvirt still supplies '-no-kvm' option to this process,
even though it does not recognize such option (making the start of a
domain fail in that case).

This patch fixes building a command-line for QEMU machines without KVM
acceleration and is based on following assumptions:

 - QEMU_CAPS_KVM flag means that QEMU is running KVM accelerated
   machines by default (without explicitly requesting that using a
   command-line option).  It is the closest to the truth according to
   the code with the only exception being the comment next to the
   flag, so it's fixed in this patch as well.

 - QEMU_CAPS_ENABLE_KVM flag means that QEMU is, by default, running
   without KVM acceleration and in case we need KVM acceleration it
   needs to be explicitly instructed to do so.  This is partially
   true for the past (this option essentially means that QEMU
   recognizes the '-enable-kvm' option, even though it's almost the
   same).

12 years agobugfix: ip6tables rule removal
Gene Czarcinski [Tue, 30 Oct 2012 21:18:34 +0000 (17:18 -0400)]
bugfix: ip6tables rule removal

Three FORWARD chain rules are added and two INPUT chain rules
are added when a network is started but only the FORWARD chain
rules are removed when the network is destroyed.

12 years agomaint: log xml during volume creation
Eric Blake [Tue, 30 Oct 2012 20:53:56 +0000 (14:53 -0600)]
maint: log xml during volume creation

I noticed this while answering a list question about Java bindings
of volume creation.  All other functions that take xml logged xmlDesc.

* src/libvirt.c (virStorageVolCreateXML)
(virStorageVolCreateXMLFrom): Use consistent spelling of xmlDesc,
and log the argument.