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

Re: [libvirt] [PATCH] check device-mapper when building without storage mpath



On Fri, Feb 18, 2011 at 08:00:34PM +1100, Justin Clift wrote:
> On 18/02/2011, at 7:46 PM, Jiri Denemark wrote:
> <snip>
> > 
> >> Thanks for the fix, actually It can be reproduced simply by:
> >> % ./autogen.sh --with-storage-mpath=no
> >> % make
> >> 
> >> As src/util/util.c invokes "dm_is_dm_major".
> > 
> > Yes it does, but I'm not convinced this is the right approach to fix it. Why
> > should libvirt always require device-mapper libraries?
> 
> As a data point, device-mapper isn't available on non-Linux platforms.  If
> Osier was meaning to make it "required", I can see a problem about there. ;)

Since device-mapper is Linux specific, then by definition
virIsDevMapperDevice() will always return false on those
platforms. So there is no requirement for any device-mapper
libs on non-Linux, you just trivially make it do:


#if HAVE_DEVICE_MAPPER
bool
virIsDevMapperDevice(const char *devname)
{
    struct stat buf;

    if (!stat(devname, &buf) &&
        S_ISBLK(buf.st_mode) &&
        dm_is_dm_major(major(buf.st_rdev)))
            return true;

    return false;
}
#else
bool
virIsDevMapperDevice(const char *devname ATTRIBUTE_UNUSED)
{
  return false;
}
#endif


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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