[libvirt] udev node device backend

Daniel Veillard veillard at redhat.com
Thu Nov 12 22:33:15 UTC 2009


On Thu, Nov 12, 2009 at 04:11:08PM -0500, Dave Allan wrote:


  Okay I have finally applied and pushed the 5 patches,


> @@ -394,10 +403,20 @@ char *virNodeDeviceDefFormat(virConnectPtr conn,
>                                    "</media_available>\n", avl ? 1 : 0);
>                  virBufferVSprintf(&buf, "      <media_size>%llu</media_size>\n",
>                                    data->storage.removable_media_size);
> +                virBufferVSprintf(&buf, "      <logical_block_size>%llu"
> +                                  "</logical_block_size>\n",
> +                                  data->storage.logical_block_size);
> +                virBufferVSprintf(&buf, "      <num_blocks>%llu</num_blocks>\n",
> +                                  data->storage.num_blocks);
>                  virBufferAddLit(&buf, "    </capability>\n");
>              } else {
>                  virBufferVSprintf(&buf, "    <size>%llu</size>\n",
>                                    data->storage.size);
> +                virBufferVSprintf(&buf, "    <logical_block_size>%llu"
> +                                  "</logical_block_size>\n",
> +                                  data->storage.logical_block_size);
> +                virBufferVSprintf(&buf, "    <num_blocks>%llu</num_blocks>\n",
> +                                  data->storage.num_blocks);
>              }
>              if (data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_HOTPLUGGABLE)
>                  virBufferAddLit(&buf,

  I just changed this code to not output
  <logical_block_size>0</logical_block_size>
or <num_blocks>0</num_blocks>
in case the informations were not available from the source, this was
also breaking regression tests

> diff --git a/src/util/util.h b/src/util/util.h
> index f4e395e..8c9d401 100644
> --- a/src/util/util.h
> +++ b/src/util/util.h
> @@ -248,4 +248,7 @@ char *virFileFindMountPoint(const char *type);
> 
>  void virFileWaitForDevices(virConnectPtr conn);
> 
> +#define virBuildPath(path, ...) virBuildPathInternal(path, __VA_ARGS__, NULL)
> +int virBuildPathInternal(char **path, ...) ATTRIBUTE_SENTINEL;
> +
>  #endif /* __VIR_UTIL_H__ */

  IMHO virBuildPath being a macro should be VIR_BUILD_PATH, I didn't fix
  that that can be trivially changed later :-)

> diff --git a/configure.in b/configure.in
> index c167381..8e7c059 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -1781,10 +1781,19 @@ if test "x$with_udev" = "xyes" -o "x$with_udev" = "xcheck"; then
>      CFLAGS="$old_CFLAGS"
>      LDFLAGS="$old_LDFLAGS"
>    fi
> +  PCIACCESS_REQUIRED=0.10.0
> +  PCIACCESS_CFLAGS=
> +  PCIACCESS_LIBS=
> +  PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= $PCIACCESS_REQUIRED], [], [PCIACCESS_FOUND=no])
> +  if test "$PCIACCESS_FOUND" = "no" ; then
> +     AC_MSG_ERROR([You must install libpciaccess/libpciaccess-devel >= $PCIACCESS_REQUIRED to compile libvirt])
> +   fi
>  fi
>  AM_CONDITIONAL([HAVE_UDEV], [test "x$with_udev" = "xyes"])
>  AC_SUBST([UDEV_CFLAGS])
>  AC_SUBST([UDEV_LIBS])
> +AC_SUBST([PCIACCESS_CFLAGS])
> +AC_SUBST([PCIACCESS_LIBS])
> 
>  with_nodedev=no;
>  if test "$with_hal" = "yes" -o "$with_udev" = "yes";
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 4aaad6b..d22a103 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -645,8 +645,8 @@ libvirt_driver_nodedev_la_LDFLAGS += $(HAL_LIBS)
>  endif
>  if HAVE_UDEV
>  libvirt_driver_nodedev_la_SOURCES += $(NODE_DEVICE_DRIVER_UDEV_SOURCES)
> -libvirt_driver_nodedev_la_CFLAGS += $(UDEV_CFLAGS)
> -libvirt_driver_nodedev_la_LDFLAGS += $(UDEV_LIBS)
> +libvirt_driver_nodedev_la_CFLAGS += $(UDEV_CFLAGS) $(PCIACCESS_CFLAGS)
> +libvirt_driver_nodedev_la_LDFLAGS += $(UDEV_LIBS) $(PCIACCESS_LIBS)
>  endif
> 
>  if WITH_DRIVER_MODULES


  In configure.in at the end in patch 5 I also added the
$PCIACCESS_CFLAGS $PCIACCESS_LIBS to the AC_MSG_NOTICE for udev:
linking and compilation as this is now a requirement for building with
udev.

  So all commited, it looks fine to me, we still need to update the spec
file to allow conditional compilation, currently disabled but we should
probably force it for Fedora13/rawhide and possibly RHEL6 for example
but that's small things compared to the size of the patches :-)

  congrats !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list