qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: lma <lma@suse.de>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com
Subject: Questions about online resizing a lun passthrough disk with virtio-scsi
Date: Wed, 08 Jul 2020 14:44:01 +0000	[thread overview]
Message-ID: <af3e33e4a5bb15d9f0b30c8de4941a37@suse.de> (raw)

Hi all,

I have questions about online resizing a scsi lun passthrough disk.
Here is my test scenario:
host A:
- the local 50GB sata /dev/sdd1 is configured as a physical volume,
   Created a 10GB logical volume.
- exported the lv by iscsi target by targetcli.

host B:
- connected to the above iscsi target to obtain a 'local' scsi disk,
   say the /dev/sdb.
- scsi lun passed through this /dev/sdb to a qemu-kvm linux guest.

hostA:~ # lvresize -L +5G /dev/vg0/lv0
hostB:~ # rescan-scsi-bus.sh -s //this script is in sg3_utils, '-s'
look for resized disks.
hostB:~ # block_resize via qmp to notify qemu self and guest os.
guest:~ # rescan-scsi-bus.sh -s
guest:~ # use the extended disk space.

My questions are:
Is the 'block_resize' mandatory to notify guest os after online resizing
a lun passed through disk? I'm curious it because I found there're 
couple
of ways can make guest os realize the disk capacity change.
e.g:
* run 'block_resize' via qmp to let virtio-scsi notify the frontend 
about
   capacity change.
* run 'rescan-scsi-bus.sh -s' inside guest.
* run 'sg_readcap --16 /dev/sda' inside guest.

I knew that the purpose of 'block_resize' is not only to notify guest 
os,
but also to update some internal structure's member, say 
bs->total_sectors.
What if I forgot to run 'block_resize', but run 'rescan-scsi-bus.sh -s' 
in guest?
In this case, Although the qemu's bs->total_sectors value isn't updated 
due
to missing 'block_resize', The guest os is still able to see the 
capacity
change, I'm curious is there any potential risks while using the 
extended
disk space in guest?

What is the best practice for online resizing a lun passed through disk?
Are all of below steps mandatory? OR may I omit either step 3 of 4?
1. online resize on storage side.
2. scsi rescan to realize the capacity change on hypervisor side.
3. block_resize via qmp.
4. scsi rescan to realize the capacity change in guest.
5. use the extended disk space in guest.

Many thanks,
Lin


             reply	other threads:[~2020-07-08 16:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08 14:44 lma [this message]
2020-07-08 15:11 ` Questions about online resizing a lun passthrough disk with virtio-scsi Paolo Bonzini
2020-07-09 11:52   ` Lin Ma
2020-07-09 12:00     ` Paolo Bonzini
2020-07-09 12:07       ` Lin Ma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=af3e33e4a5bb15d9f0b30c8de4941a37@suse.de \
    --to=lma@suse.de \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).