diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-04-12 14:00:59 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-05-10 10:32:11 +0200 |
commit | e86fe18ac945a121a548347c48f2397d7a2e5be5 (patch) | |
tree | 7fdc8aa7d740d2958a9fb6f9ba6f64c626138941 /blockdev.c | |
parent | 31155b9b3ca87fca11e42fa0802cca1abe710754 (diff) |
block: fail live snapshot if disk has no medium
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r-- | blockdev.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/blockdev.c b/blockdev.c index d25ffea926..67895b25d5 100644 --- a/blockdev.c +++ b/blockdev.c @@ -756,14 +756,17 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp) goto delete_and_fail; } + if (!bdrv_is_inserted(states->old_bs)) { + error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); + goto delete_and_fail; + } + if (bdrv_in_use(states->old_bs)) { error_set(errp, QERR_DEVICE_IN_USE, device); goto delete_and_fail; } - if (!bdrv_is_read_only(states->old_bs) && - bdrv_is_inserted(states->old_bs)) { - + if (!bdrv_is_read_only(states->old_bs)) { if (bdrv_flush(states->old_bs)) { error_set(errp, QERR_IO_ERROR); goto delete_and_fail; |