aboutsummaryrefslogtreecommitdiff
path: root/hw/block/block.c
diff options
context:
space:
mode:
authorCornelia Huck <cohuck@redhat.com>2018-07-06 15:06:20 +0200
committerKevin Wolf <kwolf@redhat.com>2018-07-10 14:36:12 +0200
commit6703db131f832d6af58fa629be11c5efa5a6adb8 (patch)
treec9326a22cfbfab46dcd29c273ecc40665abd0332 /hw/block/block.c
parent75f4cd297922e1ac352625badf548d4a1bb96089 (diff)
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 <cohuck@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/block/block.c')
-rw-r--r--hw/block/block.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/hw/block/block.c b/hw/block/block.c
index b6c80ab0b7..b91e2b6d7e 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,