diff mbox

[v2,02/13] block migration: Fix test for read-only drive

Message ID 1278418136-24556-3-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster July 6, 2010, 12:08 p.m. UTC
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>
---
 block-migration.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Christoph Hellwig July 7, 2010, 1:19 a.m. UTC | #1
Ok,


Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox

Patch

diff --git a/block-migration.c b/block-migration.c
index 7d04d6d..7337349 100644
--- a/block-migration.c
+++ b/block-migration.c
@@ -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;