aboutsummaryrefslogtreecommitdiff
path: root/block-migration.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2009-11-30 18:21:21 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 10:48:53 -0600
commit25f236433f5c791edce74228201254a1cc84f9a3 (patch)
tree82fa82e8c58c5ec8958fd1f891ec91e3b8a50eaf /block-migration.c
parent7184049ee6f51e84ed36b9c864850e82a255c31a (diff)
downloadqemu-25f236433f5c791edce74228201254a1cc84f9a3.zip
qemu-25f236433f5c791edce74228201254a1cc84f9a3.tar.gz
qemu-25f236433f5c791edce74228201254a1cc84f9a3.tar.bz2
block migration: Report progress also via info migration
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'block-migration.c')
-rw-r--r--block-migration.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/block-migration.c b/block-migration.c
index 22d10f0..7510923 100644
--- a/block-migration.c
+++ b/block-migration.c
@@ -91,6 +91,38 @@ static void blk_send(QEMUFile *f, BlkMigBlock * blk)
qemu_put_buffer(f, blk->buf, BLOCK_SIZE);
}
+int blk_mig_active(void)
+{
+ return !QSIMPLEQ_EMPTY(&block_mig_state.bmds_list);
+}
+
+uint64_t blk_mig_bytes_transferred(void)
+{
+ BlkMigDevState *bmds;
+ uint64_t sum = 0;
+
+ QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
+ sum += bmds->completed_sectors;
+ }
+ return sum << BDRV_SECTOR_BITS;
+}
+
+uint64_t blk_mig_bytes_remaining(void)
+{
+ return blk_mig_bytes_total() - blk_mig_bytes_transferred();
+}
+
+uint64_t blk_mig_bytes_total(void)
+{
+ BlkMigDevState *bmds;
+ uint64_t sum = 0;
+
+ QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
+ sum += bmds->total_sectors;
+ }
+ return sum << BDRV_SECTOR_BITS;
+}
+
static void blk_mig_read_cb(void *opaque, int ret)
{
BlkMigBlock *blk = opaque;