[libvirt] question about libvirt.spec

Jim Fehlig jfehlig at suse.com
Tue Dec 3 21:33:11 UTC 2013


Eric Blake wrote:
> On 12/03/2013 01:40 PM, Jim Fehlig wrote:
>   
>> While installing a libvirt-daemon package build from a slightly modified
>> upstream spec file (e.g. fedora and rhel replaced with suse_version and
>> sles_version), I noticed warnings such as "warning: user qemu does not
>> exist - using root".
>>
>> %files of libvirt-daemon has several hypervisor-specific files and
>> directories, e.g.
>>
>>   %dir %attr(0750, %{qemu_user}, %{qemu_group}) ...
>>
>> but afaict libvirt-daemon has no dependency on a package that creates
>> the qemu user:group (e.g. qemu or qemu-kvm).
>>     
>
> libvirt-daemon itself creates the qemu user on Fedora:
>
> %if %{with_libvirtd}
> %pre daemon
>     %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
> # We want soft static allocation of well-known ids, as disk images
> # are commonly shared across NFS mounts by id rather than name; see
> # https://fedoraproject.org/wiki/Packaging:UsersAndGroups
> getent group kvm >/dev/null || groupadd -f -g 36 -r kvm
> getent group qemu >/dev/null || groupadd -f -g 107 -r qemu
> if ! getent passwd qemu >/dev/null; then
>   if ! getent passwd 107 >/dev/null; then
>     useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin -c "qemu
> user" qemu
>   else
>     useradd -r -g qemu -G kvm -d / -s /sbin/nologin -c "qemu user" qemu
>   fi
> fi
> exit 0
>     %endif
>   

Part of the "slight modification" is removing this hypervisor-specific
code.  Otherwise, if libvirt is built with xen and qemu support,
installing libvirt-daemon-driver-libxl will result in creating a qemu
user and qemu+kvm groups on a xen-only setup.

>> I thought about moving hypervisor-specific files to the
>> libvirt-daemon-driver-<hypervisor> packages, but have a hunch they are
>> in the libvirt-daemon package for a reason I'm not considering.  Should
>> these files and directories be moved to their respective
>> libvirt-daemon-driver-<hypervisor> packages, making libvirt-daemon more
>> hypervisor-neutral?
>>     
>
> That sounds like an independently useful suggestion regardless of how
> you resolve the user creation issue - we've already had recent patches
> to reduce the dependencies of libvirt-daemon by pushing Requires: lines
> into the respective hypervisor packages.
>   

I'll workup a patch for further discussion.

Regards,
Jim




More information about the libvir-list mailing list