]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
13 years agoqemu: Check for ejected media during startup and migration
Michal Privoznik [Tue, 13 Sep 2011 13:49:50 +0000 (15:49 +0200)]
qemu: Check for ejected media during startup and migration

If the daemon is restarted so we reconnect to monitor, cdrom media
can be ejected. In that case we don't want to show it in domain xml,
or require it on migration destination.

To check for disk status use 'info block' monitor command.

13 years agoqemu: add return value check
Alex Jia [Wed, 28 Sep 2011 08:00:49 +0000 (16:00 +0800)]
qemu: add return value check

* src/qemu/qemu_migration.c: if 'vmdef' is NULL, the function
  virDomainSaveConfig still dereferences it, it doesn't make
  sense, so should add return value check to make sure 'vmdef'
  is non-NULL before calling virDomainSaveConfig, in addition,
  in order to debug later, also should record error information
  into log.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agosnapshot: implement getparent in qemu
Eric Blake [Sun, 25 Sep 2011 00:02:24 +0000 (18:02 -0600)]
snapshot: implement getparent in qemu

First hypervisor implementation of the new API.
Allows 'virsh snapshot-list --tree' to be more efficient.

* src/qemu/qemu_driver.c (qemuDomainSnapshotGetParent): New
function.

13 years agosnapshot: add virsh snapshot-list --tree
Eric Blake [Sat, 24 Sep 2011 23:42:50 +0000 (17:42 -0600)]
snapshot: add virsh snapshot-list --tree

Reuse the tree listing of nodedev-list, coupled with the new helper
function to efficiently grab snapshot parent names, to produce
tree output for a snapshot hierarchy.  For example:

$ virsh snapshot-list dom --tree
root1
 |
  +- sibling1
  +- sibling2
  |   |
  |   +- grandchild
  |
  +- sibling3

root2
 |
  +- child

* tools/virsh.c (cmdSnapshotList): Add --tree.
* tools/virsh.pod (snapshot-list): Document it.

13 years agosnapshot: refactor virsh snapshot parent computation
Eric Blake [Wed, 10 Aug 2011 23:31:04 +0000 (17:31 -0600)]
snapshot: refactor virsh snapshot parent computation

Make parent computation reusable, using virDomainSnapshotGetParent
when possible.

* tools/virsh.c (vshGetSnapshotParent): New helper.
(cmdSnapshotParent): Use it.

13 years agosnapshot: remote protocol for getparent
Eric Blake [Sat, 24 Sep 2011 19:19:35 +0000 (13:19 -0600)]
snapshot: remote protocol for getparent

Mostly straight-forward, although this is the first API that
returns a new snapshot based on a snapshot rather than a domain.

* src/remote/remote_protocol.x
(REMOTE_PROC_DOMAIN_SNAPSHOT_GET_PARENT): New rpc.
(remote_domain_snapshot_get_parent_args)
(remote_domain_snapshot_get_parent_ret): New structs.
* src/rpc/gendispatch.pl: Adjust generator.
* src/remote/remote_driver.c (remote_driver): Use it.
* src/remote_protocol-structs: Update.

13 years agosnapshot: new virDomainSnapshotGetParent API
Eric Blake [Fri, 23 Sep 2011 18:38:04 +0000 (12:38 -0600)]
snapshot: new virDomainSnapshotGetParent API

Although a client can already obtain a snapshot's parent by
dumping and parsing the xml, then doing a snapshot lookup by
name, it is more efficient to get the parent in one step, which
in turn will make operations that must traverse a snapshot
hierarchy easier to perform.

* include/libvirt/libvirt.h.in (virDomainSnapshotGetParent):
Declare.
* src/libvirt.c (virDomainSnapshotGetParent): New function.
* src/libvirt_public.syms: Export it.
* src/driver.h (virDrvDomainSnapshotGetParent): New callback.

13 years agodocs: document node device XML
Eric Blake [Tue, 27 Sep 2011 17:04:52 +0000 (11:04 -0600)]
docs: document node device XML

Coupled with the recent virsh nodedev-* doc patch, this should now
give a better picture of libvirt node device handling.

* docs/formatnode.html.in: Fill in page.

13 years agodocs: document virsh nodedev-* commands
Eric Blake [Fri, 23 Sep 2011 23:26:24 +0000 (17:26 -0600)]
docs: document virsh nodedev-* commands

This section of the man page was completely missing; I stumbled on
it when I had no clue that I had to use nodedev-reattach after
I was done playing with <hostdev> device passthrough to one of my
guests.

* tools/virsh.pod (NODEDEV COMMANDS): New section.
(attach-device, detach-device): Add cross-references.

13 years agosecurity: properly chown/label bidirectional and unidirectional fifos
Laine Stump [Tue, 27 Sep 2011 18:04:53 +0000 (14:04 -0400)]
security: properly chown/label bidirectional and unidirectional fifos

This patch fixes the regression with using named pipes for qemu serial
devices noted in:

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

The problem was that, while new code in libvirt looks for a single
bidirectional fifo of the name given in the config, then relabels that
and continues without looking for / relabelling the two unidirectional
fifos named ${name}.in and ${name}.out, qemu looks in the opposite
order. So if the user had naively created all three fifos, libvirt
would relabel the bidirectional fifo to allow qemu access, but qemu
would attempt to use the two unidirectional fifos and fail (because it
didn't have proper permissions/rights).

This patch changes the order that libvirt looks for the fifos to match
what qemu does - first it looks for the dual fifos, then it looks for
the single bidirectional fifo. If it finds the dual unidirectional
fifos first, it labels/chowns them and ignores any possible
bidirectional fifo.

(Note commit d37c6a3a (which first appeared in libvirt-0.9.2) added
the code that checked for a bidirectional fifo. Prior to that commit,
bidirectional fifos for serial devices didn't work because libvirt
always required the ${name}.(in|out) fifos to exist, and qemu would
always prefer those.

13 years agoqemu: Preserve fakeReboot flag in domain status
Jiri Denemark [Wed, 28 Sep 2011 10:10:13 +0000 (12:10 +0200)]
qemu: Preserve fakeReboot flag in domain status

Thus, when libvirtd is restarted, it will know if a domain is supposed
to be killed or reset when it shuts down.

13 years agoqemu: Finish domain shutdown on reconnect
Jiri Denemark [Tue, 27 Sep 2011 12:56:17 +0000 (14:56 +0200)]
qemu: Finish domain shutdown on reconnect

If a domain started with -no-shutdown shuts down while libvirtd is not
running, it will be seen as paused when libvirtd reconnects to it. Use
the paused reason to detect if a domain was stopped because of shutdown
and finish the process just as if a SHUTDOWN event is delivered from
qemu.

13 years agoqemu: Check domain status details when reconnecting monitor
Jiri Denemark [Tue, 27 Sep 2011 09:42:04 +0000 (11:42 +0200)]
qemu: Check domain status details when reconnecting monitor

Current qemu is able to give us detailed domain status (not just if it
is running or not) which we can translate into a status reason.

13 years agoqemu: Always remove domain object if MigratePrepare fails
Jiri Denemark [Mon, 26 Sep 2011 11:36:37 +0000 (13:36 +0200)]
qemu: Always remove domain object if MigratePrepare fails

If migration failed in Prepare phase after virDomainAssignDef and before
a job was started, the domain object was not properly removed.

13 years agofix AppArmor driver for pipe character devices
Jamie Strandboge [Wed, 28 Sep 2011 07:43:39 +0000 (15:43 +0800)]
fix AppArmor driver for pipe character devices

The AppArmor security driver adds only the path specified in the domain
XML for character devices of type 'pipe'. It should be using <path>.in
and <path>.out. We do this by creating a new vah_add_file_chardev() and
use it for char devices instead of vah_add_file(). Also adjust
valid_path() to accept S_FIFO (since qemu chardevs of type 'pipe' use
fifos). This is https://launchpad.net/bugs/832507

13 years agovirsh: Allow using complete <capabilities> elements with cpu-baseline
Peter Krempa [Thu, 15 Sep 2011 11:51:01 +0000 (13:51 +0200)]
virsh: Allow using complete <capabilities> elements with cpu-baseline

This patch cleans the cpu baseline function using new libvirt helper
functions and fixes XPath expression that selects <cpu> elements from
the source file, that can contain concatenated <capabilities> XMLs,
domain XMLs and bare <cpu> elements. The fixed XPath expression ensures
not to select NUMA <cpu id=... elements.

This patch also removes vshRealloc function, that remained unused after
cleaning up cpu-baseline.

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

13 years agovirsh: Allow using domain and capabilities XMLs with cpu-compare
Peter Krempa [Thu, 15 Sep 2011 07:18:04 +0000 (09:18 +0200)]
virsh: Allow using domain and capabilities XMLs with cpu-compare

This patch adds extraction of the <cpu> element from capabilities and
domain definition XML documents to improve user experience.

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

13 years agosnapshot: fix man page typos
Eric Blake [Tue, 27 Sep 2011 23:33:55 +0000 (17:33 -0600)]
snapshot: fix man page typos

pod2man from perl-5.8.8 (RHEL 5) errors out on ill-formed POD:

*** ERROR: unterminated I<...> at line 1114 in file virsh.pod
*** ERROR: unterminated I<...> at line 1851 in file virsh.pod

Newer pod2man appears to be more tolerant (which is a shame,
because it meant that this error is harder to detect).

* tools/virsh.pod (undefine, snapshot-current): Add missing >.

13 years agoqemu: add ability to set PCI device "rombar" on or off
Laine Stump [Tue, 20 Sep 2011 17:31:52 +0000 (13:31 -0400)]
qemu: add ability to set PCI device "rombar" on or off

This patch was made in response to:

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

In short, qemu's default for the rombar setting (which makes the
firmware ROM of a PCI device visible/not on the guest) was previously
0 (not visible), but they recently changed the default to 1
(visible). Unfortunately, there are some PCI devices that fail in the
guest when rombar is 1, so the setting must be exposed in libvirt to
prevent a regression in behavior (it will still require explicitly
setting <rom bar='off'/> in the guest XML).

rombar is forced on/off by adding:

  <rom bar='on|off'/>

inside a <hostdev> element that defines a PCI device. It is currently
ignored for all other types of devices.

At the moment there is no clean method to determine whether or not the
rombar option is supported by QEMU - this patch uses the advice of a
QEMU developer to assume support for qemu-0.12+. There is currently a
patch in the works to put this information in the output of "qemu-kvm
-device pci-assign,?", but of course if we switch to keying off that,
we would lose support for setting rombar on all the versions of qemu
between 0.12 and whatever version gets that patch.

13 years agospec: F15 still uses cgconfig, RHEL lacks hyperv
Eric Blake [Mon, 26 Sep 2011 20:28:47 +0000 (14:28 -0600)]
spec: F15 still uses cgconfig, RHEL lacks hyperv

Commit ecd8725c dropped attempts to probe the cgconfig service on
new enough Fedora where systemd took over that aspect of the system,
but mistakenly used F14 instead of F15 as the cutoff point.

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

Also, RHEL does not include HyperV support yet.

* libvirt.spec.in (with_cgconfig): Check cgconfig service in F15.
(%{?rhel}): Provide default for with_hyperv.

13 years agoqemu: Relax -no-shutdown check to [0.14.0, 0.15.50)
Jiri Denemark [Tue, 27 Sep 2011 12:46:35 +0000 (14:46 +0200)]
qemu: Relax -no-shutdown check to [0.14.0, 0.15.50)

SIGTERM handling for -no-shutdown is already fixed in qemu git and
libvirt can safely use it. The downside is that 0.15.50 version of qemu
can be any qemu compiled from git, even that without the fix for
SIGTERM. However, I think this patch is worth it since excluding 0.15.50
from the check makes testing current qemu with libvirt much easier and
someone running qemu from git should be able to rebuild fixed qemu from
git if they hit the problem with a hang on shutdown.

13 years agovirsh: Better document --copy-storage migrate options
Jiri Denemark [Mon, 26 Sep 2011 13:09:08 +0000 (15:09 +0200)]
virsh: Better document --copy-storage migrate options

Both --copy-storage-{all,inc} options require disk images to be present
on destination host.

13 years agovirsh: Enhance documentation of commands starting jobs
Jiri Denemark [Mon, 26 Sep 2011 12:55:22 +0000 (14:55 +0200)]
virsh: Enhance documentation of commands starting jobs

Some virsh commands start a (long-running) job that can be monitored
using domjobinfo and aborted with domjobabort. Let's be explicit about
this in virsh man page.

13 years agovirLockManagerNopInit: Rename flags to unused_flags
Michal Privoznik [Tue, 27 Sep 2011 09:11:14 +0000 (11:11 +0200)]
virLockManagerNopInit: Rename flags to unused_flags

As these might be not used and make syntax-check complains about checking
them via virCheckFlags.

13 years agodaemon: Don't remove pidfiles in init scripts
Peter Krempa [Mon, 26 Sep 2011 18:06:39 +0000 (20:06 +0200)]
daemon: Don't remove pidfiles in init scripts

Init scripts removed pid file of the daemon. Removing pid files may be
harmful as new api for crash-safe pidfiles is used (introduced by
c8a3a26).

13 years agodebug: Annotate some variables as unused
Michal Privoznik [Mon, 26 Sep 2011 16:51:47 +0000 (18:51 +0200)]
debug: Annotate some variables as unused

as they are not used with debugging turned off.

13 years agostorage: Do not break the whole vol lookup process in the middle
Osier Yang [Mon, 26 Sep 2011 06:30:44 +0000 (14:30 +0800)]
storage: Do not break the whole vol lookup process in the middle

* src/storage/storage_driver.c: As virStorageVolLookupByPath lookups
all the pool objs of the drivers, breaking when failing on getting
the stable path of the pool will just breaks the whole lookup process,
it can cause the API fails even if the vol exists indeed. It won't get
any benefit. This patch is to fix it.

13 years agomaint: update authors
Peter Krempa [Fri, 23 Sep 2011 17:15:37 +0000 (19:15 +0200)]
maint: update authors

13 years agoAdd unsafe cache mode support for disk driver
Oskari Saarenmaa [Thu, 22 Sep 2011 19:33:47 +0000 (22:33 +0300)]
Add unsafe cache mode support for disk driver

QEMU 0.13 introduced cache=unsafe for -drive, this patch exposes
it in the libvirt layer.

  * Introduced a new QEMU capability flag ($prefix_CACHE_UNSAFE),
    as even if $prefix_CACHE_V2 is set, we can't know if unsafe
    is supported.

  * Improved the reliability of qemu cache type detection.

13 years agoFix synchronous reading of stream data
Daniel P. Berrange [Wed, 21 Sep 2011 13:51:33 +0000 (14:51 +0100)]
Fix synchronous reading of stream data

commit 984840a2c292402926ad100aeea33f8859ff31a9 removed the
notification of waiting calls when VIR_NET_CONTINUE messages
arrive. This was to fix the case of a virStreamAbort() call
being prematurely notified of completion.

The problem is that sometimes there are dummy calls from a
virStreamRecv() call waiting that *do* need to be notified.

These dummy calls should have a status VIR_NET_CONTINUE. So
re-add the notification upon VIR_NET_CONTINUE, but only if
the waiter also has a status of VIR_NET_CONTINUE.

* src/rpc/virnetclient.c: Notify waiting call if stream data
  arrives
* src/rpc/virnetclientstream.c:  Mark dummy stream read packet
  with status VIR_NET_CONTINUE

13 years agoselinux: Correctly report warning if virt_use_nfs not set
Michal Privoznik [Thu, 22 Sep 2011 08:57:24 +0000 (10:57 +0200)]
selinux: Correctly report warning if virt_use_nfs not set

Previous patch c9b37fee tried to deal with virt_use_nfs. But
setfilecon() returns EOPNOTSUPP on NFS so we need to move the
warning to else branch.

13 years agovirsh: Improve virsh manual for virsh memtune command
Peter Krempa [Thu, 22 Sep 2011 10:14:18 +0000 (12:14 +0200)]
virsh: Improve virsh manual for virsh memtune command

Commit 0a22f54 added --min-guarantee option for the memtune command.
This option is supported only by the ESX hypervisor. This patch adds a
statement about this fact, to prevent user confusion.

This patch also adds explanation how to clear/set to unlimited the
memory tunables. (documments the -1 value).

13 years agovirsh: Do not ignore the specified flags for cmdSaveImageDefine
Osier Yang [Thu, 22 Sep 2011 12:01:06 +0000 (20:01 +0800)]
virsh: Do not ignore the specified flags for cmdSaveImageDefine

Introduced by commit 42c52d53c, which added the support for new
flags, but forgot to update the API use to pass the flags.

13 years agoqemu: Transfer inactive XML among cookie
Michal Privoznik [Thu, 15 Sep 2011 13:13:11 +0000 (15:13 +0200)]
qemu: Transfer inactive XML among cookie

If a domain has inactive XML we want to transfer it to destination
when migrating with VIR_MIGRATE_PERSIST_DEST. In order to harm
the migration protocol as least as possible, a optional cookie was
chosen.

13 years agoRelease of libvirt-0.9.6
Daniel Veillard [Thu, 22 Sep 2011 06:53:23 +0000 (14:53 +0800)]
Release of libvirt-0.9.6

13 years agosnapshot: also delete empty directory
Eric Blake [Wed, 21 Sep 2011 22:08:42 +0000 (16:08 -0600)]
snapshot: also delete empty directory

The previous patch removed all snapshots, but not the directory
where the snapshots lived, which is still a form of stale data.

* src/qemu/qemu_domain.c (qemuDomainRemoveInactive): Wipe any
snapshot directory.

13 years agosnapshot: remove snapshot metadata on transient exit
Eric Blake [Thu, 22 Sep 2011 06:02:03 +0000 (14:02 +0800)]
snapshot: remove snapshot metadata on transient exit

Commit 282fe1f0 documented that transient domains will auto-delete
any snapshot metadata when the last reference to the domain is
removed, and that management apps are in charge of grabbing any
snapshot metadata prior to that point.  However, this was not
actually implemented for qemu until now.

* src/qemu/qemu_driver.c (qemudDomainCreate)
(qemuDomainDestroyFlags, qemuDomainSaveInternal)
(qemudDomainCoreDump, qemuDomainRestoreFlags, qemudDomainDefine)
(qemuDomainUndefineFlags, qemuDomainMigrateConfirm3)
(qemuDomainRevertToSnapshot): Clean up snapshot metadata.
* src/qemu/qemu_migration.c (qemuMigrationPrepareAny)
(qemuMigrationPerformJob, qemuMigrationPerformPhase)
(qemuMigrationFinish): Likewise.
* src/qemu/qemu_process.c (qemuProcessHandleMonitorEOF)
(qemuProcessReconnect, qemuProcessReconnectHelper)
(qemuProcessAutoDestroyDom): Likewise.

13 years agosnapshot: prepare to remove transient snapshot metadata
Eric Blake [Wed, 21 Sep 2011 19:08:51 +0000 (13:08 -0600)]
snapshot: prepare to remove transient snapshot metadata

This patch is mostly code motion - moving some functions out
of qemu_driver and into qemu_domain so they can be reused by
multiple qemu_* files (since qemu_driver.h must not grow).
It also adds a new helper function, qemuDomainRemoveInactive,
which will be used in the next patch.

* src/qemu/qemu_domain.h (qemuFindQemuImgBinary)
(qemuDomainSnapshotWriteMetadata, qemuDomainSnapshotForEachQcow2)
(qemuDomainSnapshotDiscard, qemuDomainSnapshotDiscardAll)
(qemuDomainRemoveInactive): New prototypes.
(struct qemu_snap_remove): New struct.
* src/qemu/qemu_domain.c (qemuDomainRemoveInactive)
(qemuDomainSnapshotDiscardAllMetadata): New functions.
(qemuFindQemuImgBinary, qemuDomainSnapshotWriteMetadata)
(qemuDomainSnapshotForEachQcow2, qemuDomainSnapshotDiscard)
(qemuDomainSnapshotDiscardAll): Move here...
* src/qemu/qemu_driver.c (qemuFindQemuImgBinary)
(qemuDomainSnapshotWriteMetadata, qemuDomainSnapshotForEachQcow2)
(qemuDomainSnapshotDiscard, qemuDomainSnapshotDiscardAll): ...from
here.
(qemuDomainUndefineFlags): Update caller.
* src/conf/domain_conf.c (virDomainRemoveInactive): Doc fixes.

13 years agosnapshot: fix logic bug in qemu undefine
Eric Blake [Wed, 21 Sep 2011 19:08:50 +0000 (13:08 -0600)]
snapshot: fix logic bug in qemu undefine

Commit 19f8c98 introduced VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA,
with the intent that omitting the flag makes undefine fail, and
including the flag deletes metadata.  But it used the wrong logic.
Also, hoist the transient domain sooner, so that we don't
accidentally remove metadata of a transient domain.

* src/qemu/qemu_driver.c (qemuDomainUndefineFlags): Check correct
flag value.

13 years agosanlock: fix memory leak
Eric Blake [Wed, 21 Sep 2011 20:22:57 +0000 (14:22 -0600)]
sanlock: fix memory leak

Detected by Coverity.  The only way to get to error_unlink is if
path was successfully assigned, so the if was useless.  Meanwhile,
there was a return statement that did not free path.

* src/locking/lock_driver_sanlock.c
(virLockManagerSanlockSetupLockspace): Fix mem-leak, and drop
useless if.

13 years agovirsh: fix regression in argv parsing
Eric Blake [Wed, 21 Sep 2011 14:54:47 +0000 (08:54 -0600)]
virsh: fix regression in argv parsing

Prior to commit 85d2810, we had an issue where:

snapshot-create-as dom name --diskspec spec --diskspec spec

failed to parse the second spec, because the first spec had marked
that option as no longer requiring an argument.

In commit 85d2810, I fixed it by making argv options no longer mark
the option as seen.  But this in turn breaks mandatory argv options,
which now complain that the argv option is missing.

This patch reverts that part of 85d2810, and instead replaces it with
fixes to no longer clear opts_need_arg of an argv argument.

* tools/virsh.c (vshCmddefGetOption, vshCmddefGetData)
(vshCommandParse): Fix option parsing for required argv option.
(vshCmddefOptParse): Check that argv option is last.
* tests/virsh-optparse: Enhance test.

13 years agovirsh: More friendly err if no pool is specified for looking up a vol
Osier Yang [Wed, 21 Sep 2011 06:29:49 +0000 (14:29 +0800)]
virsh: More friendly err if no pool is specified for looking up a vol

There are 3 ways to lookup a volume, only virStorageVolLookupByName
needs pool object. So if no --pool is specified, it will tries to
get the volume via virStorageVolLookupByPath/virStorageVolLookupByKey.

But if all 3 ways fails, and no --pool is specified, a friendly
error might help the user get right way quickly.

13 years agostorage: Wait udev events are handled before removing lvm vol
Osier Yang [Wed, 21 Sep 2011 06:02:30 +0000 (14:02 +0800)]
storage: Wait udev events are handled before removing lvm vol

Related #BZ: https://bugzilla.redhat.com/show_bug.cgi?id=702260.

There are two problems described in the BZ:
1) "Can't remove open logical volume".
2) "Unable to deactivate logical volume "foo""

This patch just intends to fix 2), as 1) is expected if the vol
is still used by something, and you never known if "lvchange -an"
will fail or not either (sometime, it will succeed, sometimes not).
We'd better not look for trouble, :-)

For 2), that's caused by race between lvremove and udev event handling,
the only workable way now is to wait the events handling are finished,
though it might introduce latencies, as "udevadmin settle" exits
after *all* events are handled, it's the only way we can fix
the racing in libvirt layer.

See https://bugzilla.redhat.com/show_bug.cgi?id=570359 for more
details.

13 years agoqemu: avoid dereferencing a NULL pointer
Alex Jia [Wed, 21 Sep 2011 19:02:44 +0000 (03:02 +0800)]
qemu: avoid dereferencing a NULL pointer

* src/qemu/qemu_process.c: Taking if (qemuDomainObjEndJob(driver, obj) == 0)
  true branch then 'obj' is NULL, virDomainObjIsActive(obj) and
  virDomainObjUnref(obj) will dereference NULL pointer.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agotests: improve test failure diagnosis
Oskari Saarenmaa [Wed, 21 Sep 2011 16:29:31 +0000 (19:29 +0300)]
tests: improve test failure diagnosis

  * qemuhelptest prints test case name on failure.

13 years agoqemu: Avoid loop of fake reboots
Jiri Denemark [Wed, 21 Sep 2011 14:03:22 +0000 (16:03 +0200)]
qemu: Avoid loop of fake reboots

Once virDomainReboot is called for a domain, guest OS initiated shutdown
would always result in reboot instead of shutdown. Only
virDomainShutdown would actually shutd such domain down. That's because
we forgot to reset fakeReboot flag once we asked the domain to reboot.

13 years agoqemu: Fix shutdown regression with buggy qemu
Jiri Denemark [Wed, 21 Sep 2011 08:25:29 +0000 (10:25 +0200)]
qemu: Fix shutdown regression with buggy qemu

The commit that prevents disk corruption on domain shutdown
(96fc4784177ecb70357518fa863442455e45ad0e) causes regression with QEMU
0.14.* and 0.15.* because of a regression bug in QEMU that was fixed
only recently in QEMU git. The affected versions of QEMU do not quit on
SIGTERM if started with -no-shutdown, which we use to implement fake
reboot. Since -no-shutdown tells QEMU not to quit automatically on guest
shutdown, domains started using the affected QEMU cannot be shutdown
properly and stay in a paused state.

This patch disables fake reboot feature on such QEMU by not using
-no-shutdown, which makes shutdown work as expected. However,
virDomainReboot will not work in this case and it will report "Requested
operation is not valid: Reboot is not supported with this QEMU binary".

13 years agoAPI: prefer to use NULLSTR macro
Osier Yang [Wed, 21 Sep 2011 09:03:43 +0000 (17:03 +0800)]
API: prefer to use NULLSTR macro

13 years agoremote: fix crash on OOM
Eric Blake [Tue, 20 Sep 2011 18:11:32 +0000 (12:11 -0600)]
remote: fix crash on OOM

Bug introduced in commit 675464b.  On an OOM, this would try to
dereference a char* and free the contents as a pointer, which is
doomed to failure.

Adding a syntax check will prevent mistakes like this in the future.

* cfg.mk (sc_prohibit_internal_functions): New syntax check.
(exclude_file_name_regexp--sc_prohibit_internal_functions): Add
exemptions.
* daemon/remote.c (remoteRelayDomainEventIOError)
(remoteRelayDomainEventIOErrorReason)
(remoteRelayDomainEventGraphics, remoteRelayDomainEventBlockJob):
Use correct free function.

13 years agoxen: use typical allocations
Eric Blake [Tue, 20 Sep 2011 18:11:31 +0000 (12:11 -0600)]
xen: use typical allocations

The next patch will add a syntax check that flags this usage in xen
as awkward - while it was valid memory management, it was very hard
to maintain.  Swapping to a more traditional allocation may be a bit
slower, but easier to understand.

* src/xen/xend_internal.c (xenDaemonListDomainsOld): Use two-level
allocation, rather than abusing allocation function.
(xenDaemonLookupByUUID): Update caller.

13 years agovirsh: Remove useless codes of cmdVolPath
Osier Yang [Tue, 20 Sep 2011 08:33:30 +0000 (16:33 +0800)]
virsh: Remove useless codes of cmdVolPath

Variable "name" is never used in the codes, it's useless.

13 years agobuild: silence warning on 32-bit build
Eric Blake [Tue, 20 Sep 2011 22:53:58 +0000 (16:53 -0600)]
build: silence warning on 32-bit build

gcc warns when building libvirt 0.9.5 on a 32-bit machine:

qemu/qemu_migration.c: In function 'qemuMigrationToFile':
qemu/qemu_migration.c:2727:38: error: large integer implicitly truncated to unsigned type [-Woverflow]

* src/qemu/qemu_domain.h (QEMU_DOMAIN_FILE_MIG_BANDWIDTH_MAX): Cap
to long when building for 32-bit platform.

13 years agoRelease of libvirt-0.9.5
Daniel Veillard [Tue, 20 Sep 2011 06:17:47 +0000 (14:17 +0800)]
Release of libvirt-0.9.5

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

13 years agoFix crash on events due to allocation errors
Daniel Veillard [Tue, 20 Sep 2011 03:51:50 +0000 (11:51 +0800)]
Fix crash on events due to allocation errors

remoteRelayDomainEventBlockJob, remoteRelayDomainEventIOError,
remoteRelayDomainEventIOErrorReason and remoteRelayDomainEventGraphics
were using const string directly in rpc structure, before calling
remoteDispatchDomainEventSend(). But that routine now frees up all
the pointed allocated memory from the rpc structure and we end up
with a double free.
This now strdup() all the strings passed and provide mem_error goto
labels to be used when an allocation error occurs.
Note that the cleanup isn't completely finished because all relaying
function also call make_nonnull_domain() which also allocate a string
and never handle the error case. This patches doesn't try to address
this as this is only error correctness a priori and touches far more
functions in this module:

* daemon/remote.c: fix string allocations and memory error handling
  for remoteRelayDomainEventBlockJob, remoteRelayDomainEventIOError,
  remoteRelayDomainEventIOErrorReason and remoteRelayDomainEventGraphics

13 years agoUpdate to require sanlock 1.8 for license compliance
Daniel P. Berrange [Mon, 19 Sep 2011 10:04:59 +0000 (11:04 +0100)]
Update to require sanlock 1.8 for license compliance

Inexplicably the sanlock code all got placed under the GPLv2-only,
so libvirt's use of sanlock introduces a license incompatibility.
The sanlock developers have now rearranged the code such that there
is a 'sanlock_client.so' which is LGPLv2+ while their daemon remains
GPLv2-only. To use the new client library we need to call the new
sanlock_init and sanlock_align APIs instead of sanlock_direct_init
and sanlock_direct_align. These APIs calls are now routed via the
sanlock daemon, instead of doing direct I/O calls to disk.

For all this we require sanlock >= 1.8

* configure.ac: Check for sanlock_client.so instead of sanlock.so
  and fix various comments
* libvirt.spec.in: Mandate sanlock >= 1.8
* src/Makefile.am: Link to -lsanlock_client
* src/locking/lock_driver_sanlock.c: Use sanlock_init and
  sanlock_align

13 years agoconf: Assign newDef of active domain as persistent conf if it is NULL
Osier Yang [Thu, 1 Sep 2011 13:33:29 +0000 (21:33 +0800)]
conf: Assign newDef of active domain as persistent conf if it is NULL

Libvirt loads the domain conf from status XML if it's running when
starting up. The problem is there is no record of the original conf.
(dom->newDef is NULL here).

So libvirt won't be able to restore the domain conf to original one
when destroying/shutdown. E.g.

1) attach a device without "--persistent"
2) restart libvirtd
3) destroy domain
4) start domain

One will see the the disk still exists.

This patch is to fix the peoblem by assigning persistent domain conf
to dom->newDef if it's NULL and the domain is running.

13 years agostorage: Ensure the device path exists before refreshing disk pool
Osier Yang [Mon, 19 Sep 2011 07:35:15 +0000 (15:35 +0800)]
storage: Ensure the device path exists before refreshing disk pool

Doing libvirt_parthelper on an not existed device path will get
an unfriendly error message. This patch is to prohibit it.

13 years agodaemon: Error and exit if specified value for timeout is not valid
Osier Yang [Mon, 19 Sep 2011 04:16:45 +0000 (12:16 +0800)]
daemon: Error and exit if specified value for timeout is not valid

Silently setting "timeout" as -1 if the specified value is invalid
is a bit confused.

13 years agoRemove devname identifier from autogenerated RPC code
Peter Krempa [Mon, 19 Sep 2011 14:14:34 +0000 (16:14 +0200)]
Remove devname identifier from autogenerated RPC code

Patch 79cf07a missed one instance of "devname" in source for RPC code
generator.

13 years agovirsh: tweak previous domblkstat patch
Eric Blake [Mon, 19 Sep 2011 20:49:08 +0000 (14:49 -0600)]
virsh: tweak previous domblkstat patch

Translators are likely to botch trailing spacing; by doing the
formatting outside of the translation, we can generally get
better alignment.  Also, for consistency, use 'bytes read' to
match 'bytes written'.

* tools/virsh.c (domblkstat_output): Drop trailing space. Tweak
rd_bytes output.
(cmdDomblkstat, DOMBLKSTAT_LEGACY_PRINT): Update formatting.

13 years agovirsh: doc: Fix supported driver types for attach-disk command
Peter Krempa [Mon, 19 Sep 2011 12:57:07 +0000 (14:57 +0200)]
virsh: doc: Fix supported driver types for attach-disk command

Virsh man page lists driver types to be used with attach-device
command, but does not specify that those are usable only with the XEN
Hypervisor.

This patch adds statement, that those options specified are applicable
only on the Xen hypervisor and adds option usable with qemu emulator.

This patch also changes type of error returned by QEMU driver if the
user specifies incompatible driver type from VIR_ERR_INTERNAL_ERROR to
VIR_ERR_CONFIG_UNSUPPORTED.

13 years agomaint: Prefer names over email in 'git shortlog'
Eric Blake [Mon, 19 Sep 2011 22:34:10 +0000 (16:34 -0600)]
maint: Prefer names over email in 'git shortlog'

Alex recently committed some patches with just an email instead
of a preferred name; this fixes things so 'git shortlog' gives
nicer output.

* .mailmap: Update.

13 years agovirsh: Add more human-friendly output of domblkstat command
Peter Krempa [Mon, 19 Sep 2011 12:23:12 +0000 (14:23 +0200)]
virsh: Add more human-friendly output of domblkstat command

Users of virsh complain that output of the domblkstat command
is not intuitive enough. This patch adds explanation of fields
returned by this command to the help section for domblkstat and
the man page of virsh. Also a switch --human is added for
domblkstat that prints the fields with more descriptive
texts.

This patch also changes sequence of the output fields and their
names back to the order and spelling established by previous
versions of virsh to maintain compatibility with scripts.

Example of ordered and "translated" output:

PRE-patch:

virsh # domblkstat 1 vda
vda wr_bytes 5170176
vda wr_operations 511
vda rd_bytes 82815488
vda rd_operations 3726

POST-patch:

virsh # domblkstat 1 vda
vda rd_req 3726
vda rd_bytes 82815488
vda wr_req 478
vda wr_bytes 4965376

Example of human readable output:

virsh # domblkstat 1 vda --human
Device: vda
 number of read operations:      3726
 number of read bytes:           82815488
 number of write operations:     478
 number of bytes written:        4965376

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

13 years agovmx: avoid memory leak
ajia@redhat.com [Mon, 19 Sep 2011 02:34:06 +0000 (10:34 +0800)]
vmx: avoid memory leak

* src/vmx/vmx.c: fix memory leak, 'def' has a initial value 'NULL', so
  'goto cleanup' is perfected instead of adding a virConfFree before
  'return NULL'.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agoutil: avoid memory leak
ajia@redhat.com [Sun, 18 Sep 2011 16:36:13 +0000 (00:36 +0800)]
util: avoid memory leak

Leak in pciGetVirtualFunctionIndex present since commit 17d64ca.

* src/util/pci.c: fix memory leak.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agoremote: avoid memory leak
ajia@redhat.com [Sun, 18 Sep 2011 16:36:12 +0000 (00:36 +0800)]
remote: avoid memory leak

Leak present since introduction of remoteDomainBuildEventGraphics
in commit 987e31e.

* src/remote/remote_driver.c: fix memory leak.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agoqemu: avoid memory leak
ajia@redhat.com [Sun, 18 Sep 2011 16:36:11 +0000 (00:36 +0800)]
qemu: avoid memory leak

Leak introduced in commit 036ad50, affects only error case.

* src/qemu/qemu_command.c: fix memory leak.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agodaemon: avoid memory leak
ajia@redhat.com [Sun, 18 Sep 2011 16:36:10 +0000 (00:36 +0800)]
daemon: avoid memory leak

Introduced in commit efa7fc9f.

* daemon/remote.c: fix memory leak in remoteDispatchDomainBlockStatsFlags

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agospec: silence warnings when installing in F16
Eric Blake [Fri, 16 Sep 2011 22:40:25 +0000 (16:40 -0600)]
spec: silence warnings when installing in F16

https://bugzilla.redhat.com/show_bug.cgi?id=738725 documents that
'yum install libvirt' in Fedora 16 is rather noisy.  This fixes
the problems.

* libvirt.spec.in (%post client): Silence chkconfig warning about
SysV services.
(%post) [with_cgconfig]: Drop for Fedora 15 and newer, where
systemd does this automatically.

13 years agosnapshot: allow disk snapshots of qcow2 disks
Eric Blake [Sat, 17 Sep 2011 12:16:08 +0000 (06:16 -0600)]
snapshot: allow disk snapshots of qcow2 disks

For all types of disks other than qcow2, we were requesting that
SELinux labeling visit the new file as if it were qcow2, which
means labeling would try to find the backing files of an empty file.
And for a pre-existing qcow2 disk, we were passing NULL, which meant
that labelling tried to probe the file type (and if probing is
disabled, per the default qemu.conf, this made snapshots fail).
What we really want is to make SELinux labeling visit the new
file as raw; it will later be converted to qcow2 if qemu successfully
made the snapshot.

* src/qemu/qemu_driver.c
(qemuDomainSnapshotCreateSingleDiskActive): Force SELinux labeling
to avoid probe of new file.

13 years agosnapshot: affect persistent xml after disk snapshot
Eric Blake [Sat, 17 Sep 2011 03:46:21 +0000 (21:46 -0600)]
snapshot: affect persistent xml after disk snapshot

For external snapshots to be useful on persistent domains, we must
alter the persistent definition alongside the running definition.
Thanks to the possibility of disk hotplug as well as of edits that
only affect the persistent xml, we can't assume that vm->def and
vm->newDef have the same disk at the same index, so we can only
update the persistent copy if the device destination matches up.

* src/qemu/qemu_driver.c (qemuDomainSnapshotCreateDiskActive)
(qemuDomainSnapshotCreateSingleDiskActive): Also affect newDef, if
present.

13 years agobuild: work around lack of MacOS fdatasync
Eric Blake [Fri, 16 Sep 2011 15:12:07 +0000 (09:12 -0600)]
build: work around lack of MacOS fdatasync

Mingw lacks fsync, but gnulib provides that.  Meanwhile, gnulib does
not (yet) provide fdatasync, so this is a quick hack to fake that
function on MacOS X; we can revert this configure change once gnulib
gives us a real module.

We have been implicitly relying on gnulib's largefile module being
pulled in by other modules, but it's better to make that explicit.

* bootstrap.conf (gnulib_modules): Add fsync.  Make largefile use
explicit.
* configure.ac (AC_CHECK_FUNCS_ONCE): Check for fdatasync, and
fake it with fsync when not present.

13 years agoPrevent crash from dlclose() of libvirt.so
Daniel P. Berrange [Thu, 1 Sep 2011 16:57:06 +0000 (17:57 +0100)]
Prevent crash from dlclose() of libvirt.so

When libvirt calls virInitialize it creates a thread local
for the virErrorPtr storage, and registers a callback to
cleanup memory when a thread exits. When libvirt is dlclose()d
or otherwise made non-resident, the callback function is
removed from memory, but the thread local may still exist
and if a thread later exists, it will invoke the callback
and SEGV. There may also be other thread locals with callbacks
pointing to libvirt code, so it is in general never safe to
unload libvirt.so from memory once initialized.

To allow dlclose() to succeed, but keep libvirt.so resident
in memory, link with '-z nodelete'. This issue was first
found with the libvirt CIM provider, but can potentially
hit many of the dynamic language bindings which all ultimately
involve dlopen() in some way, either on libvirt.so itself,
or on the glue code for the binding which in turns links
to libvirt

* configure.ac, src/Makefile.am: Ensure libvirt.so is linked
  with -z nodelete
* cfg.mk, .gitignore, tests/Makefile.am, tests/shunloadhelper.c,
  tests/shunloadtest.c: A test case to unload libvirt while
  a thread is still running.

13 years agoqemu: add return value check
Alex Jia [Fri, 16 Sep 2011 15:51:20 +0000 (23:51 +0800)]
qemu: add return value check

* src/qemu/qemu_command.c: missing return value check.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agoqemu: Introduce shutdown reason for paused state
Jiri Denemark [Thu, 15 Sep 2011 13:07:51 +0000 (15:07 +0200)]
qemu: Introduce shutdown reason for paused state

Qemu sends STOP event as part of the shutdown process. Detect such STOP
event and consider shutdown to be reason of emitting such event. That's
the best we can do until qemu provides us the reason directly in STOP
event. This allows us to report shutdown reason for paused state so that
apps can detect domains that failed to finish the shutdown process
(e.g., because qemu is buggy and doesn't exit on SIGTERM or it is
blocked in flushing disk buffers).

13 years agoqemu: Prevent disk corruption on domain shutdown
Jiri Denemark [Tue, 13 Sep 2011 16:11:26 +0000 (18:11 +0200)]
qemu: Prevent disk corruption on domain shutdown

Ever since we introduced fake reboot, we call qemuProcessKill as a
reaction to SHUTDOWN event. Unfortunately, qemu doesn't guarantee it
flushed all internal buffers before sending SHUTDOWN, in which case
killing the process forcibly may result in (virtual) disk corruption.

By sending just SIGTERM without SIGKILL we give qemu time to to flush
all buffers and exit. Once qemu exits, we will see an EOF on monitor
connection and tear down the domain. In case qemu ignores SIGTERM or
just hangs there, the process stays running but that's not any different
from a possible hang anytime during the shutdown process so I think it's
just fine.

Also qemu (since 0.14 until it's fixed) has a bug in SIGTERM processing
which causes it not to exit but instead send new SHUTDOWN event and keep
waiting. I think the best we can do is to ignore duplicate SHUTDOWN
events to avoid a SHUTDOWN-SIGTERM loop and leave the domain in paused
state.

13 years agoqemu: Properly detect crash of a rebooted domain
Jiri Denemark [Tue, 13 Sep 2011 16:48:13 +0000 (18:48 +0200)]
qemu: Properly detect crash of a rebooted domain

When a domain is rebooted using libvirt API, we use fake reboot
consisting of shutting down and resetting the domain. Thus we see a
SHUTDOWN event and set gotShutdown flag. But we never reset it back and
if the domain crashes after it was rebooted this way, we consider it was
a normal shutdown and not a crash.

13 years agoqemu: Fix shutoff reason when domain crashes
Jiri Denemark [Tue, 13 Sep 2011 16:35:21 +0000 (18:35 +0200)]
qemu: Fix shutoff reason when domain crashes

Commit 4454a9efc728b91e791b1f14c26ea23a19d57f48 changed shutoff reason
from VIR_DOMAIN_SHUTOFF_CRASHED to VIR_DOMAIN_SHUTOFF_FAILED in case we
see an unexpected EOF on monitor connection. But FAILED reason is
dedicated for domains that fail to start. CRASHED reason is the right
one to use in this situation.

13 years agopython: Fix bindings generated in VPATH build
Jiri Denemark [Fri, 16 Sep 2011 09:46:46 +0000 (11:46 +0200)]
python: Fix bindings generated in VPATH build

13 years agoRevert "virsh: Use old API if remote libvirtd does not support new"
Eric Blake [Wed, 14 Sep 2011 18:47:07 +0000 (12:47 -0600)]
Revert "virsh: Use old API if remote libvirtd does not support new"

This reverts commit 799912fa05b8c3aa37bd04c57b196755f3f70552; now
that the rpc regression is fixed, virsh no longer needs the special
case here.

13 years agorpc: convert unknown procedures to VIR_ERR_NO_SUPPORT
Eric Blake [Wed, 14 Sep 2011 18:41:17 +0000 (12:41 -0600)]
rpc: convert unknown procedures to VIR_ERR_NO_SUPPORT

Libvirt special-cases a specific VIR_ERR_RPC from the remote driver
back into VIR_ERR_NO_SUPPORT on the client, so that clients can
handle missing rpc functions the same whether the hypervisor driver
is local or remote.  However, commit c1b22644 introduced a regression:
VIR_FROM_THIS changed from VIR_FROM_REMOTE to VIR_FROM_RPC, so the
special casing no longer works if the server uses the newer error
domain.

* src/rpc/virnetclientprogram.c
(virNetClientProgramDispatchError): Also cater to 0.9.3 and newer.

13 years agoFix buzzilla 738778
Stefan Berger [Fri, 16 Sep 2011 13:44:43 +0000 (09:44 -0400)]
Fix buzzilla 738778

This patch fixes the bug shown in bugzilla 738778. It's not an nwfilter problem but a connection sharing / closure issue.

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

Depending on the speed / #CPUs of the machine you are using you may not see this bug all the time.

13 years agoconf: avoid memory leak on virDomainDefParseXML
Alex Jia [Fri, 16 Sep 2011 05:54:47 +0000 (13:54 +0800)]
conf: avoid memory leak on virDomainDefParseXML

* conf/domain_conf.c: allocate memory to def->redirdevs in
  virDomainDefParseXML such as VIR_ALLOC_N(def->redirdevs, n),
  however, virDomainDefFree(def) hasn't released these memory.

* Detected in valgrind run:

==19820== 209 (16 direct, 193 indirect) bytes in 1 blocks are definitely lost in loss record 25 of 26
==19820==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
==19820==    by 0x4A13AF: virAllocN (memory.c:129)
==19820==    by 0x4D4A0E: virDomainDefParseXML (domain_conf.c:7258)
==19820==    by 0x4D4C93: virDomainDefParseNode (domain_conf.c:7512)
==19820==    by 0x4D562F: virDomainDefParse (domain_conf.c:7465)
==19820==    by 0x415863: testCompareXMLToXMLFiles (qemuxml2xmltest.c:35)
==19820==    by 0x415982: testCompareXMLToXMLHelper (qemuxml2xmltest.c:80)
==19820==    by 0x416D31: virtTestRun (testutils.c:140)
==19820==    by 0x415604: mymain (qemuxml2xmltest.c:192)
==19820==    by 0x416437: virtTestMain (testutils.c:689)
==19820==    by 0x3CA7A1ECDC: (below main) (in /lib64/libc-2.12.so)
==19820==
==19820== LEAK SUMMARY:
==19820==    definitely lost: 16 bytes in 1 blocks
==19820==    indirectly lost: 193 bytes in 5 blocks
==19820==      possibly lost: 0 bytes in 0 blocks
==19820==    still reachable: 1,054 bytes in 21 blocks

* How to reproduce?
% valgrind -v --leak-check=full ./tests/qemuxml2xmltest

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agobuild: storage: Macro 'MKFS' is undefined on some platforms.
Peter Krempa [Fri, 16 Sep 2011 12:14:16 +0000 (14:14 +0200)]
build: storage: Macro 'MKFS' is undefined on some platforms.

Mac OS X 10.6. Snow Leopard and probably other do not provide a mkfs
command to create filesystems. Macro MKFS then remained undefined and
did not provide any substitute, so that build failed on a missing
argument.

13 years agobuild: storage: Conditionaly compiled structure caused build fail on OSX
Peter Krempa [Fri, 16 Sep 2011 12:14:15 +0000 (14:14 +0200)]
build: storage: Conditionaly compiled structure caused build fail on OSX

Struct virStoragePoolProbeResult was compiled in conditionaly, but
virStorageBackendFileSystemProbe used it unconditionaly. This patch
exempts the struct from conditional include.

13 years agoAvoid using "devname" as an identifier.
Peter Krempa [Fri, 16 Sep 2011 12:05:58 +0000 (14:05 +0200)]
Avoid using "devname" as an identifier.

/usr/lib/stdlib.h in Mac OS X and probably also in BSD's
exports this symbol :(

13 years agodoc: Add statment about permissions needed to do a core dump
Peter Krempa [Fri, 16 Sep 2011 10:04:40 +0000 (12:04 +0200)]
doc: Add statment about permissions needed to do a core dump

Documentation did not specify, that some permissions are required on
target path for coredump for the user running the hypervisor.

Diff to v1:
- reword statements

13 years agosnapshot: tweak snapshot-create-as diskspec docs
Eric Blake [Wed, 14 Sep 2011 21:20:08 +0000 (15:20 -0600)]
snapshot: tweak snapshot-create-as diskspec docs

With this patch, it is hopefully a bit more obvious that for
snapshot-create-as, a literal '--diskspec' is mandatory if name
or description was omitted, but optional if all earlier options
were provided.

These all denote two diskspecs and a description:
virsh snapshot-create-as dom name desc vda vdb
virsh snapshot-create-as dom name desc --diskspec vda --diskspec vdb
virsh snapshot-create-as dom name desc --diskspec vda vdb
virsh snapshot-create-as dom name desc vda --diskspec vdb
virsh snapshot-create-as dom --diskspec vda --diskspec vdb name desc

This gives two diskspecs but no description:
virsh snapshot-create-as dom name --diskspec vda --diskspec vdb

And this treats 'vda' as the description, with only one diskspec:
virsh snapshot-create-as dom name vda vdb

The help output now shows:
    snapshot-create-as <domain> [<name>] [<description>] [--print-xml] [--no-metadata] [--halt] [--disk-only] [[--diskspec] <string>]...

I also checked the help output for echo and send-key, which are two
other variants of argv commands.

* tools/virsh.pod (snapshot-create-as): Document when a literal
--diskspec must preceed a diskspec argument.
* tools/virsh.c (vshCmddefHelp): Update help output for argv when
naming the option is useful.
(vshCmddefGetData): Fix logic on when argv was seen.
* tests/virsh-optparse: Add tests to avoid regressions.

13 years agopython: Fix libvirt.py generation to include virterror info
Cole Robinson [Wed, 14 Sep 2011 20:25:42 +0000 (16:25 -0400)]
python: Fix libvirt.py generation to include virterror info

Recent generator refactoring broke libvirt.py. With this patch, libvirt.py
is generated exactly the same as before offending commit 9eba0d25.

13 years agoqemu_api: doc improvements
Eric Blake [Wed, 14 Sep 2011 15:49:08 +0000 (09:49 -0600)]
qemu_api: doc improvements

The new doc text had a few readability issues.  Also, the
monitor command text copied a bit too much from the attach case.

* src/libvirt-qemu.c (virDomainQemuMonitorCommand)
(virDomainQemuAttach): Fix typos and grammar.

13 years agodoc: virsh: Fix command name in man page
Peter Krempa [Thu, 15 Sep 2011 08:31:52 +0000 (10:31 +0200)]
doc: virsh: Fix command name in man page

Fix cut&paste error having command named domif-setlink instead of
domif-getlink.

13 years agosanlock: add missing test command in virt-sanlock-cleanup.in
Alex Jia [Thu, 15 Sep 2011 06:13:28 +0000 (14:13 +0800)]
sanlock: add missing test command in virt-sanlock-cleanup.in

* tools/virt-sanlock-cleanup.in: fix missing test command when judging
  second condition.

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

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agospec: Require augeas for sanlock
Michal Privoznik [Thu, 15 Sep 2011 14:55:36 +0000 (16:55 +0200)]
spec: Require augeas for sanlock

Even though we BuildRequire augeas in some cases, we need to require
it even after if we build with sanlock. virt-sanlock-cleanup use it.

13 years agoFix build after commit 829bce17
Jim Fehlig [Wed, 14 Sep 2011 23:57:55 +0000 (17:57 -0600)]
Fix build after commit 829bce17

Pushing under build-breaker rule.

13 years agoUse max bandwidth from qemuDomainObjPrivate struct when migrating
Jim Fehlig [Fri, 26 Aug 2011 18:10:27 +0000 (12:10 -0600)]
Use max bandwidth from qemuDomainObjPrivate struct when migrating

Adjust qemuMigrationRun() to use migMaxBandwidth in qemuDomainObjPrivate
structure when setting qemu migration speed.  Caller-specified 'resource'
parameter overrides migMaxBandwidth.

13 years agoSet qemu migration speed unlimited when migrating to file
Jim Fehlig [Fri, 26 Aug 2011 18:10:26 +0000 (12:10 -0600)]
Set qemu migration speed unlimited when migrating to file

The qemu migration speed default is 32MiB/s as defined in migration.c

/* Migration speed throttling */
static int64_t max_throttle = (32 << 20);

There's no need to throttle migration when targeting a file, so set migration
speed to unlimited prior to migration, and restore to libvirt default value
after migration.

Default units is MB for migrate_set_speed monitor command, so
(INT64_MAX / (1024 * 1024)) is used for unlimited migration speed.

Tested with both json and text monitors.

13 years agoSave migration speed in qemuDomainMigrateSetMaxSpeed
Jim Fehlig [Fri, 26 Aug 2011 18:10:25 +0000 (12:10 -0600)]
Save migration speed in qemuDomainMigrateSetMaxSpeed

Now that migration speed is stored in qemuDomainObjPrivate structure,
save the new value when invoking qemuDomainMigrateSetMaxSpeed().

Allow setting migration speed on inactive domain too.

13 years agoImpl virDomainMigrateGetMaxSpeed in qemu driver
Jim Fehlig [Fri, 26 Aug 2011 18:10:23 +0000 (12:10 -0600)]
Impl virDomainMigrateGetMaxSpeed in qemu driver

13 years agoStore max migration bandwidth in qemuDomainObjPrivate struct
Jim Fehlig [Fri, 26 Aug 2011 18:10:22 +0000 (12:10 -0600)]
Store max migration bandwidth in qemuDomainObjPrivate struct

The maximum bandwidth that can be consumed when migrating a domain
is better classified as an operational vs configuration parameter of
the dommain.  As such, store this parameter in qemuDomainObjPrivate
structure.

13 years agoconf: add missing break in virDomainAuditRedirdev
Marc-André Lureau [Wed, 14 Sep 2011 20:02:30 +0000 (22:02 +0200)]
conf: add missing break in virDomainAuditRedirdev

Also initialize to NULL a few variables that might get
free before being set.