2013-05-25 05:09:44 +02:00
|
|
|
/*
|
|
|
|
* Block layer qmp and info dump related functions
|
|
|
|
*
|
|
|
|
* Copyright (c) 2003-2008 Fabrice Bellard
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2016-01-18 19:01:42 +01:00
|
|
|
#include "qemu/osdep.h"
|
2013-05-25 05:09:44 +02:00
|
|
|
#include "block/qapi.h"
|
|
|
|
#include "block/block_int.h"
|
2015-06-08 18:17:44 +02:00
|
|
|
#include "block/throttle-groups.h"
|
block: add event when disk usage exceeds threshold
Managing applications, like oVirt (http://www.ovirt.org), make extensive
use of thin-provisioned disk images.
To let the guest run smoothly and be not unnecessarily paused, oVirt sets
a disk usage threshold (so called 'high water mark') based on the occupation
of the device, and automatically extends the image once the threshold
is reached or exceeded.
In order to detect the crossing of the threshold, oVirt has no choice but
aggressively polling the QEMU monitor using the query-blockstats command.
This lead to unnecessary system load, and is made even worse under scale:
deployments with hundreds of VMs are no longer rare.
To fix this, this patch adds:
* A new monitor command `block-set-write-threshold', to set a mark for
a given block device.
* A new event `BLOCK_WRITE_THRESHOLD', to report if a block device
usage exceeds the threshold.
* A new `write_threshold' field into the `BlockDeviceInfo' structure,
to report the configured threshold.
This will allow the managing application to use smarter and more
efficient monitoring, greatly reducing the need of polling.
[Updated qemu-iotests 067 output to add the new 'write_threshold'
property. --Stefan]
[Changed g_assert_false() to !g_assert() to fix the build on older glib
versions. --Kevin]
Signed-off-by: Francesco Romani <fromani@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1421068273-692-1-git-send-email-fromani@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-01-12 14:11:13 +01:00
|
|
|
#include "block/write-threshold.h"
|
2013-05-25 05:09:44 +02:00
|
|
|
#include "qmp-commands.h"
|
2013-10-09 10:46:17 +02:00
|
|
|
#include "qapi-visit.h"
|
|
|
|
#include "qapi/qmp-output-visitor.h"
|
|
|
|
#include "qapi/qmp/types.h"
|
2014-10-07 13:59:23 +02:00
|
|
|
#include "sysemu/block-backend.h"
|
2013-05-25 05:09:44 +02:00
|
|
|
|
2015-04-17 13:52:43 +02:00
|
|
|
BlockDeviceInfo *bdrv_block_device_info(BlockDriverState *bs, Error **errp)
|
2014-01-23 21:31:34 +01:00
|
|
|
{
|
2015-04-17 13:52:43 +02:00
|
|
|
ImageInfo **p_image_info;
|
|
|
|
BlockDriverState *bs0;
|
2014-01-23 21:31:34 +01:00
|
|
|
BlockDeviceInfo *info = g_malloc0(sizeof(*info));
|
|
|
|
|
|
|
|
info->file = g_strdup(bs->filename);
|
|
|
|
info->ro = bs->read_only;
|
|
|
|
info->drv = g_strdup(bs->drv->format_name);
|
|
|
|
info->encrypted = bs->encrypted;
|
|
|
|
info->encryption_key_missing = bdrv_key_required(bs);
|
|
|
|
|
2014-05-22 13:28:45 +02:00
|
|
|
info->cache = g_new(BlockdevCacheInfo, 1);
|
|
|
|
*info->cache = (BlockdevCacheInfo) {
|
|
|
|
.writeback = bdrv_enable_write_cache(bs),
|
|
|
|
.direct = !!(bs->open_flags & BDRV_O_NOCACHE),
|
|
|
|
.no_flush = !!(bs->open_flags & BDRV_O_NO_FLUSH),
|
|
|
|
};
|
|
|
|
|
2014-01-23 21:31:34 +01:00
|
|
|
if (bs->node_name[0]) {
|
|
|
|
info->has_node_name = true;
|
|
|
|
info->node_name = g_strdup(bs->node_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bs->backing_file[0]) {
|
|
|
|
info->has_backing_file = true;
|
|
|
|
info->backing_file = g_strdup(bs->backing_file);
|
|
|
|
}
|
|
|
|
|
|
|
|
info->backing_file_depth = bdrv_get_backing_file_depth(bs);
|
2014-05-18 00:58:19 +02:00
|
|
|
info->detect_zeroes = bs->detect_zeroes;
|
2014-01-23 21:31:34 +01:00
|
|
|
|
2015-11-04 14:15:36 +01:00
|
|
|
if (bs->throttle_state) {
|
2014-01-23 21:31:34 +01:00
|
|
|
ThrottleConfig cfg;
|
2015-06-08 18:17:44 +02:00
|
|
|
|
|
|
|
throttle_group_get_config(bs, &cfg);
|
|
|
|
|
2014-01-23 21:31:34 +01:00
|
|
|
info->bps = cfg.buckets[THROTTLE_BPS_TOTAL].avg;
|
|
|
|
info->bps_rd = cfg.buckets[THROTTLE_BPS_READ].avg;
|
|
|
|
info->bps_wr = cfg.buckets[THROTTLE_BPS_WRITE].avg;
|
|
|
|
|
|
|
|
info->iops = cfg.buckets[THROTTLE_OPS_TOTAL].avg;
|
|
|
|
info->iops_rd = cfg.buckets[THROTTLE_OPS_READ].avg;
|
|
|
|
info->iops_wr = cfg.buckets[THROTTLE_OPS_WRITE].avg;
|
|
|
|
|
|
|
|
info->has_bps_max = cfg.buckets[THROTTLE_BPS_TOTAL].max;
|
|
|
|
info->bps_max = cfg.buckets[THROTTLE_BPS_TOTAL].max;
|
|
|
|
info->has_bps_rd_max = cfg.buckets[THROTTLE_BPS_READ].max;
|
|
|
|
info->bps_rd_max = cfg.buckets[THROTTLE_BPS_READ].max;
|
|
|
|
info->has_bps_wr_max = cfg.buckets[THROTTLE_BPS_WRITE].max;
|
|
|
|
info->bps_wr_max = cfg.buckets[THROTTLE_BPS_WRITE].max;
|
|
|
|
|
|
|
|
info->has_iops_max = cfg.buckets[THROTTLE_OPS_TOTAL].max;
|
|
|
|
info->iops_max = cfg.buckets[THROTTLE_OPS_TOTAL].max;
|
|
|
|
info->has_iops_rd_max = cfg.buckets[THROTTLE_OPS_READ].max;
|
|
|
|
info->iops_rd_max = cfg.buckets[THROTTLE_OPS_READ].max;
|
|
|
|
info->has_iops_wr_max = cfg.buckets[THROTTLE_OPS_WRITE].max;
|
|
|
|
info->iops_wr_max = cfg.buckets[THROTTLE_OPS_WRITE].max;
|
|
|
|
|
|
|
|
info->has_iops_size = cfg.op_size;
|
|
|
|
info->iops_size = cfg.op_size;
|
2015-06-08 18:17:46 +02:00
|
|
|
|
|
|
|
info->has_group = true;
|
|
|
|
info->group = g_strdup(throttle_group_get_name(bs));
|
2014-01-23 21:31:34 +01:00
|
|
|
}
|
|
|
|
|
block: add event when disk usage exceeds threshold
Managing applications, like oVirt (http://www.ovirt.org), make extensive
use of thin-provisioned disk images.
To let the guest run smoothly and be not unnecessarily paused, oVirt sets
a disk usage threshold (so called 'high water mark') based on the occupation
of the device, and automatically extends the image once the threshold
is reached or exceeded.
In order to detect the crossing of the threshold, oVirt has no choice but
aggressively polling the QEMU monitor using the query-blockstats command.
This lead to unnecessary system load, and is made even worse under scale:
deployments with hundreds of VMs are no longer rare.
To fix this, this patch adds:
* A new monitor command `block-set-write-threshold', to set a mark for
a given block device.
* A new event `BLOCK_WRITE_THRESHOLD', to report if a block device
usage exceeds the threshold.
* A new `write_threshold' field into the `BlockDeviceInfo' structure,
to report the configured threshold.
This will allow the managing application to use smarter and more
efficient monitoring, greatly reducing the need of polling.
[Updated qemu-iotests 067 output to add the new 'write_threshold'
property. --Stefan]
[Changed g_assert_false() to !g_assert() to fix the build on older glib
versions. --Kevin]
Signed-off-by: Francesco Romani <fromani@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1421068273-692-1-git-send-email-fromani@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-01-12 14:11:13 +01:00
|
|
|
info->write_threshold = bdrv_write_threshold_get(bs);
|
|
|
|
|
2015-04-17 13:52:43 +02:00
|
|
|
bs0 = bs;
|
|
|
|
p_image_info = &info->image;
|
|
|
|
while (1) {
|
|
|
|
Error *local_err = NULL;
|
|
|
|
bdrv_query_image_info(bs0, p_image_info, &local_err);
|
|
|
|
if (local_err) {
|
|
|
|
error_propagate(errp, local_err);
|
|
|
|
qapi_free_BlockDeviceInfo(info);
|
|
|
|
return NULL;
|
|
|
|
}
|
2015-06-17 14:55:21 +02:00
|
|
|
if (bs0->drv && bs0->backing) {
|
|
|
|
bs0 = bs0->backing->bs;
|
2015-04-17 13:52:43 +02:00
|
|
|
(*p_image_info)->has_backing_image = true;
|
|
|
|
p_image_info = &((*p_image_info)->backing_image);
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-23 21:31:34 +01:00
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2013-06-06 06:27:57 +02:00
|
|
|
/*
|
|
|
|
* Returns 0 on success, with *p_list either set to describe snapshot
|
|
|
|
* information, or NULL because there are no snapshots. Returns -errno on
|
|
|
|
* error, with *p_list untouched.
|
|
|
|
*/
|
|
|
|
int bdrv_query_snapshot_info_list(BlockDriverState *bs,
|
|
|
|
SnapshotInfoList **p_list,
|
|
|
|
Error **errp)
|
2013-05-25 05:09:44 +02:00
|
|
|
{
|
|
|
|
int i, sn_count;
|
|
|
|
QEMUSnapshotInfo *sn_tab = NULL;
|
2013-06-06 06:27:57 +02:00
|
|
|
SnapshotInfoList *info_list, *cur_item = NULL, *head = NULL;
|
|
|
|
SnapshotInfo *info;
|
|
|
|
|
2013-05-25 05:09:44 +02:00
|
|
|
sn_count = bdrv_snapshot_list(bs, &sn_tab);
|
2013-06-06 06:27:57 +02:00
|
|
|
if (sn_count < 0) {
|
|
|
|
const char *dev = bdrv_get_device_name(bs);
|
|
|
|
switch (sn_count) {
|
|
|
|
case -ENOMEDIUM:
|
|
|
|
error_setg(errp, "Device '%s' is not inserted", dev);
|
|
|
|
break;
|
|
|
|
case -ENOTSUP:
|
|
|
|
error_setg(errp,
|
|
|
|
"Device '%s' does not support internal snapshots",
|
|
|
|
dev);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error_setg_errno(errp, -sn_count,
|
|
|
|
"Can't list snapshots of device '%s'", dev);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return sn_count;
|
|
|
|
}
|
2013-05-25 05:09:44 +02:00
|
|
|
|
|
|
|
for (i = 0; i < sn_count; i++) {
|
2013-06-06 06:27:57 +02:00
|
|
|
info = g_new0(SnapshotInfo, 1);
|
|
|
|
info->id = g_strdup(sn_tab[i].id_str);
|
|
|
|
info->name = g_strdup(sn_tab[i].name);
|
|
|
|
info->vm_state_size = sn_tab[i].vm_state_size;
|
|
|
|
info->date_sec = sn_tab[i].date_sec;
|
|
|
|
info->date_nsec = sn_tab[i].date_nsec;
|
|
|
|
info->vm_clock_sec = sn_tab[i].vm_clock_nsec / 1000000000;
|
|
|
|
info->vm_clock_nsec = sn_tab[i].vm_clock_nsec % 1000000000;
|
2013-05-25 05:09:44 +02:00
|
|
|
|
2013-06-06 06:27:57 +02:00
|
|
|
info_list = g_new0(SnapshotInfoList, 1);
|
|
|
|
info_list->value = info;
|
2013-05-25 05:09:44 +02:00
|
|
|
|
|
|
|
/* XXX: waiting for the qapi to support qemu-queue.h types */
|
|
|
|
if (!cur_item) {
|
2013-06-06 06:27:57 +02:00
|
|
|
head = cur_item = info_list;
|
2013-05-25 05:09:44 +02:00
|
|
|
} else {
|
|
|
|
cur_item->next = info_list;
|
|
|
|
cur_item = info_list;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free(sn_tab);
|
2013-06-06 06:27:57 +02:00
|
|
|
*p_list = head;
|
|
|
|
return 0;
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|
|
|
|
|
2013-06-06 06:27:58 +02:00
|
|
|
/**
|
|
|
|
* bdrv_query_image_info:
|
|
|
|
* @bs: block device to examine
|
|
|
|
* @p_info: location to store image information
|
|
|
|
* @errp: location to store error information
|
|
|
|
*
|
2013-06-06 06:27:59 +02:00
|
|
|
* Store "flat" image information in @p_info.
|
|
|
|
*
|
|
|
|
* "Flat" means it does *not* query backing image information,
|
|
|
|
* i.e. (*pinfo)->has_backing_image will be set to false and
|
|
|
|
* (*pinfo)->backing_image to NULL even when the image does in fact have
|
|
|
|
* a backing image.
|
|
|
|
*
|
2013-06-06 06:27:58 +02:00
|
|
|
* @p_info will be set only on success. On error, store error in @errp.
|
|
|
|
*/
|
|
|
|
void bdrv_query_image_info(BlockDriverState *bs,
|
|
|
|
ImageInfo **p_info,
|
|
|
|
Error **errp)
|
2013-05-25 05:09:44 +02:00
|
|
|
{
|
2014-06-26 13:23:25 +02:00
|
|
|
int64_t size;
|
2013-06-06 06:27:58 +02:00
|
|
|
const char *backing_filename;
|
2013-05-25 05:09:44 +02:00
|
|
|
BlockDriverInfo bdi;
|
2013-06-06 06:27:58 +02:00
|
|
|
int ret;
|
|
|
|
Error *err = NULL;
|
2014-06-26 13:23:25 +02:00
|
|
|
ImageInfo *info;
|
2013-05-25 05:09:44 +02:00
|
|
|
|
2015-12-23 11:48:23 +01:00
|
|
|
aio_context_acquire(bdrv_get_aio_context(bs));
|
|
|
|
|
2014-06-26 13:23:25 +02:00
|
|
|
size = bdrv_getlength(bs);
|
|
|
|
if (size < 0) {
|
|
|
|
error_setg_errno(errp, -size, "Can't get size of device '%s'",
|
|
|
|
bdrv_get_device_name(bs));
|
2015-12-23 11:48:23 +01:00
|
|
|
goto out;
|
2014-06-26 13:23:25 +02:00
|
|
|
}
|
2013-05-25 05:09:44 +02:00
|
|
|
|
2014-06-26 13:23:25 +02:00
|
|
|
info = g_new0(ImageInfo, 1);
|
2013-06-06 06:27:58 +02:00
|
|
|
info->filename = g_strdup(bs->filename);
|
2013-05-25 05:09:44 +02:00
|
|
|
info->format = g_strdup(bdrv_get_format_name(bs));
|
2014-06-26 13:23:25 +02:00
|
|
|
info->virtual_size = size;
|
2013-05-25 05:09:44 +02:00
|
|
|
info->actual_size = bdrv_get_allocated_file_size(bs);
|
|
|
|
info->has_actual_size = info->actual_size >= 0;
|
|
|
|
if (bdrv_is_encrypted(bs)) {
|
|
|
|
info->encrypted = true;
|
|
|
|
info->has_encrypted = true;
|
|
|
|
}
|
|
|
|
if (bdrv_get_info(bs, &bdi) >= 0) {
|
|
|
|
if (bdi.cluster_size != 0) {
|
|
|
|
info->cluster_size = bdi.cluster_size;
|
|
|
|
info->has_cluster_size = true;
|
|
|
|
}
|
|
|
|
info->dirty_flag = bdi.is_dirty;
|
|
|
|
info->has_dirty_flag = true;
|
|
|
|
}
|
2013-10-09 10:46:16 +02:00
|
|
|
info->format_specific = bdrv_get_specific_info(bs);
|
|
|
|
info->has_format_specific = info->format_specific != NULL;
|
|
|
|
|
2013-06-06 06:27:58 +02:00
|
|
|
backing_filename = bs->backing_file;
|
2013-05-25 05:09:44 +02:00
|
|
|
if (backing_filename[0] != '\0') {
|
2015-01-22 14:03:30 +01:00
|
|
|
char *backing_filename2 = g_malloc0(PATH_MAX);
|
2013-05-25 05:09:44 +02:00
|
|
|
info->backing_filename = g_strdup(backing_filename);
|
|
|
|
info->has_backing_filename = true;
|
2015-01-22 14:03:30 +01:00
|
|
|
bdrv_get_full_backing_filename(bs, backing_filename2, PATH_MAX, &err);
|
2014-11-26 17:20:26 +01:00
|
|
|
if (err) {
|
2015-12-14 20:55:16 +01:00
|
|
|
/* Can't reconstruct the full backing filename, so we must omit
|
|
|
|
* this field and apply a Best Effort to this query. */
|
2015-01-22 14:03:27 +01:00
|
|
|
g_free(backing_filename2);
|
2015-12-14 20:55:16 +01:00
|
|
|
backing_filename2 = NULL;
|
|
|
|
error_free(err);
|
2015-12-22 11:11:47 +01:00
|
|
|
err = NULL;
|
2014-11-26 17:20:26 +01:00
|
|
|
}
|
2013-05-25 05:09:44 +02:00
|
|
|
|
2015-12-14 20:55:13 +01:00
|
|
|
/* Always report the full_backing_filename if present, even if it's the
|
|
|
|
* same as backing_filename. That they are same is useful info. */
|
|
|
|
if (backing_filename2) {
|
|
|
|
info->full_backing_filename = g_strdup(backing_filename2);
|
2013-05-25 05:09:44 +02:00
|
|
|
info->has_full_backing_filename = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bs->backing_format[0]) {
|
|
|
|
info->backing_filename_format = g_strdup(bs->backing_format);
|
|
|
|
info->has_backing_filename_format = true;
|
|
|
|
}
|
2015-01-22 14:03:27 +01:00
|
|
|
g_free(backing_filename2);
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|
2013-06-06 06:27:58 +02:00
|
|
|
|
|
|
|
ret = bdrv_query_snapshot_info_list(bs, &info->snapshots, &err);
|
|
|
|
switch (ret) {
|
|
|
|
case 0:
|
|
|
|
if (info->snapshots) {
|
|
|
|
info->has_snapshots = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
/* recoverable error */
|
|
|
|
case -ENOMEDIUM:
|
|
|
|
case -ENOTSUP:
|
|
|
|
error_free(err);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error_propagate(errp, err);
|
|
|
|
qapi_free_ImageInfo(info);
|
2015-12-23 11:48:23 +01:00
|
|
|
goto out;
|
2013-06-06 06:27:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
*p_info = info;
|
2015-12-23 11:48:23 +01:00
|
|
|
|
|
|
|
out:
|
|
|
|
aio_context_release(bdrv_get_aio_context(bs));
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|
|
|
|
|
2013-06-06 06:27:59 +02:00
|
|
|
/* @p_info will be set only on success. */
|
2014-10-07 13:59:23 +02:00
|
|
|
static void bdrv_query_info(BlockBackend *blk, BlockInfo **p_info,
|
|
|
|
Error **errp)
|
2013-05-25 05:09:44 +02:00
|
|
|
{
|
|
|
|
BlockInfo *info = g_malloc0(sizeof(*info));
|
2014-10-07 13:59:23 +02:00
|
|
|
BlockDriverState *bs = blk_bs(blk);
|
|
|
|
info->device = g_strdup(blk_name(blk));
|
2013-05-25 05:09:44 +02:00
|
|
|
info->type = g_strdup("unknown");
|
2014-10-07 13:59:25 +02:00
|
|
|
info->locked = blk_dev_is_medium_locked(blk);
|
|
|
|
info->removable = blk_dev_has_removable_media(blk);
|
2013-05-25 05:09:44 +02:00
|
|
|
|
2016-01-29 20:49:13 +01:00
|
|
|
if (blk_dev_has_tray(blk)) {
|
2013-05-25 05:09:44 +02:00
|
|
|
info->has_tray_open = true;
|
2014-10-07 13:59:25 +02:00
|
|
|
info->tray_open = blk_dev_is_tray_open(blk);
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|
|
|
|
|
2015-10-19 17:53:22 +02:00
|
|
|
if (blk_iostatus_is_enabled(blk)) {
|
2013-05-25 05:09:44 +02:00
|
|
|
info->has_io_status = true;
|
2015-10-19 17:53:22 +02:00
|
|
|
info->io_status = blk_iostatus(blk);
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|
|
|
|
|
2015-10-19 17:53:29 +02:00
|
|
|
if (bs && !QLIST_EMPTY(&bs->dirty_bitmaps)) {
|
2013-11-13 11:29:44 +01:00
|
|
|
info->has_dirty_bitmaps = true;
|
|
|
|
info->dirty_bitmaps = bdrv_query_dirty_bitmaps(bs);
|
|
|
|
}
|
|
|
|
|
2015-10-19 17:53:29 +02:00
|
|
|
if (bs && bs->drv) {
|
2013-05-25 05:09:44 +02:00
|
|
|
info->has_inserted = true;
|
2015-04-17 13:52:43 +02:00
|
|
|
info->inserted = bdrv_block_device_info(bs, errp);
|
|
|
|
if (info->inserted == NULL) {
|
|
|
|
goto err;
|
2013-06-06 06:27:59 +02:00
|
|
|
}
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|
2013-06-06 06:27:59 +02:00
|
|
|
|
|
|
|
*p_info = info;
|
|
|
|
return;
|
|
|
|
|
|
|
|
err:
|
|
|
|
qapi_free_BlockInfo(info);
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|
|
|
|
|
2014-10-31 04:32:57 +01:00
|
|
|
static BlockStats *bdrv_query_stats(const BlockDriverState *bs,
|
|
|
|
bool query_backing)
|
2013-05-25 05:09:44 +02:00
|
|
|
{
|
|
|
|
BlockStats *s;
|
|
|
|
|
|
|
|
s = g_malloc0(sizeof(*s));
|
|
|
|
|
2014-10-07 13:59:11 +02:00
|
|
|
if (bdrv_get_device_name(bs)[0]) {
|
2013-05-25 05:09:44 +02:00
|
|
|
s->has_device = true;
|
2014-10-07 13:59:11 +02:00
|
|
|
s->device = g_strdup(bdrv_get_device_name(bs));
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|
|
|
|
|
2014-10-31 04:32:56 +01:00
|
|
|
if (bdrv_get_node_name(bs)[0]) {
|
|
|
|
s->has_node_name = true;
|
|
|
|
s->node_name = g_strdup(bdrv_get_node_name(bs));
|
|
|
|
}
|
|
|
|
|
2013-05-25 05:09:44 +02:00
|
|
|
s->stats = g_malloc0(sizeof(*s->stats));
|
2015-10-19 17:53:21 +02:00
|
|
|
if (bs->blk) {
|
|
|
|
BlockAcctStats *stats = blk_get_stats(bs->blk);
|
2015-10-28 16:33:05 +01:00
|
|
|
BlockAcctTimedStats *ts = NULL;
|
2015-10-19 17:53:21 +02:00
|
|
|
|
|
|
|
s->stats->rd_bytes = stats->nr_bytes[BLOCK_ACCT_READ];
|
|
|
|
s->stats->wr_bytes = stats->nr_bytes[BLOCK_ACCT_WRITE];
|
|
|
|
s->stats->rd_operations = stats->nr_ops[BLOCK_ACCT_READ];
|
|
|
|
s->stats->wr_operations = stats->nr_ops[BLOCK_ACCT_WRITE];
|
2015-10-28 16:33:03 +01:00
|
|
|
|
|
|
|
s->stats->failed_rd_operations = stats->failed_ops[BLOCK_ACCT_READ];
|
|
|
|
s->stats->failed_wr_operations = stats->failed_ops[BLOCK_ACCT_WRITE];
|
|
|
|
s->stats->failed_flush_operations = stats->failed_ops[BLOCK_ACCT_FLUSH];
|
|
|
|
|
|
|
|
s->stats->invalid_rd_operations = stats->invalid_ops[BLOCK_ACCT_READ];
|
|
|
|
s->stats->invalid_wr_operations = stats->invalid_ops[BLOCK_ACCT_WRITE];
|
|
|
|
s->stats->invalid_flush_operations =
|
|
|
|
stats->invalid_ops[BLOCK_ACCT_FLUSH];
|
|
|
|
|
2015-10-19 17:53:21 +02:00
|
|
|
s->stats->rd_merged = stats->merged[BLOCK_ACCT_READ];
|
|
|
|
s->stats->wr_merged = stats->merged[BLOCK_ACCT_WRITE];
|
|
|
|
s->stats->flush_operations = stats->nr_ops[BLOCK_ACCT_FLUSH];
|
|
|
|
s->stats->wr_total_time_ns = stats->total_time_ns[BLOCK_ACCT_WRITE];
|
|
|
|
s->stats->rd_total_time_ns = stats->total_time_ns[BLOCK_ACCT_READ];
|
|
|
|
s->stats->flush_total_time_ns = stats->total_time_ns[BLOCK_ACCT_FLUSH];
|
2015-10-28 16:33:02 +01:00
|
|
|
|
|
|
|
s->stats->has_idle_time_ns = stats->last_access_time_ns > 0;
|
|
|
|
if (s->stats->has_idle_time_ns) {
|
|
|
|
s->stats->idle_time_ns = block_acct_idle_time_ns(stats);
|
|
|
|
}
|
2015-10-28 16:33:04 +01:00
|
|
|
|
|
|
|
s->stats->account_invalid = stats->account_invalid;
|
|
|
|
s->stats->account_failed = stats->account_failed;
|
2015-10-28 16:33:05 +01:00
|
|
|
|
|
|
|
while ((ts = block_acct_interval_next(stats, ts))) {
|
|
|
|
BlockDeviceTimedStatsList *timed_stats =
|
|
|
|
g_malloc0(sizeof(*timed_stats));
|
|
|
|
BlockDeviceTimedStats *dev_stats = g_malloc0(sizeof(*dev_stats));
|
|
|
|
timed_stats->next = s->stats->timed_stats;
|
|
|
|
timed_stats->value = dev_stats;
|
|
|
|
s->stats->timed_stats = timed_stats;
|
|
|
|
|
|
|
|
TimedAverage *rd = &ts->latency[BLOCK_ACCT_READ];
|
|
|
|
TimedAverage *wr = &ts->latency[BLOCK_ACCT_WRITE];
|
|
|
|
TimedAverage *fl = &ts->latency[BLOCK_ACCT_FLUSH];
|
|
|
|
|
|
|
|
dev_stats->interval_length = ts->interval_length;
|
|
|
|
|
|
|
|
dev_stats->min_rd_latency_ns = timed_average_min(rd);
|
|
|
|
dev_stats->max_rd_latency_ns = timed_average_max(rd);
|
|
|
|
dev_stats->avg_rd_latency_ns = timed_average_avg(rd);
|
|
|
|
|
|
|
|
dev_stats->min_wr_latency_ns = timed_average_min(wr);
|
|
|
|
dev_stats->max_wr_latency_ns = timed_average_max(wr);
|
|
|
|
dev_stats->avg_wr_latency_ns = timed_average_avg(wr);
|
|
|
|
|
|
|
|
dev_stats->min_flush_latency_ns = timed_average_min(fl);
|
|
|
|
dev_stats->max_flush_latency_ns = timed_average_max(fl);
|
|
|
|
dev_stats->avg_flush_latency_ns = timed_average_avg(fl);
|
2015-10-28 16:33:06 +01:00
|
|
|
|
|
|
|
dev_stats->avg_rd_queue_depth =
|
|
|
|
block_acct_queue_depth(ts, BLOCK_ACCT_READ);
|
|
|
|
dev_stats->avg_wr_queue_depth =
|
|
|
|
block_acct_queue_depth(ts, BLOCK_ACCT_WRITE);
|
2015-10-28 16:33:05 +01:00
|
|
|
}
|
2015-10-19 17:53:21 +02:00
|
|
|
}
|
2013-05-25 05:09:44 +02:00
|
|
|
|
2015-10-19 17:53:20 +02:00
|
|
|
s->stats->wr_highest_offset = bs->wr_highest_offset;
|
|
|
|
|
2013-05-25 05:09:44 +02:00
|
|
|
if (bs->file) {
|
|
|
|
s->has_parent = true;
|
2015-06-16 14:19:22 +02:00
|
|
|
s->parent = bdrv_query_stats(bs->file->bs, query_backing);
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|
|
|
|
|
2015-06-17 14:55:21 +02:00
|
|
|
if (query_backing && bs->backing) {
|
2014-01-23 03:03:26 +01:00
|
|
|
s->has_backing = true;
|
2015-06-17 14:55:21 +02:00
|
|
|
s->backing = bdrv_query_stats(bs->backing->bs, query_backing);
|
2014-01-23 03:03:26 +01:00
|
|
|
}
|
|
|
|
|
2013-05-25 05:09:44 +02:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
BlockInfoList *qmp_query_block(Error **errp)
|
|
|
|
{
|
|
|
|
BlockInfoList *head = NULL, **p_next = &head;
|
2014-10-07 13:59:23 +02:00
|
|
|
BlockBackend *blk;
|
2013-06-06 06:27:59 +02:00
|
|
|
Error *local_err = NULL;
|
2013-05-25 05:09:44 +02:00
|
|
|
|
2014-10-07 13:59:23 +02:00
|
|
|
for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
|
2013-05-25 05:09:44 +02:00
|
|
|
BlockInfoList *info = g_malloc0(sizeof(*info));
|
2014-10-07 13:59:23 +02:00
|
|
|
bdrv_query_info(blk, &info->value, &local_err);
|
2014-01-30 15:07:28 +01:00
|
|
|
if (local_err) {
|
2013-06-06 06:27:59 +02:00
|
|
|
error_propagate(errp, local_err);
|
2015-11-20 13:53:35 +01:00
|
|
|
g_free(info);
|
|
|
|
qapi_free_BlockInfoList(head);
|
|
|
|
return NULL;
|
2013-06-06 06:27:59 +02:00
|
|
|
}
|
2013-05-25 05:09:44 +02:00
|
|
|
|
|
|
|
*p_next = info;
|
|
|
|
p_next = &info->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return head;
|
|
|
|
}
|
|
|
|
|
2014-10-31 04:32:57 +01:00
|
|
|
BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
|
|
|
|
bool query_nodes,
|
|
|
|
Error **errp)
|
2013-05-25 05:09:44 +02:00
|
|
|
{
|
|
|
|
BlockStatsList *head = NULL, **p_next = &head;
|
|
|
|
BlockDriverState *bs = NULL;
|
|
|
|
|
2014-10-31 04:32:57 +01:00
|
|
|
/* Just to be safe if query_nodes is not always initialized */
|
|
|
|
query_nodes = has_query_nodes && query_nodes;
|
|
|
|
|
|
|
|
while ((bs = query_nodes ? bdrv_next_node(bs) : bdrv_next(bs))) {
|
2013-05-25 05:09:44 +02:00
|
|
|
BlockStatsList *info = g_malloc0(sizeof(*info));
|
2014-06-17 08:32:05 +02:00
|
|
|
AioContext *ctx = bdrv_get_aio_context(bs);
|
|
|
|
|
|
|
|
aio_context_acquire(ctx);
|
2014-10-31 04:32:57 +01:00
|
|
|
info->value = bdrv_query_stats(bs, !query_nodes);
|
2014-06-17 08:32:05 +02:00
|
|
|
aio_context_release(ctx);
|
2013-05-25 05:09:44 +02:00
|
|
|
|
|
|
|
*p_next = info;
|
|
|
|
p_next = &info->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return head;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define NB_SUFFIXES 4
|
|
|
|
|
|
|
|
static char *get_human_readable_size(char *buf, int buf_size, int64_t size)
|
|
|
|
{
|
2015-03-07 23:16:21 +01:00
|
|
|
static const char suffixes[NB_SUFFIXES] = {'K', 'M', 'G', 'T'};
|
2013-05-25 05:09:44 +02:00
|
|
|
int64_t base;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (size <= 999) {
|
|
|
|
snprintf(buf, buf_size, "%" PRId64, size);
|
|
|
|
} else {
|
|
|
|
base = 1024;
|
|
|
|
for (i = 0; i < NB_SUFFIXES; i++) {
|
|
|
|
if (size < (10 * base)) {
|
|
|
|
snprintf(buf, buf_size, "%0.1f%c",
|
|
|
|
(double)size / base,
|
|
|
|
suffixes[i]);
|
|
|
|
break;
|
|
|
|
} else if (size < (1000 * base) || i == (NB_SUFFIXES - 1)) {
|
|
|
|
snprintf(buf, buf_size, "%" PRId64 "%c",
|
|
|
|
((size + (base >> 1)) / base),
|
|
|
|
suffixes[i]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
base = base * 1024;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
2013-05-25 05:09:45 +02:00
|
|
|
void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f,
|
|
|
|
QEMUSnapshotInfo *sn)
|
2013-05-25 05:09:44 +02:00
|
|
|
{
|
|
|
|
char buf1[128], date_buf[128], clock_buf[128];
|
|
|
|
struct tm tm;
|
|
|
|
time_t ti;
|
|
|
|
int64_t secs;
|
|
|
|
|
|
|
|
if (!sn) {
|
2013-05-25 05:09:45 +02:00
|
|
|
func_fprintf(f,
|
|
|
|
"%-10s%-20s%7s%20s%15s",
|
|
|
|
"ID", "TAG", "VM SIZE", "DATE", "VM CLOCK");
|
2013-05-25 05:09:44 +02:00
|
|
|
} else {
|
|
|
|
ti = sn->date_sec;
|
|
|
|
localtime_r(&ti, &tm);
|
|
|
|
strftime(date_buf, sizeof(date_buf),
|
|
|
|
"%Y-%m-%d %H:%M:%S", &tm);
|
|
|
|
secs = sn->vm_clock_nsec / 1000000000;
|
|
|
|
snprintf(clock_buf, sizeof(clock_buf),
|
|
|
|
"%02d:%02d:%02d.%03d",
|
|
|
|
(int)(secs / 3600),
|
|
|
|
(int)((secs / 60) % 60),
|
|
|
|
(int)(secs % 60),
|
|
|
|
(int)((sn->vm_clock_nsec / 1000000) % 1000));
|
2013-05-25 05:09:45 +02:00
|
|
|
func_fprintf(f,
|
|
|
|
"%-10s%-20s%7s%20s%15s",
|
|
|
|
sn->id_str, sn->name,
|
|
|
|
get_human_readable_size(buf1, sizeof(buf1),
|
|
|
|
sn->vm_state_size),
|
|
|
|
date_buf,
|
|
|
|
clock_buf);
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 10:46:17 +02:00
|
|
|
static void dump_qdict(fprintf_function func_fprintf, void *f, int indentation,
|
|
|
|
QDict *dict);
|
|
|
|
static void dump_qlist(fprintf_function func_fprintf, void *f, int indentation,
|
|
|
|
QList *list);
|
|
|
|
|
|
|
|
static void dump_qobject(fprintf_function func_fprintf, void *f,
|
|
|
|
int comp_indent, QObject *obj)
|
|
|
|
{
|
|
|
|
switch (qobject_type(obj)) {
|
|
|
|
case QTYPE_QINT: {
|
|
|
|
QInt *value = qobject_to_qint(obj);
|
|
|
|
func_fprintf(f, "%" PRId64, qint_get_int(value));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case QTYPE_QSTRING: {
|
|
|
|
QString *value = qobject_to_qstring(obj);
|
|
|
|
func_fprintf(f, "%s", qstring_get_str(value));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case QTYPE_QDICT: {
|
|
|
|
QDict *value = qobject_to_qdict(obj);
|
|
|
|
dump_qdict(func_fprintf, f, comp_indent, value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case QTYPE_QLIST: {
|
|
|
|
QList *value = qobject_to_qlist(obj);
|
|
|
|
dump_qlist(func_fprintf, f, comp_indent, value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case QTYPE_QFLOAT: {
|
|
|
|
QFloat *value = qobject_to_qfloat(obj);
|
|
|
|
func_fprintf(f, "%g", qfloat_get_double(value));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case QTYPE_QBOOL: {
|
|
|
|
QBool *value = qobject_to_qbool(obj);
|
2015-05-16 00:24:59 +02:00
|
|
|
func_fprintf(f, "%s", qbool_get_bool(value) ? "true" : "false");
|
2013-10-09 10:46:17 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dump_qlist(fprintf_function func_fprintf, void *f, int indentation,
|
|
|
|
QList *list)
|
|
|
|
{
|
|
|
|
const QListEntry *entry;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
for (entry = qlist_first(list); entry; entry = qlist_next(entry), i++) {
|
2015-12-02 06:20:46 +01:00
|
|
|
QType type = qobject_type(entry->value);
|
2013-10-09 10:46:17 +02:00
|
|
|
bool composite = (type == QTYPE_QDICT || type == QTYPE_QLIST);
|
|
|
|
const char *format = composite ? "%*s[%i]:\n" : "%*s[%i]: ";
|
|
|
|
|
|
|
|
func_fprintf(f, format, indentation * 4, "", i);
|
|
|
|
dump_qobject(func_fprintf, f, indentation + 1, entry->value);
|
|
|
|
if (!composite) {
|
|
|
|
func_fprintf(f, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dump_qdict(fprintf_function func_fprintf, void *f, int indentation,
|
|
|
|
QDict *dict)
|
|
|
|
{
|
|
|
|
const QDictEntry *entry;
|
|
|
|
|
|
|
|
for (entry = qdict_first(dict); entry; entry = qdict_next(dict, entry)) {
|
2015-12-02 06:20:46 +01:00
|
|
|
QType type = qobject_type(entry->value);
|
2013-10-09 10:46:17 +02:00
|
|
|
bool composite = (type == QTYPE_QDICT || type == QTYPE_QLIST);
|
|
|
|
const char *format = composite ? "%*s%s:\n" : "%*s%s: ";
|
|
|
|
char key[strlen(entry->key) + 1];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* replace dashes with spaces in key (variable) names */
|
|
|
|
for (i = 0; entry->key[i]; i++) {
|
|
|
|
key[i] = entry->key[i] == '-' ? ' ' : entry->key[i];
|
|
|
|
}
|
|
|
|
key[i] = 0;
|
|
|
|
|
|
|
|
func_fprintf(f, format, indentation * 4, "", key);
|
|
|
|
dump_qobject(func_fprintf, f, indentation + 1, entry->value);
|
|
|
|
if (!composite) {
|
|
|
|
func_fprintf(f, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f,
|
|
|
|
ImageInfoSpecific *info_spec)
|
|
|
|
{
|
|
|
|
QmpOutputVisitor *ov = qmp_output_visitor_new();
|
|
|
|
QObject *obj, *data;
|
|
|
|
|
|
|
|
visit_type_ImageInfoSpecific(qmp_output_get_visitor(ov), &info_spec, NULL,
|
2014-04-29 18:32:25 +02:00
|
|
|
&error_abort);
|
2013-10-09 10:46:17 +02:00
|
|
|
obj = qmp_output_get_qobject(ov);
|
|
|
|
assert(qobject_type(obj) == QTYPE_QDICT);
|
|
|
|
data = qdict_get(qobject_to_qdict(obj), "data");
|
|
|
|
dump_qobject(func_fprintf, f, 1, data);
|
|
|
|
qmp_output_visitor_cleanup(ov);
|
|
|
|
}
|
|
|
|
|
2013-05-25 05:09:45 +02:00
|
|
|
void bdrv_image_info_dump(fprintf_function func_fprintf, void *f,
|
|
|
|
ImageInfo *info)
|
2013-05-25 05:09:44 +02:00
|
|
|
{
|
|
|
|
char size_buf[128], dsize_buf[128];
|
|
|
|
if (!info->has_actual_size) {
|
|
|
|
snprintf(dsize_buf, sizeof(dsize_buf), "unavailable");
|
|
|
|
} else {
|
|
|
|
get_human_readable_size(dsize_buf, sizeof(dsize_buf),
|
|
|
|
info->actual_size);
|
|
|
|
}
|
|
|
|
get_human_readable_size(size_buf, sizeof(size_buf), info->virtual_size);
|
2013-05-25 05:09:45 +02:00
|
|
|
func_fprintf(f,
|
|
|
|
"image: %s\n"
|
|
|
|
"file format: %s\n"
|
|
|
|
"virtual size: %s (%" PRId64 " bytes)\n"
|
|
|
|
"disk size: %s\n",
|
|
|
|
info->filename, info->format, size_buf,
|
|
|
|
info->virtual_size,
|
|
|
|
dsize_buf);
|
2013-05-25 05:09:44 +02:00
|
|
|
|
|
|
|
if (info->has_encrypted && info->encrypted) {
|
2013-05-25 05:09:45 +02:00
|
|
|
func_fprintf(f, "encrypted: yes\n");
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (info->has_cluster_size) {
|
2013-05-25 05:09:45 +02:00
|
|
|
func_fprintf(f, "cluster_size: %" PRId64 "\n",
|
|
|
|
info->cluster_size);
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (info->has_dirty_flag && info->dirty_flag) {
|
2013-05-25 05:09:45 +02:00
|
|
|
func_fprintf(f, "cleanly shut down: no\n");
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (info->has_backing_filename) {
|
2013-05-25 05:09:45 +02:00
|
|
|
func_fprintf(f, "backing file: %s", info->backing_filename);
|
2015-12-14 20:55:14 +01:00
|
|
|
if (!info->has_full_backing_filename) {
|
|
|
|
func_fprintf(f, " (cannot determine actual path)");
|
|
|
|
} else if (strcmp(info->backing_filename,
|
|
|
|
info->full_backing_filename) != 0) {
|
2013-05-25 05:09:45 +02:00
|
|
|
func_fprintf(f, " (actual path: %s)", info->full_backing_filename);
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|
2013-05-25 05:09:45 +02:00
|
|
|
func_fprintf(f, "\n");
|
2013-05-25 05:09:44 +02:00
|
|
|
if (info->has_backing_filename_format) {
|
2013-05-25 05:09:45 +02:00
|
|
|
func_fprintf(f, "backing file format: %s\n",
|
|
|
|
info->backing_filename_format);
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (info->has_snapshots) {
|
|
|
|
SnapshotInfoList *elem;
|
|
|
|
|
2013-05-25 05:09:45 +02:00
|
|
|
func_fprintf(f, "Snapshot list:\n");
|
|
|
|
bdrv_snapshot_dump(func_fprintf, f, NULL);
|
|
|
|
func_fprintf(f, "\n");
|
2013-05-25 05:09:44 +02:00
|
|
|
|
|
|
|
/* Ideally bdrv_snapshot_dump() would operate on SnapshotInfoList but
|
|
|
|
* we convert to the block layer's native QEMUSnapshotInfo for now.
|
|
|
|
*/
|
|
|
|
for (elem = info->snapshots; elem; elem = elem->next) {
|
|
|
|
QEMUSnapshotInfo sn = {
|
|
|
|
.vm_state_size = elem->value->vm_state_size,
|
|
|
|
.date_sec = elem->value->date_sec,
|
|
|
|
.date_nsec = elem->value->date_nsec,
|
|
|
|
.vm_clock_nsec = elem->value->vm_clock_sec * 1000000000ULL +
|
|
|
|
elem->value->vm_clock_nsec,
|
|
|
|
};
|
|
|
|
|
|
|
|
pstrcpy(sn.id_str, sizeof(sn.id_str), elem->value->id);
|
|
|
|
pstrcpy(sn.name, sizeof(sn.name), elem->value->name);
|
2013-05-25 05:09:45 +02:00
|
|
|
bdrv_snapshot_dump(func_fprintf, f, &sn);
|
|
|
|
func_fprintf(f, "\n");
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|
|
|
|
}
|
2013-10-09 10:46:17 +02:00
|
|
|
|
|
|
|
if (info->has_format_specific) {
|
|
|
|
func_fprintf(f, "Format specific information:\n");
|
|
|
|
bdrv_image_info_specific_dump(func_fprintf, f, info->format_specific);
|
|
|
|
}
|
2013-05-25 05:09:44 +02:00
|
|
|
}
|