Bug 981122

Summary: Virtlockd fail to generate lease file
Product: Red Hat Enterprise Linux 7 Reporter: Luwen Su <lsu>
Component: libvirtAssignee: Daniel Berrangé <berrange>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, ajia, dallan, dyuan, lsu, shyu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-19 02:57:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Luwen Su 2013-07-04 05:24:28 UTC
Description of problem:
After config the virtlockd's file and start guest , the virtlockd will report
End of file while reading data: Input/output error
and no lease file generated in dir 

Version-Release number of selected component (if applicable):
libvirt-1.1.0-1.el7.x86_64
qemu-kvm-1.5.1-2.el7.x86_64
kernel-3.10.0-0.rc7.64.el7.x86_64
selinux-policy-3.12.1-56.el7.noarch

How reproducible:
always

Steps to Reproduce:
1.
#systemctl start virtlockd.service

2.
#tail -1 /etc/libvirt/qemu.conf
lock_manager = "lockd"

#tail -3 /etc/libvirt/qemu-lockd.conf
auto_disk_leases = 1
require_lease_for_disks = 1

3.A small guest
#qemu-img create -f qcow2 /var/lib/libvirt/images/cake.qcow2 10M

#virsh define test.xml

<domain type='qemu'>
  <name>cake</name>
  <memory unit='MiB'>32</memory>
  <os>
    <type arch='x86_64' machine='pc'>hvm</type>
  </os>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/cake.qcow2'/>
      <target dev='vda' bus='virtio'/>
    </disk>
  </devices>
</domain>

3.
#systemctl restart libvirtd.service

#virsh start cake

4.
#service virtlockd status
Jul 04 11:25:43 localhost.localdomain virtlockd[2380]: End of file while reading data: Input/output error

#ll /var/lib/libvirt/lockd
ls: cannot access /var/lib/libvirt/lockd: No such file or directory


5.
There is no selinux error reported by setroubleshoot and audit.


Actual results:
IO error

Expected results:
work

Additional info:

Comment 2 Daniel Berrangé 2013-08-08 12:34:16 UTC
(In reply to time.su from comment #0)
> Description of problem:
> After config the virtlockd's file and start guest , the virtlockd will report
> End of file while reading data: Input/output error
> and no lease file generated in dir 
> 
> Version-Release number of selected component (if applicable):
> libvirt-1.1.0-1.el7.x86_64
> qemu-kvm-1.5.1-2.el7.x86_64
> kernel-3.10.0-0.rc7.64.el7.x86_64
> selinux-policy-3.12.1-56.el7.noarch
> 
> How reproducible:
> always
> 
> Steps to Reproduce:
> 1.
> #systemctl start virtlockd.service
> 
> 2.
> #tail -1 /etc/libvirt/qemu.conf
> lock_manager = "lockd"
> 
> #tail -3 /etc/libvirt/qemu-lockd.conf
> auto_disk_leases = 1
> require_lease_for_disks = 1
> 
> 3.A small guest
> #qemu-img create -f qcow2 /var/lib/libvirt/images/cake.qcow2 10M
> 
> #virsh define test.xml
> 
> <domain type='qemu'>
>   <name>cake</name>
>   <memory unit='MiB'>32</memory>
>   <os>
>     <type arch='x86_64' machine='pc'>hvm</type>
>   </os>
>   <devices>
>     <emulator>/usr/libexec/qemu-kvm</emulator>
>     <disk type='file' device='disk'>
>       <driver name='qemu' type='qcow2'/>
>       <source file='/var/lib/libvirt/images/cake.qcow2'/>
>       <target dev='vda' bus='virtio'/>
>     </disk>
>   </devices>
> </domain>
> 
> 3.
> #systemctl restart libvirtd.service
> 
> #virsh start cake
> 

Does this command actually start successfully ? If so, then there is no bug here.

> 4.
> #service virtlockd status
> Jul 04 11:25:43 localhost.localdomain virtlockd[2380]: End of file while
> reading data: Input/output error

That just shows that an connection to the lockd daemon closed,which is normal.

> #ll /var/lib/libvirt/lockd
> ls: cannot access /var/lib/libvirt/lockd: No such file or directory

The default configuration does not store locks in that directory. It would only do that if you actually set the config 

  file_lockspace_dir = "/var/lib/libvirt/lockd/files"

If that it not set, then locks are held directly against the disks.

For example, I have a guest 'demo'  - when it is running I can see the lock held by lockd


# lslocks | grep virtlockd
virtlockd        1654 POSIX     4B WRITE 0          0          0 /run/virtlockd.pid
virtlockd        1654 POSIX 192.5K READ  0          0          0 /var/lib/libvirt/images/demo.img

Comment 3 Luwen Su 2013-08-19 02:57:28 UTC
(In reply to Daniel Berrange from comment #2)
> (In reply to time.su from comment #0)
> > Description of problem:
> > After config the virtlockd's file and start guest , the virtlockd will report
> > End of file while reading data: Input/output error
> > and no lease file generated in dir 
> > 
> > Version-Release number of selected component (if applicable):
> > libvirt-1.1.0-1.el7.x86_64
> > qemu-kvm-1.5.1-2.el7.x86_64
> > kernel-3.10.0-0.rc7.64.el7.x86_64
> > selinux-policy-3.12.1-56.el7.noarch
> > 
> > How reproducible:
> > always
> > 
> > Steps to Reproduce:
> > 1.
> > #systemctl start virtlockd.service
> > 
> > 2.
> > #tail -1 /etc/libvirt/qemu.conf
> > lock_manager = "lockd"
> > 
> > #tail -3 /etc/libvirt/qemu-lockd.conf
> > auto_disk_leases = 1
> > require_lease_for_disks = 1
> > 
> > 3.A small guest
> > #qemu-img create -f qcow2 /var/lib/libvirt/images/cake.qcow2 10M
> > 
> > #virsh define test.xml
> > 
> > <domain type='qemu'>
> >   <name>cake</name>
> >   <memory unit='MiB'>32</memory>
> >   <os>
> >     <type arch='x86_64' machine='pc'>hvm</type>
> >   </os>
> >   <devices>
> >     <emulator>/usr/libexec/qemu-kvm</emulator>
> >     <disk type='file' device='disk'>
> >       <driver name='qemu' type='qcow2'/>
> >       <source file='/var/lib/libvirt/images/cake.qcow2'/>
> >       <target dev='vda' bus='virtio'/>
> >     </disk>
> >   </devices>
> > </domain>
> > 
> > 3.
> > #systemctl restart libvirtd.service
> > 
> > #virsh start cake
> > 
> 
> Does this command actually start successfully ? If so, then there is no bug
> here.
> 
> > 4.
> > #service virtlockd status
> > Jul 04 11:25:43 localhost.localdomain virtlockd[2380]: End of file while
> > reading data: Input/output error
> 
> That just shows that an connection to the lockd daemon closed,which is
> normal.
> 
> > #ll /var/lib/libvirt/lockd
> > ls: cannot access /var/lib/libvirt/lockd: No such file or directory
> 
> The default configuration does not store locks in that directory. It would
> only do that if you actually set the config 
> 
>   file_lockspace_dir = "/var/lib/libvirt/lockd/files"
> 
> If that it not set, then locks are held directly against the disks.
> 
> For example, I have a guest 'demo'  - when it is running I can see the lock
> held by lockd
> 
> 
> # lslocks | grep virtlockd
> virtlockd        1654 POSIX     4B WRITE 0          0          0
> /run/virtlockd.pid
> virtlockd        1654 POSIX 192.5K READ  0          0          0
> /var/lib/libvirt/images/demo.img


Yeah ,  i can see that too via lslocks

Not set dir:
lslocks | grep virtlockd
virtlockd        7484 POSIX     4B WRITE 0     0   0 /run/virtlockd.pid
virtlockd        7484 POSIX 192.5K WRITE 0     0   0 /var/lib/libvirt/images/cake.qcow2

Set dir:
 lslocks | grep virtlockd
virtlockd        7484 POSIX   4B WRITE 0     0   0 /run/virtlockd.pid
virtlockd        7484 POSIX   0B WRITE 0     0   0 /var/lib/libvirt/lockd/files/e4bb6229dec41cc1dced4696a4ba0913728379f714bce01acf165b9f8abf0464

Sorry for the mistake i made , i closed the bug as NOTBUG ,  will add the content to the realted test cases.