[libvirt] Online resize of virtio-blk device does not emit udev event

Milos Vyletel milos.vyletel at sde.cz
Tue Feb 19 18:15:39 UTC 2013


Hi,

I hope this is the right list to ask. If not please tell me what will be more
appropriate place to ask this question.

I'm doing some work with online resizing of guest's block device on LVM. What I
do is call lvresize to expand logical volume itself and virsh blockresize to
notify guest about this change. Besides the fact that I needed to patch kernel
to get this working on mounted partitions(BZ 906050) everything works just fine.

Now that I've had this part successfully tested I wanted to make a script that
will be triggered by udev whenever particular device is changed. I assumed that
after capacity change virtio_blk driver would emit udev event but that's not the
case. I'm able to see one on host but not on guest.

[root at host ~]# lvresize -f -L +100M /dev/vgguests/evd2 && \
> virsh blockresize resize vdb 1
  Rounding size to boundary between physical extents: 128.00 MiB
  Extending logical volume evd2 to 15.00 GiB
  Logical volume evd2 successfully resized
Block device 'vdb' is resized

[root at host ~]# udevadm monitor
...
KERNEL[1361292279.619233] change   /devices/virtual/block/dm-9 (block)
UDEV  [1361292279.736012] change   /devices/virtual/block/dm-9 (block)
...

I was looking at the virtblk_config_changed_work function in RHEL6.3 kernel's
drivers/block/virtio_blk.c which I believe is the function handling blockresize
and it does not look like it tries to emit any kobject uevent.

Before I jump into patching kernel my question is whether it makes sense to have
such uevent? I surely can use a way how to detect capacity change from userspace.

Thanks,
Milos




More information about the libvir-list mailing list