230
bool drive_check_orphaned(void)
231
void drive_check_orphaned(void)
232
233
BlockBackend *blk;
233
234
DriveInfo *dinfo;
236
bool orphans = false;
236
238
for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
237
239
dinfo = blk_legacy_dinfo(blk);
238
/* If dinfo->bdrv->dev is NULL, it has no device attached. */
239
/* Unless this is a default drive, this may be an oversight. */
240
240
if (!blk_get_attached_dev(blk) && !dinfo->is_default &&
241
241
dinfo->type != IF_NONE) {
242
fprintf(stderr, "Warning: Orphaned drive without device: "
243
"id=%s,file=%s,if=%s,bus=%d,unit=%d\n",
244
blk_name(blk), blk_bs(blk) ? blk_bs(blk)->filename : "",
245
if_name[dinfo->type], dinfo->bus, dinfo->unit);
243
qemu_opts_loc_restore(dinfo->opts);
244
error_report("machine type does not support"
245
" if=%s,bus=%d,unit=%d",
246
if_name[dinfo->type], dinfo->bus, dinfo->unit);
253
257
DriveInfo *drive_get_by_index(BlockInterfaceType type, int index)
1765
1770
if (!state->new_bs->drv->supports_backing) {
1766
1771
error_setg(errp, "The snapshot does not support backing images");
1775
bdrv_set_aio_context(state->new_bs, state->aio_context);
1777
/* This removes our old bs and adds the new bs. This is an operation that
1778
* can fail, so we need to do it in .prepare; undoing it for abort is
1779
* always possible. */
1780
bdrv_ref(state->new_bs);
1781
bdrv_append(state->new_bs, state->old_bs, &local_err);
1783
error_propagate(errp, local_err);
1786
state->overlay_appended = true;
1770
1789
static void external_snapshot_commit(BlkActionState *common)
1772
1791
ExternalSnapshotState *state =
1773
1792
DO_UPCAST(ExternalSnapshotState, common, common);
1775
bdrv_set_aio_context(state->new_bs, state->aio_context);
1777
/* This removes our old bs and adds the new bs */
1778
bdrv_append(state->new_bs, state->old_bs);
1779
1794
/* We don't need (or want) to use the transactional
1780
1795
* bdrv_reopen_multiple() across all the entries at once, because we
1781
1796
* don't want to abort all of them if one of them fails the reopen */
3096
3143
commit_active_start(has_job_id ? job_id : NULL, bs, base_bs,
3097
BLOCK_JOB_DEFAULT, speed, on_error, NULL, NULL,
3144
BLOCK_JOB_DEFAULT, speed, on_error,
3145
filter_node_name, NULL, NULL, &local_err, false);
3100
3147
BlockDriverState *overlay_bs = bdrv_find_overlay(bs, top_bs);
3101
3148
if (bdrv_op_is_blocked(overlay_bs, BLOCK_OP_TYPE_COMMIT_TARGET, errp)) {
3389
3441
mirror_start(job_id, bs, target,
3390
3442
has_replaces ? replaces : NULL,
3391
3443
speed, granularity, buf_size, sync, backing_mode,
3392
on_source_error, on_target_error, unmap, errp);
3444
on_source_error, on_target_error, unmap, filter_node_name,
3395
3448
void qmp_drive_mirror(DriveMirror *arg, Error **errp)
3999
4056
.name = BDRV_OPT_READ_ONLY,
4000
4057
.type = QEMU_OPT_BOOL,
4001
4058
.help = "open drive file as read-only",
4003
.name = "throttling.iops-total",
4004
.type = QEMU_OPT_NUMBER,
4005
.help = "limit total I/O operations per second",
4007
.name = "throttling.iops-read",
4008
.type = QEMU_OPT_NUMBER,
4009
.help = "limit read operations per second",
4011
.name = "throttling.iops-write",
4012
.type = QEMU_OPT_NUMBER,
4013
.help = "limit write operations per second",
4015
.name = "throttling.bps-total",
4016
.type = QEMU_OPT_NUMBER,
4017
.help = "limit total bytes per second",
4019
.name = "throttling.bps-read",
4020
.type = QEMU_OPT_NUMBER,
4021
.help = "limit read bytes per second",
4023
.name = "throttling.bps-write",
4024
.type = QEMU_OPT_NUMBER,
4025
.help = "limit write bytes per second",
4027
.name = "throttling.iops-total-max",
4028
.type = QEMU_OPT_NUMBER,
4029
.help = "I/O operations burst",
4031
.name = "throttling.iops-read-max",
4032
.type = QEMU_OPT_NUMBER,
4033
.help = "I/O operations read burst",
4035
.name = "throttling.iops-write-max",
4036
.type = QEMU_OPT_NUMBER,
4037
.help = "I/O operations write burst",
4039
.name = "throttling.bps-total-max",
4040
.type = QEMU_OPT_NUMBER,
4041
.help = "total bytes burst",
4043
.name = "throttling.bps-read-max",
4044
.type = QEMU_OPT_NUMBER,
4045
.help = "total bytes read burst",
4047
.name = "throttling.bps-write-max",
4048
.type = QEMU_OPT_NUMBER,
4049
.help = "total bytes write burst",
4051
.name = "throttling.iops-total-max-length",
4052
.type = QEMU_OPT_NUMBER,
4053
.help = "length of the iops-total-max burst period, in seconds",
4055
.name = "throttling.iops-read-max-length",
4056
.type = QEMU_OPT_NUMBER,
4057
.help = "length of the iops-read-max burst period, in seconds",
4059
.name = "throttling.iops-write-max-length",
4060
.type = QEMU_OPT_NUMBER,
4061
.help = "length of the iops-write-max burst period, in seconds",
4063
.name = "throttling.bps-total-max-length",
4064
.type = QEMU_OPT_NUMBER,
4065
.help = "length of the bps-total-max burst period, in seconds",
4067
.name = "throttling.bps-read-max-length",
4068
.type = QEMU_OPT_NUMBER,
4069
.help = "length of the bps-read-max burst period, in seconds",
4071
.name = "throttling.bps-write-max-length",
4072
.type = QEMU_OPT_NUMBER,
4073
.help = "length of the bps-write-max burst period, in seconds",
4075
.name = "throttling.iops-size",
4076
.type = QEMU_OPT_NUMBER,
4077
.help = "when limiting by iops max size of an I/O in bytes",
4079
4064
.name = "throttling.group",
4080
4065
.type = QEMU_OPT_STRING,
4081
4066
.help = "name of the block throttling group",