• When a scsi device is backed by a scsi generic device instead of an
    ordinary host block device, the block API is abused in a couple of annoying
    ways:
    
     - nb_sectors is negative, and specifies a byte count instead of a sector count
     - offset is ignored, since scsi-generic is essentially a packet protocol
    
    This overloading makes hacking the block layer difficult.  Remove it by
    introducing a new explicit API for scsi-generic devices.  The new API
    is still backed by the old implementation, but at least the users are
    insulated.
    
    Signed-off-by: Avi Kivity <avi@redhat.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6822 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse Code »




  • Refactor the monitor API and prepare it for decoupled terminals:
    term_print functions are renamed to monitor_* and all monitor services
    gain a new parameter (mon) that will once refer to the monitor instance
    the output is supposed to appear on. However, the argument remains
    unused for now. All monitor command callbacks are also extended by a mon
    parameter so that command handlers are able to pass an appropriate
    reference to monitor output services.
    
    For the case that monitor outputs so far happen without clearly
    identifiable context, the global variable cur_mon is introduced that
    shall once provide a pointer either to the current active monitor (while
    processing commands) or to the default one. On the mid or long term,
    those use case will be obsoleted so that this variable can be removed
    again.
    
    Due to the broad usage of the monitor interface, this patch mostly deals
    with converting users of the monitor API. A few of them are already
    extended to pass 'mon' from the command handler further down to internal
    functions that invoke monitor_printf.
    
    At this chance, monitor-related prototypes are moved from console.h to
    a new monitor.h. The same is done for the readline API.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6711 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse Code »
  • Currently, waiting for the user to type in some password blocks the
    whole VM because monitor_readline starts its own I/O loop. And this loop
    also screws up reading passwords from virtual console.
    
    Patch below fixes the shortcomings by using normal I/O processing also
    for waiting on a password. To keep to modal property for the monitor
    terminal, the command handler is temporarily replaced by a password
    handler and a callback infrastructure is established to process the
    result before switching back to command mode.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6710 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse Code »
  • Reading the passwords for encrypted hard disks during early startup is
    broken (I guess for quiet a while now):
     - No monitor terminal is ready for input at this point
     - Forcing all mux'ed terminals into monitor mode can confuse other
       users of that channels
    
    To overcome these issues and to lay the ground for a clean decoupling of
    monitor terminals, this patch changes the initial password inquiry as
    follows:
     - Prevent autostart if there is some encrypted disk
     - Once the user tries to resume the VM, prompt for all missing
       passwords
     - Only resume if all passwords were accepted
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6707 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse File »
  • If the backing file is encrypted, 'info block' currently does not report
    the disk as encrypted. Fix this by using the standard API to check disk
    encryption mode. Moreover, switch to a canonical output format.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6706 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse File »
  • Introduce bdrv_get_encrypted_filename service to allow more informative
    password prompting.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6704 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse File »
  • Make bdrv_iterate more useful by passing the BlockDriverState to the
    iterator instead of the device name.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6703 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse File »
  • Make sure that we always delete temporary disk images on error, remove
    obsolete malloc error checks and return proper error codes.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6702 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse File »

  • Introduce a growable flag that's set by bdrv_file_open().  Block devices should
    never be growable, only files that are being used by block devices.
    
    I went through Fabrice's early comments about the patch that was first applied.
    While I disagree with that patch, I also disagree with Fabrice's suggestion.
    
    There's no good reason to do the checks in the block drivers themselves.  It
    just increases the possibility that this bug could show up again.  Since we're
    calling bdrv_getlength() to determine the length, we're giving the block drivers
    a chance to chime in and let us know what range is valid.
    
    Basically, this patch makes the BlockDriver API guarantee that all requests are
    within 0..bdrv_getlength() which to me seems like a Good Thing.
    
    What do others think?
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6677 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse File »
  • Signed-off-by: Alex Ivanov <void@aleksoft.net>
    Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6674 c046a42c-6fe2-441c-8c8c-71466251a162
    aurel32 authored
     
    Browse File »








  • This patch changes the cache= option to accept none, writeback, or writethough
    to control the host page cache behavior.  By default, writethrough caching is
    now used which internally is implemented by using O_DSYNC to open the disk
    images.  When using -snapshot, writeback is used by default since data integrity
    it not at all an issue.
    
    cache=none has the same behavior as cache=off previously.  The later syntax is
    still supported by now deprecated.  I also cleaned up the O_DIRECT
    implementation to avoid many of the #ifdefs.
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5485 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse Code »


  • This patch adds a bdrv_flush_all() function.  It's necessary to ensure that all
    IO operations have been flushed to disk before completely a live migration.
    
    N.B. we don't actually use this now.  We really should flush the block drivers
    using an live savevm callback to avoid unnecessary guest down time.
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5432 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse Code »

  • This patch refactors the AIO layer to allow multiple AIO implementations.  It's
    only possible because of the recent signalfd() patch.  
    
    Right now, the AIO infrastructure is pretty specific to the block raw backend.
    For other block devices to implement AIO, the qemu_aio_wait function must
    support registration.  This patch introduces a new function,
    qemu_aio_set_fd_handler, which can be used to register a file descriptor to be
    called back.  qemu_aio_wait() now polls a set of file descriptors registered
    with this function until one becomes readable or writable.
    
    This patch should allow the implementation of alternative AIO backends (via a
    thread pool or linux-aio) and AIO backends in non-traditional block devices
    (like NBD).
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5297 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse Code »


  • Right now, we sprinkle #if defined(QEMU_IMG) && defined(QEMU_NBD) all over the
    code.  It's ugly and causes us to have to build multiple object files for
    linking against qemu and the tools.
    
    This patch introduces a new file, qemu-tool.c which contains enough for
    qemu-img, qemu-nbd, and QEMU to all share the same objects.
    
    This also required getting qemu-nbd to be a bit more Windows friendly.  I also
    changed the Windows block-raw to use normal IO instead of overlapping IO since
    we don't actually do AIO yet on Windows.  I changed the various #if 0's to
     #if WIN32_AIO to make it easier for someone to eventually fix AIO on Windows.
    
    After this patch, there are no longer any #ifdef's related to qemu-img and
    qemu-nbd.
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5226 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse Code »




  • This patch introduces signalfd() to work around the signal/select race in
    checking for AIO completions.  For platforms that don't support signalfd(), we
    emulate it with threads.
    
    There was a long discussion about this approach.  I don't believe there are any
    fundamental problems with this approach and I believe eliminating the use of
    signals is a good thing.
    
    I've tested Windows and Linux using Windows and Linux guests.  I've also checked
    for disk IO performance regressions.
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5187 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse File »


  • Right now, the Windows build is broken because of NBD.  Using a mingw32 cross
    compiler is also badly broken.
    
    This patch fixes the Windows build by stubbing out NBD support until someone
    fixes it for Windows.  It also santizing the mingw32 cross compiler support
    by replacing the --enable-mingw32 option with a compiler check to determine
    if we're on windows or not.
    
    Also remove the weird SDL pseudo-detection for mingw32 using a cross compiler.
    The hardcoded sdl-config name is seemly arbitrary.  If you cross compiler SDL
    correctly and modify your PATH variable appropriately, it will Just Work when
    cross compiling.
    
    The audio driver detection is also broken for cross compiling so you have to
    specify the audio drivers explicitly for now.
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    
    
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5046 c046a42c-6fe2-441c-8c8c-71466251a162
    aliguori authored
     
    Browse File »