From 6703db131f832d6af58fa629be11c5efa5a6adb8 Mon Sep 17 00:00:00 2001 From: Cornelia Huck Date: Fri, 6 Jul 2018 15:06:20 +0200 Subject: Revert "block: Remove deprecated -drive geometry options" This reverts commit a7aff6dd10b16b67e8b142d0c94c5d92c3fe88f6. Hold off removing this for one more QEMU release (current libvirt release still uses it.) Signed-off-by: Cornelia Huck Signed-off-by: Kevin Wolf --- hw/block/block.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'hw/block') diff --git a/hw/block/block.c b/hw/block/block.c index b6c80ab..b91e2b6 100644 --- a/hw/block/block.c +++ b/hw/block/block.c @@ -108,6 +108,20 @@ bool blkconf_geometry(BlockConf *conf, int *ptrans, unsigned cyls_max, unsigned heads_max, unsigned secs_max, Error **errp) { + DriveInfo *dinfo; + + if (!conf->cyls && !conf->heads && !conf->secs) { + /* try to fall back to value set with legacy -drive cyls=... */ + dinfo = blk_legacy_dinfo(conf->blk); + if (dinfo) { + conf->cyls = dinfo->cyls; + conf->heads = dinfo->heads; + conf->secs = dinfo->secs; + if (ptrans) { + *ptrans = dinfo->trans; + } + } + } if (!conf->cyls && !conf->heads && !conf->secs) { hd_geometry_guess(conf->blk, &conf->cyls, &conf->heads, &conf->secs, -- cgit v1.1