Skip to content

Commit

Permalink
block migration: Fix test for read-only drive
Browse files Browse the repository at this point in the history
init_blk_migration_it() skips drives with type hint BDRV_TYPE_CDROM.
The intention is to skip read-only drives.  However, BDRV_TYPE_CDROM
is only a hint.  It is currently sufficent for read-only.  But it's
not necessary, and it may not remain sufficient.

Use bdrv_is_read_only() instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
Markus Armbruster authored and kevmw committed Jul 6, 2010
1 parent 528f766 commit d246673
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion block-migration.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ static void init_blk_migration_it(void *opaque, BlockDriverState *bs)
BlkMigDevState *bmds;
int64_t sectors;

if (bs->type == BDRV_TYPE_HD) {
if (!bdrv_is_read_only(bs)) {
sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
if (sectors == 0) {
return;
Expand Down

0 comments on commit d246673

Please sign in to comment.