Re: [PATCH] qemu: turn on virtlockd by default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 22, 2016 at 03:35:33PM -0500, Cole Robinson wrote:
> On 01/22/2016 02:35 PM, Kashyap Chamarthy wrote:
> > On Fri, Jan 22, 2016 at 03:56:08PM +0000, Daniel P. Berrange wrote:
> >> We have had virtlockd available for a long time now but
> >> have always defaulted to the 'nop' lock driver which does
> >> no locking. This gives users an unsafe deployment by
> >> default unless they know to turn on lockd. virtlockd will
> >> auto-activate via systemd when guests launch, so setting
> >> it on by default will only cause upgrade pain for people
> >> on non-systemd distros.
> > 
> > I tried to test this patch in the below way after applying to my local
> > Git master, and my test seems to fail.

My mistake - test was failing because I missed to start 'virtlogd'
daemon _before_ libvirtd.  (Thanks, Cole, for noticing that I mixed up
'virtlogd' and 'virtlockd'.)  

With that fixed, my same test succeeds[*].

ACK & Tested-By: Kashyap Chamarthy <kchamart@xxxxxxxxxx>


[*] Test

(1) Purposefully make two libvirt VMs point to the same disk image:

    $ sudo ./run tools/virsh dumpxml cvm1 | grep 'source file'
          <source file='/var/lib/libvirt/images/cirros-0.3.3-x86_64-disk.img'/>
    $ sudo ./run tools/virsh dumpxml cvm2 | grep 'source file'
          <source file='/var/lib/libvirt/images/cirros-0.3.3-x86_64-disk.img'/>

(2) Start the first guest (cvm1):

    $ sudo ./run tools/virsh start cvm1
    Domain cvm1 started

(3) Start the second guest (cvm2), the disk image is locked, and libvirt,
    correctly, refuses to start it:

    $ sudo ./run tools/virsh start cvm2
    error: Failed to start domain cvm2
    error: resource busy: Lockspace resource
    '/var/lib/libvirt/images/cirros-0.3.3-x86_64-disk.img' is locked

And, an appropriate error is thrown in libvirt debug log:

    ...
    2016-01-22 21:56:19.095+0000: 3008: error : virLockSpaceAcquireResource:640 : resource busy: Lockspace resource '/var/lib/libvirt/images/cirros-0.3.3-x86_64-disk.img' is locked
    ...

[...]

> > Enable `virtlockd` for the QEMU driver:
> > 
> >     $ augtool -s  set /files/etc/libvirt/qemu.conf/lock_manager lockd
> > 
> > Invoke just compiled virtlockd and libvirtd (in that order):
> > 
> >     $ sudo ./run src/virtlockd &

Noting for completeness, I missed a step here: starting the virtlogd
daemon _before_ libvirtd

        $ sudo ./run src/virtlogd &

(Just remembered that recently a patch (a8bb330) was merged that made it
mandatory to have virtlogd start _before_ libvirtd, because: "In the
non-systemd case, without socket activation, we need to proper
ordering.")

> >     $ sudo ./run daemon/libvirtd &

[...] 

> You're mixing up virtlogd and virtlockd :) virtlogd was added recently
> and should be started. But maybe there's another issue if it wasn't
> started automatically.

Duh, that's embarassing, you're of course right.  Thanks for catching
that.  After starting the 'virtlogd' daemon, all is good.

-- 
/kashyap

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]