All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Qemu-devel] [Important] Query regarding bdrv_co_discard
@ 2014-09-04 12:56 Sanjay Kumar2
  2014-09-04 13:59 ` Stefan Hajnoczi
  0 siblings, 1 reply; 4+ messages in thread
From: Sanjay Kumar2 @ 2014-09-04 12:56 UTC (permalink / raw)
  To: 'Stefan Hajnoczi'; +Cc: 'qemu-devel@nongnu.org'

Output of hdparam is below. Also let me know does network based protocol supports 'qcow2' format. As my block driver is network based. It is perfectly working for raw format. When I change the type='qcow2', then it is not working because bdrv_get_geometry() is returning 0. This I am talking about qemu-kvm-0.12.1.2.

[root@localhost ~]# hdparm -I /dev/sda

/dev/sda:
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

ATA device, with non-removable media
Standards:
        Likely used: 1
Configuration:
        Logical         max     current
        cylinders       0       0
        heads           0       0
        sectors/track   0       0
        --
        Logical/Physical Sector size:           512 bytes
        device size with M = 1024*1024:           0 MBytes
        device size with M = 1000*1000:           0 MBytes
        cache/buffer size  = unknown
Capabilities:
        IORDY not likely
        Cannot perform double-word IO
        R/W multiple sector transfer: not supported
        DMA: not supported
        PIO: pio0

-----Original Message-----
From: Sanjay Kumar2 
Sent: Wednesday, September 03, 2014 4:11 PM
To: Stefan Hajnoczi
Cc: qemu-devel@nongnu.org
Subject: RE: [Qemu-devel] Query regarding bdrv_co_discard

Thanks Stefan.

I using the same. Below is the XML.

    <disk type='network' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native' discard='unmap'/>
      <source protocol='oflame' name='/dev/of/vdisk/{a30c3997-0ad8-4495-8549-68431abfa84a}'>
        <host name='10.209.133.163' port='9999'/>
      </source>
      <target dev='sda' bus='scsi'/>
      <address type='drive' controller='1' bus='0' target='0' unit='0'/>
    </disk>
....

    <controller type='scsi' index='1' model='virtio-scsi'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>

I am able to see the scsi disk, /dev/sda inside the guest, but does not showing TRIM supported in the hdparm output.  Fstrim command is also failing.

Regards,
Sanjay

-----Original Message-----
From: Stefan Hajnoczi [mailto:stefanha@gmail.com] 
Sent: Wednesday, September 03, 2014 4:06 PM
To: Sanjay Kumar2
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Query regarding bdrv_co_discard

On Tue, Sep 02, 2014 at 02:09:44AM -0700, Sanjay Kumar2 wrote:
> Please let me know how to test bdrv_co_discard interface. I mean what steps I need to do on KVM host and inside guest to do end to end testing of this interface. I have implemented a network protocol based block driver and defined bdrv_co_discard interface as well which free the blocks on the remote storage device.

Use a virtio-scsi storage controller and then the guest can send SCSI discard commands.  Make sure to use the -drive ...,discard=unmap option, otherwise discard commands are silently ignored.

Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Important] Query regarding bdrv_co_discard
  2014-09-04 12:56 [Qemu-devel] [Important] Query regarding bdrv_co_discard Sanjay Kumar2
@ 2014-09-04 13:59 ` Stefan Hajnoczi
  2014-09-11  8:53   ` Sanjay Kumar2
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2014-09-04 13:59 UTC (permalink / raw)
  To: Sanjay Kumar2; +Cc: 'qemu-devel@nongnu.org'

[-- Attachment #1: Type: text/plain, Size: 1392 bytes --]

On Thu, Sep 04, 2014 at 05:56:53AM -0700, Sanjay Kumar2 wrote:
> Output of hdparam is below. Also let me know does network based protocol supports 'qcow2' format. As my block driver is network based. It is perfectly working for raw format. When I change the type='qcow2', then it is not working because bdrv_get_geometry() is returning 0. This I am talking about qemu-kvm-0.12.1.2.
> 
> [root@localhost ~]# hdparm -I /dev/sda
> 
> /dev/sda:
> SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 
> ATA device, with non-removable media
> Standards:
>         Likely used: 1
> Configuration:
>         Logical         max     current
>         cylinders       0       0
>         heads           0       0
>         sectors/track   0       0
>         --
>         Logical/Physical Sector size:           512 bytes
>         device size with M = 1024*1024:           0 MBytes
>         device size with M = 1000*1000:           0 MBytes
>         cache/buffer size  = unknown

I guess you are asking why hdparm reports 0 MB size?

Please post the qemu command-line (ps aux | grep qemu) so we know how
the guest is configured.

qcow2 works on non-file protocols (e.g. network).

Please keep discussion in this email thread and don't post comments
about this on my blog.

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Important] Query regarding bdrv_co_discard
  2014-09-04 13:59 ` Stefan Hajnoczi
@ 2014-09-11  8:53   ` Sanjay Kumar2
  2014-09-17 11:20     ` Stefan Hajnoczi
  0 siblings, 1 reply; 4+ messages in thread
From: Sanjay Kumar2 @ 2014-09-11  8:53 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: 'qemu-devel@nongnu.org'

Hi Stefan,

Sorry for delay in response as I was sick. Actually I have below two very important queries. Answer to both queries are valuable to me. We are planning to add block driver with the new protocol after proper testing.

1.  With my new network based disk protocol, if I use 'raw' format, then it is working perfectly. But, when I am using 'qcow2' format, then is it causing issue. After debugging I found that it is returning because bdrv_get_geometry() is returning 0 in case of format='qcow2'. Below is the qemu args for the same. Please let me know what I am missing here.

LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -name centos-6.5-vm1 -S -M rhel6.5.0 -enable-kvm -m 2048 -realtime mlock=off -smp 4,sockets=4,cores=1,threads=1 -uuid daec3cd9-d8b1-f01c-ba84-352da7f691f1 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/centos-6.5-vm1.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/tmp/centos-6.5.qcow2-vm1,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,aio=native -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive file=oflame://192.168.122.77:5678/openflame/vDisk001,if=none,id=drive-virtio-disk1,format=qcow2,cache=none,aio=native -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk1,id=virtio-disk1 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=24,id=hostnet0,vhost=on,vhostfd=25 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:0f:f4:34,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0 -vnc 0.0.0.0:0 -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5

2. The qemu-kvm is starting with below arguments with virtio-scsi. I am not able to see the TRIM in hdparm output of the device. Also, this is working with raw format only, not with qcow2 format.

LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -name centos-6.5-vm1 -S -M rhel6.5.0 -enable-kvm -m 2048 -realtime mlock=off -smp 4,sockets=4,cores=1,threads=1 -uuid daec3cd9-d8b1-f01c-ba84-352da7f691f1 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/centos-6.5-vm1.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x6 -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x7 -drive file=/tmp/centos-6.5.qcow2-vm1,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,aio=native -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive file=oflame://10.209.133.163:5678/openflame/vDisk001,if=none,id=drive-scsi1-0-0-0,format=raw,cache=none,aio=native -device scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi1-0-0-0,id=scsi1-0-0-0 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=24,id=hostnet0,vhost=on,vhostfd=25 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:0f:f4:34,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0 -vnc 0.0.0.0:0 -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5


Many Thanks in advance.

With best regards,
Sanjay Kumar

-----Original Message-----
From: Stefan Hajnoczi [mailto:stefanha@gmail.com] 
Sent: Thursday, September 04, 2014 7:29 PM
To: Sanjay Kumar2
Cc: 'qemu-devel@nongnu.org'
Subject: Re: [Qemu-devel] [Important] Query regarding bdrv_co_discard

On Thu, Sep 04, 2014 at 05:56:53AM -0700, Sanjay Kumar2 wrote:
> Output of hdparam is below. Also let me know does network based protocol supports 'qcow2' format. As my block driver is network based. It is perfectly working for raw format. When I change the type='qcow2', then it is not working because bdrv_get_geometry() is returning 0. This I am talking about qemu-kvm-0.12.1.2.
> 
> [root@localhost ~]# hdparm -I /dev/sda
> 
> /dev/sda:
> SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 
> 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 
> ATA device, with non-removable media
> Standards:
>         Likely used: 1
> Configuration:
>         Logical         max     current
>         cylinders       0       0
>         heads           0       0
>         sectors/track   0       0
>         --
>         Logical/Physical Sector size:           512 bytes
>         device size with M = 1024*1024:           0 MBytes
>         device size with M = 1000*1000:           0 MBytes
>         cache/buffer size  = unknown

I guess you are asking why hdparm reports 0 MB size?

Please post the qemu command-line (ps aux | grep qemu) so we know how the guest is configured.

qcow2 works on non-file protocols (e.g. network).

Please keep discussion in this email thread and don't post comments about this on my blog.

Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Important] Query regarding bdrv_co_discard
  2014-09-11  8:53   ` Sanjay Kumar2
@ 2014-09-17 11:20     ` Stefan Hajnoczi
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2014-09-17 11:20 UTC (permalink / raw)
  To: Sanjay Kumar2; +Cc: 'qemu-devel@nongnu.org'

[-- Attachment #1: Type: text/plain, Size: 4595 bytes --]

On Thu, Sep 11, 2014 at 01:53:49AM -0700, Sanjay Kumar2 wrote:
> 1.  With my new network based disk protocol, if I use 'raw' format, then it is working perfectly. But, when I am using 'qcow2' format, then is it causing issue. After debugging I found that it is returning because bdrv_get_geometry() is returning 0 in case of format='qcow2'. Below is the qemu args for the same. Please let me know what I am missing here.
> 
> LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -name centos-6.5-vm1 -S -M rhel6.5.0 -enable-kvm -m 2048 -realtime mlock=off -smp 4,sockets=4,cores=1,threads=1 -uuid daec3cd9-d8b1-f01c-ba84-352da7f691f1 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/centos-6.5-vm1.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/tmp/centos-6.5.qcow2-vm1,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,aio=native -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive file=oflame://192.168.122.77:5678/openflame/vDisk001,if=none,id=drive-virtio-disk1,format=qcow2,cache=none,aio=native -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk1,id=virtio-disk1 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=24,id=hostnet0,vhost=on,vhostfd=25 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:0f:f4:34,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0 -vnc 0.0.0.0:0 -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5

The following test works with qemu.git:

  # Serve pre-installed qcow2 disk image over NBD.  Note that we tell
  # qemu-nbd it is a raw file so that qemu-nbd does not interpret the
  # file contents.
  qemu-nbd -t -p 1234 -f raw test.qcow2

  $ qemu-system-x86_64 -enable-kvm -cpu host -m 1024 \
        -drive if=none,cache=none,file=nbd://localhost:1234,\
	       format=qcow2,id=drive0 \
	-device virtio-blk-pci,drive=drive0

The guest boots up successfully.

This suggests either your block driver is buggy or you need to rebase
onto qemu.git/master for it to work.

If you would like help debugging then please rebase onto qemu.git/master
and post a git URL where we can see the code.

> 2. The qemu-kvm is starting with below arguments with virtio-scsi. I am not able to see the TRIM in hdparm output of the device. Also, this is working with raw format only, not with qcow2 format.
> 
> LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -name centos-6.5-vm1 -S -M rhel6.5.0 -enable-kvm -m 2048 -realtime mlock=off -smp 4,sockets=4,cores=1,threads=1 -uuid daec3cd9-d8b1-f01c-ba84-352da7f691f1 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/centos-6.5-vm1.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x6 -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x7 -drive file=/tmp/centos-6.5.qcow2-vm1,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,aio=native -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive file=oflame://10.209.133.163:5678/openflame/vDisk001,if=none,id=drive-scsi1-0-0-0,format=raw,cache=none,aio=native -device scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi1-0-0-0,id=scsi1-0-0-0 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=24,id=hostnet0,vhost=on,vhostfd=25 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:0f:f4:34,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0 -vnc 0.0.0.0:0 -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5

Try again with qemu.git/master.  Note this command-line is missing
-drive ...,discard=unmap so it will not pass discard requests to the
host.

I'm also not sure whether hdparm is the right tool.  This is a SCSI disk
whereas hdparm is intended for ATA disks.  Perhaps the ioctls are wired
up so it works fine for SCSI disks but you should use sdparm for
SCSI-specific stuff.

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-17 11:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-04 12:56 [Qemu-devel] [Important] Query regarding bdrv_co_discard Sanjay Kumar2
2014-09-04 13:59 ` Stefan Hajnoczi
2014-09-11  8:53   ` Sanjay Kumar2
2014-09-17 11:20     ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.