qemu.git
9 years agosuspend: make ps/2 devices wakeup the guest
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:22 +0000 (13:45 +0100)] 
suspend: make ps/2 devices wakeup the guest

This patch adds wakeup support to ps/2 emulation.  Any key press on the
ps/2 keyboard will wakeup the guest.  Likewise any mouse button press
will wakeup the guest.  Mouse moves are ignored, so the guest will not
wakeup in case your mouse crosses the vnc window of a suspended guest by
accident.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agosuspend: add system_wakeup monitor command
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:21 +0000 (13:45 +0100)] 
suspend: add system_wakeup monitor command

This patch adds the system_wakeup monitor command which will simply
wake up suspended guests.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agosuspend: switch acpi s3 to new infrastructure.
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:20 +0000 (13:45 +0100)] 
suspend: switch acpi s3 to new infrastructure.

This patch switches pc s3 suspend over to the new infrastructure.
The cmos_s3 qemu_irq is killed, the new notifier is used instead.
The xen hack goes away with that too, the hypercall can simply be
done in a notifier function now.

This patch also makes the guest actually stay suspended instead
of leaving suspend instantly, so it is useful for more than just
testing whenever the suspend/resume cycle actually works.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agosuspend: add infrastructure
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:19 +0000 (13:45 +0100)] 
suspend: add infrastructure

This patch adds some infrastructure to handle suspend and resume to
qemu.  First there are two functions to switch state and second there
is a suspend notifier:

 * qemu_system_suspend_request is supposed to be called when the
   guest asks for being be suspended, for example via ACPI.

 * qemu_system_wakeup_request is supposed to be called on events
   which should wake up the guest.

 * qemu_register_suspend_notifier can be used to register a notifier
   which will be called when the guest is suspended.  Machine types
   and device models can hook in there to modify state if needed.

 * qemu_register_wakeup_notifier can be used to register a notifier
   which will be called when the guest is woken up.  Machine types
   and device models can hook in there to modify state if needed.

 * qemu_system_wakeup_enable can be used to enable/disable wakeup
   events.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agoacpi: add acpi_pm1_evt_write_en
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:18 +0000 (13:45 +0100)] 
acpi: add acpi_pm1_evt_write_en

Do APCIREGS->pm1.evt.en updates using the new acpi_pm1_evt_write_en
function, so the acpi code will see those updates.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agoacpi: don't pass overflow_time to acpi_pm1_evt_get_sts
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:17 +0000 (13:45 +0100)] 
acpi: don't pass overflow_time to acpi_pm1_evt_get_sts

Pretty pointless, can easily be reached via ACPIREGS now.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agoacpi: add ACPIREGS
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:16 +0000 (13:45 +0100)] 
acpi: add ACPIREGS

All those acpi structs are not independent from each other.
Various acpi functions expecting multiple acpi structs passed
in are a clean indicator for that ;)

So this patch bundles all acpi structs in the new ACPIREGS
struct, then use it everythere pass around acpi state.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agoacpi: move around structs
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:15 +0000 (13:45 +0100)] 
acpi: move around structs

Group all structs at the top of hw/acpi.h.
Just moving around lines, no code changes.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Fri, 24 Feb 2012 15:51:24 +0000 (09:51 -0600)] 
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  slirp/misc: fix gcc __warn_memset_zero_len warnings
  vl.c: Increase width of machine name column in "-M ?" output
  tcg: Remove unneeded include statements

9 years agoMerge remote-tracking branch 'mdroth/qga-win32-pull-2-23-12' into staging
Anthony Liguori [Fri, 24 Feb 2012 15:50:37 +0000 (09:50 -0600)] 
Merge remote-tracking branch 'mdroth/qga-win32-pull-2-23-12' into staging

* mdroth/qga-win32-pull-2-23-12:
  qemu-ga: add win32 guest-shutdown command
  qemu-ga: add Windows service integration
  qemu-ga: add initial win32 support
  qemu-ga: fixes for win32 build of qemu-ga
  qemu-ga: rename guest-agent-commands.c -> commands-posix.c
  qemu-ga: separate out common commands from posix-specific ones
  qemu-ga: move channel/transport functionality into wrapper class
  qemu-ga: Add schema documentation for types

9 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Fri, 24 Feb 2012 15:45:22 +0000 (09:45 -0600)] 
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp:
  qmp: add DEVICE_TRAY_MOVED event
  ide: drop ide_tray_state_post_load()
  block: Don't call bdrv_eject() if the tray state didn't change
  block: bdrv_eject(): Make eject_flag a real bool
  block: Rename bdrv_mon_event() & BlockMonEventAction

9 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Fri, 24 Feb 2012 15:37:27 +0000 (09:37 -0600)] 
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony: (46 commits)
  qemu-iotests: common.config: Allow use of arbitrary qemu* paths
  qemu-iotests: check: print relevant path information
  qemu-iotests: test loading internal snapshots
  qemu-iotests: Update filter for default cluster size
  qemu-iotests: add qed support to 025 image resize test
  qemu-iotests: Update rbd support
  qemu-iotests: common.config: Fix no $TEST_DIR directory
  qemu-iotests: only run 016 for file and sheepdog protocols
  qemu-iotests: Use zero-based offsets for IO patterns
  qemu-iotests: add support for rbd and sheepdog protocols
  qemu-iotests: filter IMGFMT correctly in 019
  qemu-iotests: README: Fix spelling
  qemu-iotests: add support for qed format
  qemu-iotests: filter TEST_DIR correctly in 019
  qemu-iotests: fix 019 golden output
  qemu-iotests: update expected results after qemu-img changes
  qemu-iotests: add read/write from smaller backing image test
  qemu-iotests: add sub-cluster allocating write test for sparse image formats
  qemu-iotests: improve test for qemu-img convert with backing file
  qemu-iotests: consider more cases in parsing qemu-io output
  ...

9 years agoMerge remote-tracking branch 'bonzini/virtio-scsi' into staging
Anthony Liguori [Fri, 24 Feb 2012 15:33:03 +0000 (09:33 -0600)] 
Merge remote-tracking branch 'bonzini/virtio-scsi' into staging

* bonzini/virtio-scsi:
  scsi-block: always use scsi_generic_ops for cache != none
  scsi: fix searching for an empty id
  scsi: fix wrong return for target INQUIRY
  virtio-scsi: add migration support
  virtio-scsi: process control queue requests
  virtio-scsi: add basic SCSI bus operation
  virtio-scsi: Add basic request processing infrastructure
  virtio-scsi: Add virtio-scsi stub device
  scsi-disk: add migration support
  scsi-generic: add migration support
  scsi: add SCSIDevice vmstate definitions
  scsi-disk: enable scatter/gather functionality
  scsi: add scatter/gather functionality
  scsi: pass residual amount to command_complete
  ahci: use new DMA helpers
  dma-helpers: add accounting wrappers
  dma-helpers: add dma_buf_read and dma_buf_write
  dma-helpers: make QEMUSGList target independent

9 years agotarget-i386: Introduce x86_cpuid_set_model_id()
Andreas Färber [Fri, 17 Feb 2012 16:46:04 +0000 (17:46 +0100)] 
target-i386: Introduce x86_cpuid_set_model_id()

Move the logic to transform the 48-char model ID into the 12-word model
value into a helper.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agotarget-i386: Introduce x86_cpuid_version_set_stepping()
Andreas Färber [Fri, 17 Feb 2012 16:46:03 +0000 (17:46 +0100)] 
target-i386: Introduce x86_cpuid_version_set_stepping()

Move the logic for setting the stepping field into a helper function.

To make the function self-contained and to prepare for future
unordered/multiple uses, mask out any previous stepping values first.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agotarget-i386: Introduce x86_cpuid_version_set_model()
Andreas Färber [Fri, 17 Feb 2012 16:46:02 +0000 (17:46 +0100)] 
target-i386: Introduce x86_cpuid_version_set_model()

Move the logic for setting the model and extended model fields
into a helper function.

To make the function self-contained and to prepare for future
unordered/multiple uses, mask out any previous model values first.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agotarget-i386: Introduce x86_cpuid_version_set_family()
Andreas Färber [Fri, 17 Feb 2012 16:46:01 +0000 (17:46 +0100)] 
target-i386: Introduce x86_cpuid_version_set_family()

Move the logic for setting the family and extended family into a
helper function.

To make the helper self-contained and in preparation of future
unordered/multiple uses, mask out any previous family values first.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agoconsole: Eliminate text_consoles[]
Markus Armbruster [Tue, 7 Feb 2012 14:09:21 +0000 (15:09 +0100)] 
console: Eliminate text_consoles[]

Simply use consoles[] instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agosockets: Clean up inet_listen_opts()'s convoluted bind() loop
Markus Armbruster [Tue, 7 Feb 2012 14:09:15 +0000 (15:09 +0100)] 
sockets: Clean up inet_listen_opts()'s convoluted bind() loop

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agosockets: Drop sockets_debug debug code
Markus Armbruster [Tue, 7 Feb 2012 14:09:14 +0000 (15:09 +0100)] 
sockets: Drop sockets_debug debug code

I'm trying to improve this code's error reporting, and the debug code
is getting in my way: it clutters the code, it clobbers errno in
inconvenient places, and it uses the same fprintf() both for error
reporting and debug output in a few places.

Get rid of it.  Once decent error reporting is in place, adding back
whatever debug code we need shouldn't be hard.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agogdbstub: Error locations for -gdb
Markus Armbruster [Tue, 7 Feb 2012 14:09:13 +0000 (15:09 +0100)] 
gdbstub: Error locations for -gdb

Stash away the option argument with add_device_config(), so we still
have its location when we get around to parsing it.

This doesn't improve any messages I can see just yet, but that'll
change shortly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agovl.c: Error locations for options using add_device_config()
Markus Armbruster [Tue, 7 Feb 2012 14:09:12 +0000 (15:09 +0100)] 
vl.c: Error locations for options using add_device_config()

These are -bt, -serial, -virtcon, -parallel, -debugcon, -usbdevice.
Improves messages emitted via proper error reporting interfaces.  For
instance:

    $ qemu-system-x86_64 -nodefaults -S -usb -usbdevice net:vlan=xxx
    qemu-system-x86_64: Parameter 'vlan' expects a number

becomes:

    qemu-system-x86_64: -usbdevice net:vlan=xxx: Parameter 'vlan' expects a number

Many more remain unimproved, because they're fprintf()ed.  The next
few commits will take care of that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agoqemu-char: qemu_chr_open_fd() can't fail, don't check
Markus Armbruster [Tue, 7 Feb 2012 14:09:11 +0000 (15:09 +0100)] 
qemu-char: qemu_chr_open_fd() can't fail, don't check

Cleaned up silently in commit aad04cd0, but that just got reverted.
Re-apply this part.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agoqemu-char: Re-apply style fixes from just reverted aad04cd0
Markus Armbruster [Tue, 7 Feb 2012 14:09:10 +0000 (15:09 +0100)] 
qemu-char: Re-apply style fixes from just reverted aad04cd0

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agoqemu-char: Use qemu_open() to avoid leaking fds to children
Markus Armbruster [Tue, 7 Feb 2012 14:09:09 +0000 (15:09 +0100)] 
qemu-char: Use qemu_open() to avoid leaking fds to children

Fixed silently in commit aad04cd0, but that just got reverted.
Re-apply the fixes, plus one missed instance: parport on Linux.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agoRevert "qemu-char: Print strerror message on failure" and deps
Markus Armbruster [Tue, 7 Feb 2012 14:09:08 +0000 (15:09 +0100)] 
Revert "qemu-char: Print strerror message on failure" and deps

The commit's purpose is laudable:

    The only way for chardev drivers to communicate an error was to
    return a NULL pointer, which resulted in an error message that
    said _that_ something went wrong, but not _why_.

It attempts to achieve it by changing the interface to return 0/-errno
and update qemu_chr_open_opts() to use strerror() to display a more
helpful error message.  Unfortunately, it has serious flaws:

1. Backends "socket" and "udp" return bogus error codes, because
qemu_chr_open_socket() and qemu_chr_open_udp() assume that
unix_listen_opts(), unix_connect_opts(), inet_listen_opts(),
inet_connect_opts() and inet_dgram_opts() fail with errno set
appropriately.  That assumption is wrong, and the commit turns
unspecific error messages into misleading error messages.  For
instance:

    $ qemu-system-x86_64 -nodefaults -vnc :0 -chardev socket,id=bar,host=xxx
    inet_connect: host and/or port not specified
    chardev: opening backend "socket" failed: No such file or directory

ENOENT is what happens to be in my errno when the backend returns
-errno.  Let's put ERANGE there just for giggles:

    $ qemu-system-x86_64 -nodefaults -vnc :0 -chardev socket,id=bar,host=xxx -drive if=none,iops=99999999999999999999
    inet_connect: host and/or port not specified
    chardev: opening backend "socket" failed: Numerical result out of range

Worse: when errno happens to be zero, return -errno erroneously
signals success, and qemu_chr_new_from_opts() dies dereferencing
uninitialized chr.  I observe this with "-serial unix:".

2. All qemu_chr_open_opts() knows about the error is an errno error
code.  That's simply not enough for a decent message.  For instance,
when inet_dgram() can't resolve the parameter host, which errno code
should it use?  What if it can't resolve parameter localaddr?

Clue: many backends already report errors in their open methods.
Let's revert the flawed commit along with its dependencies, and fix up
the silent error paths instead.

This reverts commit 6e1db57b2ac9025c2443c665a0d9e78748637b26.

Conflicts:

console.c
hw/baum.c
qemu-char.c

This reverts commit aad04cd024f0c59f0b96f032cde2e24eb3abba6d.

The parts of commit db418a0a "Add stdio char device on windows" that
depend on the reverted change fixed up.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agoscsi-block: always use scsi_generic_ops for cache != none
Paolo Bonzini [Wed, 15 Feb 2012 13:11:22 +0000 (14:11 +0100)] 
scsi-block: always use scsi_generic_ops for cache != none

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoscsi: fix searching for an empty id
Paolo Bonzini [Wed, 15 Feb 2012 08:22:54 +0000 (09:22 +0100)] 
scsi: fix searching for an empty id

The conditions for detecting no free target or LUN were wrong.

The LUN loop was followed by an "if" condition that is never
true, because the loop is exited as soon as lun becomes equal
to bus->info->max_lun, and never becomes greater than it.

The target loop had a wrong condition (<= instead of <).  Once
this is fixed, the loop would fail in the same way as the LUN
loop.

The fix is to see whether scsi_device_find returned the device with the
last (channel, target, LUN) pair, and fail if so.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoscsi: fix wrong return for target INQUIRY
Paolo Bonzini [Wed, 15 Feb 2012 08:23:50 +0000 (09:23 +0100)] 
scsi: fix wrong return for target INQUIRY

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agovirtio-scsi: add migration support
Paolo Bonzini [Fri, 2 Dec 2011 14:23:15 +0000 (15:23 +0100)] 
virtio-scsi: add migration support

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agovirtio-scsi: process control queue requests
Paolo Bonzini [Mon, 14 Nov 2011 16:44:09 +0000 (17:44 +0100)] 
virtio-scsi: process control queue requests

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoslirp/misc: fix gcc __warn_memset_zero_len warnings
Alon Levy [Fri, 24 Feb 2012 11:33:49 +0000 (13:33 +0200)] 
slirp/misc: fix gcc __warn_memset_zero_len warnings

By removing memset altogether (Patch from Stefan Hajnoczi, tested
compile only by me).

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
9 years agoqemu-ga: add win32 guest-shutdown command
Michael Roth [Mon, 23 Jan 2012 02:24:37 +0000 (20:24 -0600)] 
qemu-ga: add win32 guest-shutdown command

Implement guest-shutdown RPC for Windows. Functionally this should be
equivalent to the posix implementation.

Original patch by Gal Hammer <ghammer@redhat.com>

9 years agoqemu-ga: add Windows service integration
Michael Roth [Sat, 21 Jan 2012 22:42:27 +0000 (16:42 -0600)] 
qemu-ga: add Windows service integration

This allows qemu-ga to function as a Windows service:

 - to install the service (will auto-start on boot):
     qemu-ga --service install
 - to start the service:
     net start qemu-ga
 - to stop the service:
     net stop qemu-ga
 - to uninstall service:
     qemu-ga --service uninstall

Original patch by Gal Hammer <ghammer@redhat.com>

9 years agoqemu-ga: add initial win32 support
Michael Roth [Sat, 21 Jan 2012 01:01:30 +0000 (19:01 -0600)] 
qemu-ga: add initial win32 support

This adds a win32 channel implementation that makes qemu-ga functional
on Windows using virtio-serial (unix-listen/isa-serial not currently
implemented). Unlike with the posix implementation, we do not use
GIOChannel for the following reasons:

 - glib calls stat() on an fd to check whether S_IFCHR is set, which is
   the case for virtio-serial on win32. Because of that, a one-time
   check to determine whether the channel is readable is done by making
   a call to PeekConsoleInput(), which reports the underlying handle is
   not a valid console handle, and thus we can never read from the
   channel.

 - if one goes as far as to "trick" glib into thinking it is a normal
   file descripter, the buffering is done in such a way that data
   written to the output stream will subsequently result in that same
   data being read back as if it were input, causing an error loop.
   furthermore, a forced flush of the channel only moves the data into a
   secondary buffer managed by glib, so there's no way to prevent output
   from getting read back as input.

The implementation here ties into the glib main loop by implementing a
custom GSource that continually submits asynchronous/overlapped I/O to
fill an GAChannel-managed read buffer, and tells glib to poll the
corresponding event handle for a completion whenever there is no
data/RPC in the read buffer to notify the main application about.

9 years agoqemu-ga: fixes for win32 build of qemu-ga
Michael Roth [Fri, 20 Jan 2012 04:04:34 +0000 (22:04 -0600)] 
qemu-ga: fixes for win32 build of qemu-ga

Various stubs and #ifdefs to compile for Windows using mingw
cross-build. Still has 1 linker error due to a dependency on the
forthcoming win32 versions of the GAChannel/transport class.

9 years agoqemu-ga: rename guest-agent-commands.c -> commands-posix.c
Michael Roth [Fri, 20 Jan 2012 04:28:18 +0000 (22:28 -0600)] 
qemu-ga: rename guest-agent-commands.c -> commands-posix.c

9 years agoqemu-ga: separate out common commands from posix-specific ones
Michael Roth [Fri, 20 Jan 2012 04:19:27 +0000 (22:19 -0600)] 
qemu-ga: separate out common commands from posix-specific ones

Many of the current RPC implementations are very much POSIX-specific
and require complete re-writes for Windows. There are however a small
set of core guest agent commands that are common to both, and other
commands such as guest-file-* which *may* be portable. So we introduce
commands.c for the latter, and will rename guest-agent-commands.c to
commands-posix.c in a future commit. Windows implementations will go in
commands-win32.c, eventually.

9 years agoqemu-ga: move channel/transport functionality into wrapper class
Michael Roth [Thu, 19 Jan 2012 06:18:20 +0000 (00:18 -0600)] 
qemu-ga: move channel/transport functionality into wrapper class

This is mostly in preparation for the win32 port, which won't use
GIO channels for reasons that will be made clearer later. Here the
GAChannel class is just a loose wrapper around GIOChannel
calls/callbacks, but we also roll in the logic/configuration for
various channel types and managing unix socket connections, which makes
the abstraction much more complete and further aids in the win32 port
since isa-serial/unix-listen will not be supported initially.

There's also a bit of refactoring in the main logic to consolidate the
exit paths so we can do common cleanup for things like pid files, which
weren't always cleaned up previously.

9 years agoqemu-ga: Add schema documentation for types
Michael Roth [Mon, 16 Jan 2012 23:44:16 +0000 (17:44 -0600)] 
qemu-ga: Add schema documentation for types

Document guest agent schema types in similar fashion to qmp schema
types.

9 years agoMerge qemu-iotests into for-anthony
Kevin Wolf [Thu, 23 Feb 2012 09:33:55 +0000 (10:33 +0100)] 
Merge qemu-iotests into for-anthony

9 years agoqemu-iotests: common.config: Allow use of arbitrary qemu* paths
Lucas Meneghel Rodrigues [Thu, 1 Dec 2011 13:41:24 +0000 (11:41 -0200)] 
qemu-iotests: common.config: Allow use of arbitrary qemu* paths

Since we might want to test arbitrary qemu, qemu-img and
qemu-io paths, allow users to specify environment variable
values for QEMU_PROG, QEMU_IMG_PROG and QEMU_IO_PROG so
the testsuite will use those values rather than find them
on PATH. Obviously, if such env variables are not set
prior to script execution, normal detection mechanism
takes place.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: check: print relevant path information
Lucas Meneghel Rodrigues [Thu, 1 Dec 2011 13:41:23 +0000 (11:41 -0200)] 
qemu-iotests: check: print relevant path information

Print the paths of the programs under test
(qemu, qemu-img and qemu-io).

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: test loading internal snapshots
Kevin Wolf [Fri, 5 Aug 2011 14:37:25 +0000 (16:37 +0200)] 
qemu-iotests: test loading internal snapshots

Test loading internal snapshots where the L1 table of the snapshot
is smaller than the current L1 table.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: Update filter for default cluster size
Kevin Wolf [Wed, 8 Jun 2011 11:23:33 +0000 (13:23 +0200)] 
qemu-iotests: Update filter for default cluster size

Until recently, qemu-img create displayed cluster_size=0 for the default
cluster size. It is changed to display the real cluster size now, which results
in the cluster size not being filtered out any more.

If the cluster size is specified explicitly in CLUSTER_SIZE, keep the output,
and if using the default, filter it out. This mostly restores the old behaviour
of the test cases; test 015 must be fixed to use CLUSTER_SIZE instead of using
extra_img_options for it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: add qed support to 025 image resize test
Stefan Hajnoczi [Mon, 16 May 2011 12:59:12 +0000 (13:59 +0100)] 
qemu-iotests: add qed support to 025 image resize test

QED now supports the truncate (aka resize) operation for growing images.
Update test 025 so it runs for QED.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: Update rbd support
Josh Durgin [Wed, 13 Apr 2011 00:47:45 +0000 (17:47 -0700)] 
qemu-iotests: Update rbd support

rbd implements bdrv_truncate, so test 025 will work.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: common.config: Fix no $TEST_DIR directory
Mitnick Lyu [Mon, 11 Apr 2011 20:05:44 +0000 (04:05 +0800)] 
qemu-iotests: common.config: Fix no $TEST_DIR directory

mkdir $TEST_DIR on common.config first run

Signed-off-by: Mitnick Lyu <mitnick.lyu@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: only run 016 for file and sheepdog protocols
Christoph Hellwig [Thu, 21 Apr 2011 06:26:04 +0000 (08:26 +0200)] 
qemu-iotests: only run 016 for file and sheepdog protocols

016 writes past EOF which isn't support by most protocols, so limit
it to file and sheepdog, which explicitly support it.

Pointed out by Josh Durgin <josh.durgin@dreamhost.com>.

Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: Use zero-based offsets for IO patterns
Stefan Hajnoczi [Fri, 4 Feb 2011 12:55:02 +0000 (12:55 +0000)] 
qemu-iotests: Use zero-based offsets for IO patterns

The io_pattern style functions have the following loop:

  for i in `seq 1 $count`; do
      echo ... $(( start + i * step )) ...
  done

Offsets are 1-based so start=1024, step=512, count=4 yields:
1536, 2048, 2560, 3072

Normally we expect:
1024, 1536, 2048, 2560

Most tests ignore this detail, which means that they perform I/O to a
slightly different range than expected by the test author.

Later on things got less innocent and tests started trying to compensate
for the 1-based indexing.  This included negative start values in test
024 and my own attempt with count-1 in test 028!

The end result is that tests that use io_pattern are hard to reason
about and don't work the way you'd expect.  It's time to clean this mess
up.

This patch switches io_pattern to 0-based offsets.  This requires
adjusting the golden outputs since I/O ranges are now shifted and output
differs.

Verifying these output diffs is easy, however.  Each diff hunk moves one
I/O from beyond the end of the pattern range to the beginning.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: add support for rbd and sheepdog protocols
MORITA Kazutaka [Mon, 17 Jan 2011 17:01:17 +0000 (02:01 +0900)] 
qemu-iotests: add support for rbd and sheepdog protocols

This patch introduces tests for protocols other than file, and
initially supports rbd and sheepdog.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: filter IMGFMT correctly in 019
Stefan Hajnoczi [Wed, 24 Nov 2010 16:12:21 +0000 (17:12 +0100)] 
qemu-iotests: filter IMGFMT correctly in 019

Test 019 can be run with qcow2 and qed image formats.  Replace the
specific image format value with "IMGFMT" so the golden output does not
hardcode qcow2 or qed.

This patch also includes a typo fix for "occurrences".

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: README: Fix spelling
Stefan Weil [Sun, 7 Nov 2010 13:56:57 +0000 (14:56 +0100)] 
qemu-iotests: README: Fix spelling

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: add support for qed format
Stefan Hajnoczi [Sun, 31 Oct 2010 20:10:20 +0000 (16:10 -0400)] 
qemu-iotests: add support for qed format

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: filter TEST_DIR correctly in 019
Christoph Hellwig [Sun, 31 Oct 2010 20:07:46 +0000 (16:07 -0400)] 
qemu-iotests: filter TEST_DIR correctly in 019

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agovl.c: Increase width of machine name column in "-M ?" output
Peter Maydell [Wed, 22 Feb 2012 22:13:11 +0000 (22:13 +0000)] 
vl.c: Increase width of machine name column in "-M ?" output

Increase the width of the column used for the machine name in
the "-M ?" output from 10 to 20 spaces. This fixes the formatting
so it looks nice for architectures where a few of the machines
have overly long names. (Our current longest machine name is
"petalogix-s3adsp1800" with "realview-eb-mpcore" not far behind.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
9 years agotcg: Remove unneeded include statements
Stefan Weil [Sat, 11 Feb 2012 09:07:55 +0000 (10:07 +0100)] 
tcg: Remove unneeded include statements

The standard include files are already included in qemu-common.h.

malloc.h and alloca.h were needed for alloca() which was removed
from TCG code some years ago when switching from dyngen to TCG
(see commit 49516bc0d622112caac9df628caf19010fda8b67).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
9 years agoqom: In function object_set_link_property(), first call object_ref(), then object_unr...
Alexander Barabash [Wed, 22 Feb 2012 17:22:26 +0000 (19:22 +0200)] 
qom: In function object_set_link_property(), first call object_ref(), then object_unref().

In the old implementation, if the new value of the property links
to the same object, as the old value, that object is first unref-ed,
and then ref-ed. This leads to unintended deinitialization of that object.

In the new implementation, this is fixed.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alexander Barabash <alexander_barabash@mentor.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agocpu defs: uncomment empty extfeatures_ecx definition for Opteron_G1 (v2)
Eduardo Habkost [Fri, 17 Feb 2012 16:41:25 +0000 (14:41 -0200)] 
cpu defs: uncomment empty extfeatures_ecx definition for Opteron_G1 (v2)

This should have no visible effect, but it should just clean up the
config file a bit.

This is based on a previous patch from John Cooper where this was introduced
with many other changes at the same time. Original John's patch submission is
at Message-ID: <4DDAD5E7.2020002@redhat.com>, <http://marc.info/?l=qemu-devel&m=130618871926030>.

Changes v1 -> v2:
 - Rebase against latest Qemu git tree

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agoadd Westmere as a qemu cpu model (v2)
Eduardo Habkost [Fri, 17 Feb 2012 16:41:24 +0000 (14:41 -0200)] 
add Westmere as a qemu cpu model (v2)

Version 1 of this patch was:

Message-Id: <1307041990-26194-11-git-send-email-ehabkost@redhat.com
http://marc.info/?l=qemu-devel&m=130704415919346

This version doesn't have the duplicate feature bits on extfeature_edx, though,
as they are being removed from the Intel models (as they are reserved bits on
Intel CPUs).

Version 1 patch description:

    This patch adds Westmere as a qemu cpu model.  The only
    additional guest visible feature of a Westmere relative
    to Nehalem is the inclusion of AES instructions.  However
    as other non-ABI visible modifications exist along with
    fabrication changes, the CPUID data of the corresponding
    deployed silicon was altered slightly to reflect this.

    We've seen isolated cases where apparently unrelated yet
    slightly incoherent CPUID data has caused problems, most
    notably during guest boot.  Providing Westmere as a
    model separate fro Nehalem allows us to more easily address
    such quirks.

    [ehabkost: edited commit message to have a better Subject line]

Signed-off-by: john cooper <john.cooper@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Changes version 1 -> version 2:
 - Remove the duplicate feature bits on extfeature_edx, that are
   reserved on Intel CPUs
 - Reorder feature flags
 - Remove x2apic from the definition because x2apic requires some fixes
   that have to be resubmitted

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agocpu defs: remove replicated flags from Intel (v2)
Eduardo Habkost [Fri, 17 Feb 2012 16:41:23 +0000 (14:41 -0200)] 
cpu defs: remove replicated flags from Intel (v2)

This patch removes the replicated feature flags from cpuid 8000_0001:edx
(extfeature_edx) from Intel models, as the duplicated feature flags are present
only on AMD CPUs. On Intel models, only the i64, syscall, and xd flags are kept
on extfeature_edx.

This is based on a previous patch from John Cooper where this was introduced
with many other changes at the same time. Original John's patch submission is
at Message-ID: <4DDAD5E7.2020002@redhat.com>, <http://marc.info/?l=qemu-devel&m=130618871926030>.

Original John's patch description was:

    cpu model bug fixes and definition corrections

    This patch was intended to address the replicated feature
    flags in cpuid 8000_0001:edx from cpuid 0000_0001:edx.
    This is due to AMD's definition where these flags are
    mostly cloned in the 8000_0001:edx cpuid function.
    qemu64 attempted to glue together the respective Intel
    and AMD nearly disjoint features and this propagated to
    the new Intel models as doing so was believed conservative
    at the time.  However after further soak and test lugging
    around this cruft doesn't provide any value, could
    conceivably confuse a guest, and has confused users trying
    to maintain/add cpu definitions.  This also caused issues
    for libvirt attempting to track this mis-encoding.

    So we've here tossed out the AMD replicated definitions
    from the Intel models, added a few replications into AMD
    definitions which were missing according to AMD's latest
    CPUID document, and reordered the config file flags to
    follow intuitive sequential bit ordering.  Also two flag
    name aliases were added for clarity to Intel models.  The
    end result being the models definitions now conform to
    their respective cpuid specifications sans x2apic which is
    emulated by kvm.

    This was tested with the following combinations:

        [Conroe, Penryn, Nehalem] x [F12-64, win64, win32] -- Intel host
        [Opteron_G1, Opteron_G2, Opteron_G3] x [F12-64, win64, win32] -- AMD host

    Yielding successful boots in all cases.

Signed-off-by: john cooper <john.cooper@redhat.com>
Changes v1 -> v2:
 - Rebase against latest Qemu git tree

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agocpu defs: add pse36, mca, mtrr to AMD CPU definitions (v2)
Eduardo Habkost [Fri, 17 Feb 2012 16:41:22 +0000 (14:41 -0200)] 
cpu defs: add pse36, mca, mtrr to AMD CPU definitions (v2)

This patch adds some missing flags to extfeature_edx, that were missing
according to AMD's latest CPUID document.

This is based on a previous patch from John Cooper where this was introduced
with many other changes at the same time. Original John's patch submission is
at Message-ID: <4DDAD5E7.2020002@redhat.com>, <http://marc.info/?l=qemu-devel&m=130618871926030>.

Original John's patch description was:

    cpu model bug fixes and definition corrections

    This patch was intended to address the replicated feature
    flags in cpuid 8000_0001:edx from cpuid 0000_0001:edx.
    This is due to AMD's definition where these flags are
    mostly cloned in the 8000_0001:edx cpuid function.
    qemu64 attempted to glue together the respective Intel
    and AMD nearly disjoint features and this propagated to
    the new Intel models as doing so was believed conservative
    at the time.  However after further soak and test lugging
    around this cruft doesn't provide any value, could
    conceivably confuse a guest, and has confused users trying
    to maintain/add cpu definitions.  This also caused issues
    for libvirt attempting to track this mis-encoding.

    So we've here tossed out the AMD replicated definitions
    from the Intel models, added a few replications into AMD
    definitions which were missing according to AMD's latest
    CPUID document, and reordered the config file flags to
    follow intuitive sequential bit ordering.  Also two flag
    name aliases were added for clarity to Intel models.  The
    end result being the models definitions now conform to
    their respective cpuid specifications sans x2apic which is
    emulated by kvm.

    This was tested with the following combinations:

        [Conroe, Penryn, Nehalem] x [F12-64, win64, win32] -- Intel host
        [Opteron_G1, Opteron_G2, Opteron_G3] x [F12-64, win64, win32] -- AMD host

    Yielding successful boots in all cases.

Signed-off-by: john cooper <john.cooper@redhat.com>
Changes v1 -> v2:
 - Rebase against latest Qemu git tree

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agocpu defs: use Intel flag names for Intel models (v2)
Eduardo Habkost [Fri, 17 Feb 2012 16:41:21 +0000 (14:41 -0200)] 
cpu defs: use Intel flag names for Intel models (v2)

Use 'i64' instead of 'lm' and 'xd' instead of 'nx' on Intel models.

The flags have different names on Intel docs, so use those names for clarity.

This is based on a previous patch from John Cooper where this was introduced
with many other changes at the same time. Original John's patch submission is
at Message-ID: <4DDAD5E7.2020002@redhat.com>, <http://marc.info/?l=qemu-devel&m=130618871926030>.

Changes v1 -> v2:
 - Rebase patch against latest Qemu git tree

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agocpu flags: aliases: pclmuldq|pclmulqdq and ffxsr|fxsr_opt
Eduardo Habkost [Fri, 17 Feb 2012 16:41:20 +0000 (14:41 -0200)] 
cpu flags: aliases: pclmuldq|pclmulqdq and ffxsr|fxsr_opt

pclmulqdq: /proc/cpuinfo on Linux and all documentation I have seen uses
pclmulqdq as the flag name. As the only document using pclmuldq seems to
be the Intel CPUID documentation (Application Note 485), it looks like a
typo and not the correct name for the flag.

ffxsr: AMD docs refer to fxsr_opt as ffxsr, so allow this named to be
used too.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agocpu models: reorder flag list to match bit order
Eduardo Habkost [Fri, 17 Feb 2012 16:41:19 +0000 (14:41 -0200)] 
cpu models: reorder flag list to match bit order

This will make it easier to review and change the flag list in the future.

No behaviour change should be introduced by this, as it is just changing
the flag order on the config file.

To make sure the flag sets are really not changed by this patch, I have
used the following stupid script to compare the flag values in the
config files:
https://gist.github.com/1004885

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agosplit SCSI and LSI, add myself as SCSI maintainer
Paolo Bonzini [Wed, 22 Feb 2012 14:59:52 +0000 (15:59 +0100)] 
split SCSI and LSI, add myself as SCSI maintainer

This has been the de facto situation for a while now.
Add a tree, too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agoqmp: add DEVICE_TRAY_MOVED event
Luiz Capitulino [Tue, 14 Feb 2012 15:41:13 +0000 (13:41 -0200)] 
qmp: add DEVICE_TRAY_MOVED event

It's emitted whenever the tray is moved by the guest or by HMP/QMP
commands.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
9 years agoide: drop ide_tray_state_post_load()
Luiz Capitulino [Fri, 17 Feb 2012 18:40:00 +0000 (16:40 -0200)] 
ide: drop ide_tray_state_post_load()

This is used to sync the physical tray state after migration when
using CD-ROM passthrough. However, migrating when using passthrough
is broken anyway and shouldn't be supported...

So, drop this function as it causes a problem with the DEVICE_TRAY_MOVED
event, which is going to be introduced by the next commit.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
9 years agoblock: Don't call bdrv_eject() if the tray state didn't change
Luiz Capitulino [Fri, 17 Feb 2012 13:05:21 +0000 (11:05 -0200)] 
block: Don't call bdrv_eject() if the tray state didn't change

It's not needed. Besides we can then assume that bdrv_eject() is
only called when there's a tray state change, which is useful to
the DEVICE_TRAY_MOVED event (going to be added in a future
commit).

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
9 years agoblock: bdrv_eject(): Make eject_flag a real bool
Luiz Capitulino [Fri, 3 Feb 2012 18:24:53 +0000 (16:24 -0200)] 
block: bdrv_eject(): Make eject_flag a real bool

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
9 years agoblock: Rename bdrv_mon_event() & BlockMonEventAction
Luiz Capitulino [Wed, 25 Jan 2012 18:59:43 +0000 (16:59 -0200)] 
block: Rename bdrv_mon_event() & BlockMonEventAction

They are QMP events, not monitor events. Rename them accordingly.

Also, move bdrv_emit_qmp_error_event() up in the file. A new event will
be added soon and it's good to have them next each other.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
9 years agoqom: add test tools
Anthony Liguori [Mon, 20 Feb 2012 22:28:30 +0000 (16:28 -0600)] 
qom: add test tools

Tested-by: Andreas F=E4rber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agoqmp: make qmp.py easier to use
Anthony Liguori [Mon, 20 Feb 2012 22:28:29 +0000 (16:28 -0600)] 
qmp: make qmp.py easier to use

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 years agoqemu-iotests: fix 019 golden output
Kevin Wolf [Sun, 31 Oct 2010 20:05:21 +0000 (16:05 -0400)] 
qemu-iotests: fix 019 golden output

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: update expected results after qemu-img changes
Kevin Wolf [Fri, 15 Oct 2010 21:08:51 +0000 (14:08 -0700)] 
qemu-iotests: update expected results after qemu-img changes

The error message for leaked clusters has changed. qemu-iotests needs to be
updated to pass 026 again.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: add read/write from smaller backing image test
Stefan Hajnoczi [Fri, 15 Oct 2010 14:56:35 +0000 (07:56 -0700)] 
qemu-iotests: add read/write from smaller backing image test

Some image formats support backing images that are smaller than the
image file.  This patch adds a test that verifies that reads and writes
beyond the end of backing image work.

Unallocated reads beyond the end of the backing file should produce
zeroes.

Writes beyond the end of the backing file should copy-on-write using
zeroes.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: add sub-cluster allocating write test for sparse image formats
Stefan Hajnoczi [Fri, 15 Oct 2010 14:55:52 +0000 (07:55 -0700)] 
qemu-iotests: add sub-cluster allocating write test for sparse image formats

Image formats that grow the image file on demand and are organized into
clusters must handle sub-cluster allocating writes.  Such writes touch
a portion of a previously unallocated data cluster.  After the image
file is grown with the written data, reads of that cluster should work
as expected:

1. Sectors before the written region are zero.
2. The written region is present and the data is uncorrupted.
3. Sectors after the written region are zero.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: improve test for qemu-img convert with backing file
Kevin Wolf [Fri, 15 Oct 2010 14:53:00 +0000 (07:53 -0700)] 
qemu-iotests: improve test for qemu-img convert with backing file

Additionally to testing the qemu-img convert -B option, also test
-o backing_file.

Also, the old test acidentlly used a pattern of zeros for most of the writes,
so that the allocation test didn't really work out. This is fixed by using an
explicit pattern.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: consider more cases in parsing qemu-io output
Kevin Wolf [Fri, 1 Oct 2010 04:02:28 +0000 (06:02 +0200)] 
qemu-iotests: consider more cases in parsing qemu-io output

I got a bug report with test output diffs like this:

-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 KiB, 1 ops; 0.0000 sec (inf EiB/sec and inf ops/sec)

This patch extends the regular expression to consider terabytes, petabytes and
exabytes, and to allow inf as value for the throughput.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: qcow2 error path tests
Kevin Wolf [Mon, 14 Jun 2010 09:17:54 +0000 (11:17 +0200)] 
qemu-iotests: qcow2 error path tests

This adds test cases for qcow2 error paths (using blkdebug)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: improve rebase test
Kevin Wolf [Tue, 4 May 2010 16:59:26 +0000 (18:59 +0200)] 
qemu-iotests: improve rebase test

The old test didn't consider cases in which the COW files contains some
unallocated clusters and after them allocated ones again.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: test bdrv_truncate
Stefan Hajnoczi [Tue, 4 May 2010 16:59:08 +0000 (18:59 +0200)] 
qemu-iotests: test bdrv_truncate

This patch adds an image resize grow test to ensure that existing data
is not lost during grow and new space is zeroed.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: explicitly use bash interpreter
Stefan Hajnoczi [Mon, 26 Apr 2010 09:44:05 +0000 (11:44 +0200)] 
qemu-iotests: explicitly use bash interpreter

The tests use bash language features like 'let', which aren't supported
by /bin/sh on systems that use a conservative shell like dash.  This
patch changes the interpreter to /bin/bash.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: test qemu-img rebase
Kevin Wolf [Sun, 17 Jan 2010 11:23:15 +0000 (12:23 +0100)] 
qemu-iotests: test qemu-img rebase

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: test larger clusters sizes on qcow2
Kevin Wolf [Thu, 1 Oct 2009 17:30:19 +0000 (14:30 -0300)] 
qemu-iotests: test larger clusters sizes on qcow2

This patch adds test case 023 which tests some more cluster sizes. For
anythinger larger than 4k clusters we can't use requests that are l2_size or
more (128k for 1k clusters, 2 MB for 4k clusters, 512 MB for 64k clusters).
Therefore one of the common.pattern cases is changed and needs new expected
results for some old test cases.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: 019: Make cluster size dynamic
Kevin Wolf [Thu, 1 Oct 2009 17:30:13 +0000 (14:30 -0300)] 
qemu-iotests: 019: Make cluster size dynamic

Change the offsets for test requests according to CLUSTER_SIZE.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: align test requests according to cluster size
Kevin Wolf [Thu, 1 Oct 2009 17:29:59 +0000 (14:29 -0300)] 
qemu-iotests: align test requests according to cluster size

Change the io_test and io_test2 functions to take the cluster size of the image
and the number of test requests to issue. Tests are changed to specify a
cluster size (usually 4k), but expected test results stay the same for now
(apart from qemu-img printing the cluster size now).

Based on a patch written by Christoph Hellwig.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: add support for vdi format "static" option
Stefan Weil [Thu, 13 Aug 2009 16:49:48 +0000 (13:49 -0300)] 
qemu-iotests: add support for vdi format "static" option

VDI supports an image option 'static'.
Ignore "static=off" from qemu-img output.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: fix expected result for 019 after qemu-io change
Kevin Wolf [Mon, 27 Jul 2009 11:12:40 +0000 (13:12 +0200)] 
qemu-iotests: fix expected result for 019 after qemu-io change

The output of the alloc command in qemu-io has changed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: test bdrv_load/save_vmstate
Kevin Wolf [Mon, 20 Jul 2009 12:36:47 +0000 (14:36 +0200)] 
qemu-iotests: test bdrv_load/save_vmstate

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: common.pattern: allow spaces in io() operation
Kevin Wolf [Mon, 20 Jul 2009 12:35:43 +0000 (14:35 +0200)] 
qemu-iotests: common.pattern: allow spaces in io() operation

We need to be able to pass "write -b" as an operation to the pattern testing
functions. Unfortunately, this contains a space character...

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: test invalid pattern argument handling in qemu-io
Christoph Hellwig [Mon, 20 Jul 2009 12:33:53 +0000 (14:33 +0200)] 
qemu-iotests: test invalid pattern argument handling in qemu-io

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
9 years agoqemu-iotests: replace FSF postal addresses with www.gnu.org links
Christoph Hellwig [Thu, 16 Jul 2009 17:26:54 +0000 (19:26 +0200)] 
qemu-iotests: replace FSF postal addresses with gnu.org links

Blue Swirl notices that we were using the old FSF post address in the
license boilerplates.  Replace both the old and new address with links
to the gnu.org licenses homepage as suggested by Ben Pfaff.

Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: test commiting changes to backing file
Kevin Wolf [Thu, 16 Jul 2009 17:11:58 +0000 (19:11 +0200)] 
qemu-iotests: test commiting changes to backing file

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: test qemu-img convert with backing file for the output image
Kevin Wolf [Thu, 16 Jul 2009 17:11:09 +0000 (19:11 +0200)] 
qemu-iotests: test qemu-img convert with backing file for the output image

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: test merge of backing file when converting
Kevin Wolf [Thu, 16 Jul 2009 17:09:41 +0000 (19:09 +0200)] 
qemu-iotests: test merge of backing file when converting

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: simple backing file test
Kevin Wolf [Thu, 16 Jul 2009 17:08:22 +0000 (19:08 +0200)] 
qemu-iotests: simple backing file test

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: test I/O after EOF for growable files
Christoph Hellwig [Thu, 16 Jul 2009 16:43:09 +0000 (18:43 +0200)] 
qemu-iotests: test I/O after EOF for growable files

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviwed-by: Kevin Wolf <kwolf@redhat.com>
9 years agoqemu-iotests: fix pattern for write test
Stefan Weil [Tue, 14 Jul 2009 21:16:00 +0000 (23:16 +0200)] 
qemu-iotests: fix pattern for write test

The write pattern value 0axb is invalid and evaluates to 0,
so the read check (which uses a correct value of 0xab) will fail.

This failure will only be detected with a separate patch for
qemu-io. Without it, qemu-io cannot interpret hex values
and always uses a pattern value of 0.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
9 years agoqemu-iotests: make a few more tests generic
Christoph Hellwig [Thu, 9 Jul 2009 13:26:11 +0000 (15:26 +0200)] 
qemu-iotests: make a few more tests generic

Pretend that a non-implemented check is always successful and thus allow
various tests that were qcow2-specific before to be generic.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>