[libvirt] [re-send][PATCH 1/3] add qemu driver hook

Eric Blake eblake at redhat.com
Tue Oct 9 03:54:50 UTC 2012

On 10/08/2012 08:33 PM, li guang wrote:
> 在 2012-10-08一的 20:05 -0600,Eric Blake写道:
>> On 10/08/2012 07:51 PM, liguang wrote:
>>> this hook aimed at migration only, it supposed
>>> to be used as a helper of migrate --copy-storage-*
>>> features to remove the unreasonable limitation
>>> of pre-exist disk images at migration target.
>>> someone can add more functions to hook files.
>> NACK.  Instead of writing a hook that runs outside of libvirt and has to
>> be installed to be of use, we should instead fix libvirt to do the file
>> creation itself.  That is, you should be patching
>> src/qemu/qemu_migration.c to detect when copy-storage-* has been passed,
> really? sorry, I don't know any implicit libvirt development rules,
> but, as I see, there are none hooks used by libvirt until now, why 
> don't we use them instead of just design and obsolete?

The problem with doing this as a python hook instead of directly in the
libvirt code is that you still got the sVirt SELinux labeling wrong.
Really, the file MUST be created by the libvirt C code, as that is the
code that knows what SELinux label to apply to the new file.
Furthermore, hooks are reserved for the user.  We should not be making
libvirt rely on the installation of hooks for correct operation of the
normal case.

> can't hooks be installed just like other libvirt files?
> then, create files by python or c have difference?

Hooks are limited in what they can do - they are documented as being
unable to call back in to other libvirt calls.  They are also less
efficient - why spawn a python process, when we already have all the
information to create the file in C code?

Ultimately, I'd like to see this wart of --copy-storage fixed, but fixed
properly in the C code and not by adding a hook file.

Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121008/1b312ecd/attachment-0001.sig>

More information about the libvir-list mailing list