Statistics
| Branch: | Revision:

root / blockdev.c @ 992aeb8e

History | View | Annotate | Download (42.5 kB)

# Date Author Comment
4d454574 01/12/2013 06:17 pm Paolo Bonzini

qemu-option: move standard option definitions out of qemu-config.c

Signed-off-by: Paolo Bonzini <>

9c17d615 12/19/2012 09:32 am Paolo Bonzini

softmmu: move include files to include/sysemu/

Signed-off-by: Paolo Bonzini <>

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

83c9089e 12/19/2012 09:31 am Paolo Bonzini

monitor: move include files to include/monitor/

Signed-off-by: Paolo Bonzini <>

7b1b5d19 12/19/2012 09:31 am Paolo Bonzini

qapi: move include files to include/qobject/

Signed-off-by: Paolo Bonzini <>

737e150e 12/19/2012 09:31 am Paolo Bonzini

block: move include files to include/block/

Signed-off-by: Paolo Bonzini <>

e478b448 12/11/2012 05:35 pm Dong Xu Wang

use qemu_opts_create_nofail

We will use qemu_opts_create_nofail function, it can make code
more readable.

Signed-off-by: Dong Xu Wang <>
Signed-off-by: Kevin Wolf <>

2d0d2837 12/11/2012 12:05 pm Christian Borntraeger

Support default block interfaces per QEMUMachine

There are QEMUMachines that have neither IF_IDE nor IF_SCSI as a
default/standard interface to their block devices / drives. Therefore,
this patch introduces a new field default_block_type per QEMUMachine
struct. The prior use_scsi field becomes thereby obsolete and is...

71c79813 12/11/2012 12:05 pm Luiz Capitulino

block: bdrv_img_create(): add Error ** argument

This commit adds an Error ** argument to bdrv_img_create() and set it
appropriately on error.

Callers of bdrv_img_create() pass NULL for the new argument and still
rely on bdrv_img_create()'s return value. Next commits will change...

43e17041 12/11/2012 12:05 pm Luiz Capitulino

qmp: qmp_transaction(): pass Error object to bdrv_img_create()

Signed-off-by: Luiz Capitulino <>
Signed-off-by: Kevin Wolf <>

cf8f2426 12/11/2012 12:05 pm Luiz Capitulino

qmp: qmp_drive_mirror(): pass Error object to bdrv_img_create()

Signed-off-by: Luiz Capitulino <>
Signed-off-by: Kevin Wolf <>

0d92d17a 10/31/2012 03:39 am Jan Kiszka

Issue warning when deprecated drive parameter boot=on|off is used

Releases of qemu-kvm will be interrupted at qemu 1.3.0.
Users should switch to plain qemu releases.
To avoid breaking scenarios which are setup with command line
options specific to qemu-kvm, port these switches from qemu-kvm...

b952b558 10/24/2012 11:26 am Paolo Bonzini

mirror: add support for on-source-error/on-target-error

Error management is important for mirroring; otherwise, an error on the
target (even something as "innocent" as ENOSPC) requires to start again
with a full copy. Similar to on_read_error/on_write_error, two separate...

d9b902db 10/24/2012 11:26 am Paolo Bonzini

qmp: add drive-mirror command

This adds the monitor commands that start the mirroring job.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

d5208c45 10/24/2012 11:26 am Jeff Cody

block: in commit, determine base image from the top image

This simplifies some code and error checking, and also fixes a bug.

bdrv_find_backing_image() should only be passed absolute filenames,
or filenames relative to the chain. In the QMP message handler for...

aeae883b 10/24/2012 11:26 am Paolo Bonzini

block: add block-job-complete

While streaming can be dropped as soon as it progressed through the whole
image, mirroring needs to be completed manually for two reasons: 1) so that
management knows exactly when the VM switches to the target; 2) because
for other use cases such as replication, we may leave the operation running...

a66a2a36 10/24/2012 11:26 am Paolo Bonzini

block: introduce BLOCK_JOB_READY event

Even for jobs that need to be manually completed, management may want
to take care itself of the completion, not requiring the user to issue
a command to terminate the job. In this case we want to avoid that
they poll us continuously, waiting for completion to become available....

4d5b97da 10/05/2012 04:10 pm Amos Kong

cleanup useless return sentence

This patch cleans up return sentences in the end of void functions.

Reported-by: Paolo Bonzini <>
Signed-off-by: Amos Kong <>
Signed-off-by: Stefan Hajnoczi <>

1ceee0d5 09/28/2012 08:40 pm Paolo Bonzini

iostatus: change is_read to a bool

Do this while we are touching this part of the code, before introducing
more uses of "int is_read".

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Eric Blake <>
Signed-off-by: Kevin Wolf <>

1d809098 09/28/2012 08:40 pm Paolo Bonzini

stream: add on-error argument

This patch adds support for error management to streaming.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Eric Blake <>
Signed-off-by: Kevin Wolf <>

92aa5c6d 09/28/2012 08:40 pm Paolo Bonzini

iostatus: move BlockdevOnError declaration to QAPI

This will let block-stream reuse the enum. Places that used the enums
are renamed accordingly.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Eric Blake <>
Signed-off-by: Kevin Wolf <>

30e628b7 09/28/2012 08:14 pm Paolo Bonzini

block: add block_job_query

Extract it out of the implementation of info block-jobs.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Eric Blake <>
Signed-off-by: Kevin Wolf <>

8acc72a4 09/28/2012 08:14 pm Paolo Bonzini

block: add support for job pause/resume

Job pausing reuses the existing support for cancellable sleeps. A pause
happens at the next sleeping point and lasts until the coroutine is
re-entered explicitly. Cancellation was already doing a forced resume,
so implement it explicitly in terms of resume....

6e37fb81 09/28/2012 08:14 pm Paolo Bonzini

qmp: add block-job-pause and block-job-resume

Add QMP commands matching the functionality.

Paused jobs cannot be canceled without first resuming them. This
ensures that I/O errors are never missed by management. However, an
optional force argument can be specified to allow that....

2f0c9fe6 09/28/2012 08:14 pm Paolo Bonzini

block: move job APIs to separate files

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Eric Blake <>
Signed-off-by: Kevin Wolf <>

7ef15070 09/28/2012 08:08 pm Paolo Bonzini

qerror/block: introduce QERR_BLOCK_JOB_NOT_ACTIVE

The DeviceNotActive text is not a particularly good match, add
a separate text while keeping the same class.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Eric Blake <>...

ed61fc10 09/28/2012 07:23 pm Jeff Cody

QAPI: add command for live block commit, 'block-commit'

The command for live block commit is added, which has the following
arguments:

device: the block device to perform the commit on (mandatory)
base: the base image to commit into; optional (if not specified,...

9abf2dba 09/28/2012 07:23 pm Jeff Cody

blockdev: rename block_stream_cb to a generic block_job_cb

Signed-off-by: Jeff Cody <>
Reviewed-by: Eric Blake <>
Signed-off-by: Kevin Wolf <>

870f5681 09/28/2012 06:51 pm Jeff Cody

block: after creating a live snapshot, make old image read-only

Currently, after a live snapshot of a drive, the image that has
been 'demoted' to be below the new active layer remains r/w.
This patch reopens it read-only.

Note that we do not check for error on the reopen(), because we...

80dd1aae 09/24/2012 04:15 pm Kevin Shanahan

blockdev: preserve readonly and snapshot states across media changes

If readonly=on is given at device creation time, the ->readonly flag
needs to be set in the block driver state for this device so that
readonly-ness is preserved across media changes (qmp change command)....

1f212b9d 08/10/2012 11:25 am Paolo Bonzini

blockdev: flip default cache mode from writethrough to writeback

Now all major device models (IDE, SCSI, virtio) can choose between
writethrough and writeback at run-time, and virtio will even revert
to writethrough if the guest is not capable of sending flushes. So...

c8057f95 08/02/2012 09:16 pm Peter Maydell

Support 'help' as a synonym for '?' in command line options

For command line options which permit '?' meaning 'please list the
permitted values', add support for 'help' as a synonym, by abstracting
the check out into a helper function.

This change means that in some cases where we were being lazy in...

aaea3f36 07/17/2012 05:48 pm Markus Armbruster

blockdev: Drop redundant CHS validation for if=ide

Leave it to ide_init_drive().

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

577d0a38 07/17/2012 05:48 pm Markus Armbruster

blockdev: Don't limit DriveInfo serial to 20 characters

All current users (IDE, SCSI and virtio-blk) happen to share this 20
characters limit. Still, it should be left to device models. They
already enforce their limits. They have to, as the DriveInfo limit...

2b584959 07/17/2012 05:48 pm Markus Armbruster

block: Geometry and translation hints are now useless, purge them

There are two producers of these hints: drive_init() on behalf of
-drive, and hd_geometry_guess().

The only consumer of the hint is hd_geometry_guess().

The callers of hd_geometry_guess() call it only when drive_init()...

317bb412 07/17/2012 05:48 pm Markus Armbruster

blockdev: Save geometry in DriveInfo

In preparation of purging it from the block layer, which will happen
later in this series.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

04d4abe9 07/09/2012 04:53 pm Stefan Hajnoczi

blockdev: warn when copy_on_read=on and readonly=on

If the image is read-only then it's not possible to copy read data into
it. Therefore copy-on-read is automatically disabled for read-only
images.

Up until now this behavior was silent, add a warning so the user knows...

79d21d5b 06/15/2012 03:03 pm Markus Armbruster

block: Simplify how drive_init() computes default ID

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

8be7e7e4 06/04/2012 07:49 pm Luiz Capitulino

qemu-option: qemu_opts_create(): use error_set()

This commit converts qemu_opts_create() from qerror_report() to
error_set().

Currently, most calls to qemu_opts_create() can't fail, so most
callers don't need any changes.

The two cases where code checks for qemu_opts_create() erros are:...

e86fe18a 05/10/2012 11:32 am Paolo Bonzini

block: fail live snapshot if disk has no medium

Reviewed-by: Kevin Wolf <>
Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

fd7f8c65 04/27/2012 05:44 pm Stefan Hajnoczi

block: use Error mechanism instead of -errno for block_job_create()

The block job API uses -errno return values internally and we convert
these to Error in the QMP functions. This is ugly because the Error
should be created at the point where we still have all the relevant...

9e6636c7 04/27/2012 05:44 pm Stefan Hajnoczi

block: use Error mechanism instead of -errno for block_job_set_speed()

There are at least two different errors that can occur in
block_job_set_speed(): the job might not support setting speeds or the
value might be invalid.

Use the Error mechanism to report the error where it occurs....

882ec7ce 04/27/2012 05:44 pm Stefan Hajnoczi

block: change block-job-set-speed argument from 'value' to 'speed'

Signed-off-by: Stefan Hajnoczi <>
Acked-by: Kevin Wolf <>
Signed-off-by: Luiz Capitulino <>

c83c66c3 04/27/2012 05:44 pm Stefan Hajnoczi

block: add 'speed' optional parameter to block-stream

Allow streaming operations to be started with an initial speed limit.
This eliminates the window of time between starting streaming and
issuing block-job-set-speed. Users should use the new optional 'speed'...

ed9d4205 04/05/2012 05:28 pm Benoît Canet

blockdev: open images with BDRV_O_INCOMING on incoming live migration

Open images with BDRV_O_INCOMING in order to inform block drivers
that an incoming live migration is coming.

Signed-off-by: Benoit Canet <>
Reviewed-by: Stefan Hajnoczi <>...

12bde0ee 04/05/2012 03:54 pm Paolo Bonzini

block: cancel jobs when a device is ready to go away

We do not want jobs to keep a device busy for a possibly very long
time, and management could become confused because they thought a
device was not even there anymore. So, cancel long-running jobs
as soon as their device is going to disappear....

aa2c91bd 04/05/2012 03:54 pm Floris Bos

ide: Change serial number strncpy() to pstrcpy()

strncpy may not null-terminate the destination string.

Cc:
Signed-off-by: Floris Bos <>
Signed-off-by: Kevin Wolf <>

622d2419 03/12/2012 04:14 pm Paolo Bonzini

use QSIMPLEQ_FOREACH_SAFE when freeing list elements

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

52e7c241 03/12/2012 04:14 pm Paolo Bonzini

rename blockdev-group-snapshot-sync

We will add other kinds of operation. Prepare for this by adjusting
the schema.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

bc8b094f 03/12/2012 04:14 pm Paolo Bonzini

add mode field to blockdev-snapshot-sync transaction item

The mode field lets a management application create the snapshot
destination outside QEMU.

Right now, the only modes are "existing" and "absolute-paths". Mirroring
introduces "no-backing-file". In the future "relative-paths" could be...

6cc2a415 03/12/2012 04:14 pm Paolo Bonzini

qmp: convert blockdev-snapshot-sync to a wrapper around transactions

Simplify the blockdev-snapshot-sync code and gain failsafe operation
by turning it into a wrapper around the new transaction command. A new
option is also added matching "mode".

Signed-off-by: Paolo Bonzini <>...

d0895d6e 03/12/2012 04:14 pm Paolo Bonzini

Group snapshot: Fix format name for backing file

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

e8877497 03/12/2012 04:14 pm Stefan Hajnoczi

block: handle -EBUSY in bdrv_commit_all()

Monitor operations that manipulate image files must not execute while a
background job (like image streaming) is in progress. This prevents
corruptions from happening when two pieces of code are manipulating the...

8802d1fd 02/29/2012 04:48 pm Jeff Cody

qapi: Introduce blockdev-group-snapshot-sync command

This is a QAPI/QMP only command to take a snapshot of a group of
devices. This is similar to the blockdev-snapshot-sync command, except
blockdev-group-snapshot-sync accepts a list devices, filenames, and...

1e9eb78a 02/22/2012 05:02 pm Jordan Justen

blockdev: allow read-only pflash devices

Signed-off-by: Jordan Justen <>
Signed-off-by: Anthony Liguori <>

c9344f22 02/03/2012 07:22 pm Anthony Liguori

Fix build breakage from last commit.

Signed-off-by: Anthony Liguori <>

eeb9c1b5 02/03/2012 07:13 pm Anthony Liguori

s390x: fix -drive in the absence of aliases

Signed-off-by: Anthony Liguori <>

370521a1 01/26/2012 03:49 pm Stefan Hajnoczi

qmp: add block_job_cancel command

Add block_job_cancel, which stops an active block streaming operation.
When the operation has been cancelled the new BLOCK_JOB_CANCELLED event
is emitted.

Signed-off-by: Stefan Hajnoczi <>
Acked-by: Luiz Capitulino <>...

fb5458cd 01/26/2012 03:49 pm Stefan Hajnoczi

qmp: add query-block-jobs

Add query-block-jobs, which shows the progress of ongoing block device
operations.

Signed-off-by: Stefan Hajnoczi <>
Acked-by: Luiz Capitulino <>
Signed-off-by: Kevin Wolf <>

aa398a5c 01/26/2012 03:49 pm Stefan Hajnoczi

blockdev: make image streaming safe across hotplug

Unplugging a storage interface like virtio-blk causes the host block
device to be deleted too. Long-running operations like block migration
must take a DriveInfo reference to prevent the BlockDriverState from...

c8c3080f 01/26/2012 03:49 pm Marcelo Tosatti

block: add support for partial streaming

Add support for streaming data from an intermediate section of the
image chain (see patch and documentation for details).

Signed-off-by: Marcelo Tosatti <>
Signed-off-by: Stefan Hajnoczi <>...

2d47c6e9 01/26/2012 03:49 pm Stefan Hajnoczi

qmp: add block_job_set_speed command

Add block_job_set_speed, which sets the maximum speed for a background
block operation.

Signed-off-by: Stefan Hajnoczi <>
Acked-by: Luiz Capitulino <>
Signed-off-by: Kevin Wolf <>

12bd451f 01/26/2012 03:49 pm Stefan Hajnoczi

qmp: add block_stream command

Add the block_stream command, which starts copy backing file contents
into the image file. Also add the BLOCK_JOB_COMPLETED QMP event which
is emitted when image streaming completes. Later patches add control
over the background copy speed, cancelation, and querying running...

2d3735d3 01/26/2012 12:45 pm Stefan Hajnoczi

block: check bdrv_in_use() before blockdev operations

Long-running block operations like block migration and image streaming
must have continual access to their block device. It is not safe to
perform operations like hotplug, eject, change, resize, commit, or...

92d48558 01/18/2012 02:23 pm Luiz Capitulino

block: eject_device(): Use error_set()

Also drops the leftover 'mon' argument.

This is a preparation for the next commits which will port the
eject and change commands to the QAPI.

Signed-off-by: Luiz Capitulino <>

c245b6a3 01/18/2012 02:23 pm Luiz Capitulino

qapi: Convert eject

Signed-off-by: Anthony Liguori <>
Signed-off-by: Luiz Capitulino <>

333a96ec 01/18/2012 02:23 pm Luiz Capitulino

qapi: Convert change

Signed-off-by: Anthony Liguori <>
Signed-off-by: Luiz Capitulino <>

80047da5 01/18/2012 02:23 pm Luiz Capitulino

qapi: Convert block_set_io_throttle

Signed-off-by: Luiz Capitulino <>

939a1cc3 01/18/2012 02:23 pm Stefan Hajnoczi

block: use proper qerrors in qmp_block_resize

Let's report specific errors so that management tools and users can
identify the problem.

Two new qerrors are needed: * QERR_DEVICE_HAS_NO_MEDIUM for ENOMEDIUM * QERR_DEVICE_IS_READ_ONLY for EACCES

Signed-off-by: Stefan Hajnoczi <>...

a4dea8a9 12/06/2011 03:40 pm Luiz Capitulino

qapi: Convert block_passwd

Signed-off-by: Anthony Liguori <>
Signed-off-by: Luiz Capitulino <>

5e7caacb 12/06/2011 03:40 pm Luiz Capitulino

qapi: Convert block_resize

Signed-off-by: Luiz Capitulino <>

6106e249 12/06/2011 03:40 pm Luiz Capitulino

qapi: Convert blockdev_snapshot_sync

Unfortunately, this conversion required an additional change.

In the old QMP command, the 'snapshot-file' argument is specified as
optional. The idea is to take the snapshot internally if 'snapshot-file'
is not passed. However, internal snapshots are not supported yet so...

922453bc 12/05/2011 03:56 pm Stefan Hajnoczi

block: convert qemu_aio_flush() calls to bdrv_drain_all()

Many places in QEMU call qemu_aio_flush() to complete all pending
asynchronous I/O. Most of these places actually want to drain all block
requests but there is no block layer API to do so.

This patch introduces the bdrv_drain_all() API to wait for requests...

fb0490f6 12/05/2011 03:51 pm Stefan Hajnoczi

block: add -drive copy-on-read=on|off

This patch adds the -drive copy-on-read=on|off command-line option:

copy-on-read=on|off
copy-on-read is "on" or "off" and enables whether to copy read backing
file sectors into the image file. Copy-on-read avoids accessing the...
0563e191 12/05/2011 03:51 pm Zhi Yong Wu

block: add the blockio limits command line support

Signed-off-by: Zhi Yong Wu <>
Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

727f005e 12/05/2011 03:51 pm Zhi Yong Wu

hmp/qmp: add block_set_io_throttle

Signed-off-by: Zhi Yong Wu <>
Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

025ccaa7 11/11/2011 03:02 pm Paolo Bonzini

block: add eject request callback

Recent versions of udev always keep the tray locked so that the kernel
can observe "eject request" events (aka tray button presses) even on
discs that aren't mounted. Add support for these events in the ATAPI
and SCSI cd drive device models....

25ad22bc 09/12/2011 04:17 pm Markus Armbruster

ide/atapi scsi-disk: Make monitor eject -f, then change work

change fails while the tray is locked by the guest. eject -f forces
it open and removes any media. Unfortunately, the tray closes again
instantly. Since the lock remains as it is, there is no way to insert...

2c6942fa 09/12/2011 04:17 pm Markus Armbruster

block: Clean up remaining users of "removable"

BlockDriverState member removable is a confused mess. It is true when
an ide-cd, scsi-cd or floppy qdev is attached, or when the
BlockDriverState was created with -drive if={floppy,sd} or -drive
if={ide,scsi,xen,none},media=cdrom ("created removable"), except when...

9e6a4c91 09/12/2011 04:17 pm Markus Armbruster

block: Drop BlockDriverState member removable

It's a confused mess (see previous commit). No users remain.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

f107639a 09/12/2011 04:17 pm Markus Armbruster

block: Drop medium lock tracking, ask device models instead

Requires new BlockDevOps member is_medium_locked(). Implement for IDE
and SCSI CD-ROMs.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

fa879d62 09/06/2011 12:23 pm Markus Armbruster

block: Attach non-qdev devices as well

For now, this just protects against programming errors like having the
same drive back multiple non-qdev devices, or untimely bdrv_delete().
Later commits will add other interesting uses.

While there, rename BlockDriverState member peer to dev, bdrv_attach()...

c3993cdc 08/23/2011 03:15 pm Stefan Hajnoczi

block: parse cache mode flags in a single place

This patch introduces bdrv_parse_cache_flags() which sets open flags
given a cache mode. Previously this was duplicated in blockdev.c and
qemu-img.c.

Signed-off-by: Stefan Hajnoczi <>...

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

ea8f942f 08/01/2011 01:09 pm Markus Armbruster

blockdev: Make eject fail for non-removable drives even with -f

Ejecting hard disk platters can only end in tears.

If you need to revoke access to an image, use drive_del, not eject -f.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

d967b2f1 07/21/2011 10:48 pm Jes Sorensen

QMP: add snapshot-blkdev-sync command

Add QMP bits for snapshot_blkdev command. This is the same as
snapshot_blkdev in the human monitor. The command is synchronous.

In the future async commands and or a break down of the functionality
into multiple commands might be added....

2d3999fe 07/05/2011 12:23 pm Luiz Capitulino

block: drive_init(): Simplify interface type setting

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

e7ff8f0e 07/05/2011 12:23 pm Luiz Capitulino

block: drive_init(): Improve CHS setting error message

The current message doesn't clearly communicate the error cause.

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

e4080f9b 06/24/2011 11:13 am Markus Armbruster

blockdev: Put space after comma in error message

Signed-off-by: Markus Armbruster <>
Signed-off-by: Stefan Hajnoczi <>

a6599793 06/08/2011 11:39 am Christoph Hellwig

block: clarify the meaning of BDRV_O_NOCACHE

Change BDRV_O_NOCACHE to only imply bypassing the host OS file cache,
but no writeback semantics. All existing callers are changed to also
specify BDRV_O_CACHE_WB to give them writeback semantics.

Signed-off-by: Christoph Hellwig <>...

8d278467 05/19/2011 11:26 am Markus Armbruster

block: Remove type hint, it's guest matter, doesn't belong here

No users of bdrv_get_type_hint() left. bdrv_set_type_hint() can make
the media removable by side effect. Make that explicit.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

95b5edcd 05/19/2011 11:26 am Markus Armbruster

blockdev: Store -drive option media in DriveInfo

DriveInfo is closely tied to -drive, and like -drive, it mixes
information about host and guest part of the block device. Unlike
DriveInfo, BlockDriverState should be about the host part only.

One of the remaining guest bits there is the "type hint". -drive...

d22b2f41 04/07/2011 02:51 pm Ryan Harper

Do not delete BlockDriverState when deleting the drive

When removing a drive from the host-side via drive_del we currently have
the following path:

drive_del
qemu_aio_flush()
bdrv_close() // zaps bs->drv, which makes any subsequent I/O get
// dropped. Works as designed...

29f82b37 04/04/2011 01:34 am Alexander Graf

virtio: use generic name when possible

We have two different virtio buses: pci and s390. The abstraction path
taken in qemu is to have generic aliases for each device type in the
architecture specific qdev devices.

So let's make use of these aliases whenever we can and define them...

52f9a172 03/15/2011 02:21 pm Jes Sorensen

Improve error handling in do_snapshot_blkdev()

In case we cannot open the newly created snapshot image, try to fall
back to the original image file and continue running on that, which
should prevent the guest from aborting.

This is a corner case which can happen if the admin by mistake...

2753d4a5 02/10/2011 02:24 pm Markus Armbruster

blockdev: Plug memory leak in drive_uninit()

Started leaking in commit 1dae12e6.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

a9ae2bff 02/10/2011 02:24 pm Markus Armbruster

blockdev: Plug memory leak in drive_init() error paths

Should have spotted this when doing commit 319ae529.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

84fb3925 02/07/2011 01:51 pm Marcelo Tosatti

blockdev: add refcount to DriveInfo

The host part of a block device can be deleted with in progress
block migration.

To fix this, add a reference count to DriveInfo, freeing resources
on last reference.

Signed-off-by: Marcelo Tosatti <>...

8591675f 02/07/2011 01:51 pm Marcelo Tosatti

block: enable in_use flag

Set block device in use during block migration, disallow drive_del and
bdrv_truncate for in use devices.

Signed-off-by: Marcelo Tosatti <>
Signed-off-by: Kevin Wolf <>

319ae529 01/31/2011 12:59 pm Markus Armbruster

blockdev: Fix drive_add for drives without media

Watch this:

(qemu) drive_add 0 if=none
(qemu) info block
none0: type=hd removable=0 [not inserted]
(qemu) drive_del none0
Segmentation fault (core dumped)

add_init_drive() is confused about drive_init()'s failure modes, and...