[libvirt] [PATCH] nodedev: Add removable storage 'media_label' prop

Matthias Bolte matthias.bolte at googlemail.com
Thu Dec 3 22:08:01 UTC 2009


2009/12/1 Cole Robinson <crobinso at redhat.com>:
> Provides the CDROM label for current media. Only implemented for the udev
> backend.
>
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
>  docs/schemas/nodedev.rng                   |    5 +++++
>  src/conf/node_device_conf.c                |    8 ++++++++
>  src/conf/node_device_conf.h                |    1 +
>  src/node_device/node_device_udev.c         |    5 +++++
>  tests/nodedevschemadata/DVD_with_media.xml |   16 ++++++++++++++++
>  tests/nodedevxml2xmltest.c                 |    1 +
>  6 files changed, 36 insertions(+), 0 deletions(-)
>  create mode 100644 tests/nodedevschemadata/DVD_with_media.xml
>

> diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
> index 6003ab1..a0d256c 100644
> --- a/src/conf/node_device_conf.c
> +++ b/src/conf/node_device_conf.c
> @@ -422,6 +422,11 @@ char *virNodeDeviceDefFormat(virConnectPtr conn,
>                                   "</media_available>\n", avl ? 1 : 0);
>                 virBufferVSprintf(&buf, "      <media_size>%llu</media_size>\n",
>                                   data->storage.removable_media_size);
> +                if (data->storage.media_label)
> +                    virBufferVSprintf(&buf,
> +                                      "      <media_label>%s</media_label>\n",
> +                                      data->storage.media_label);
> +

You should use virBufferEscapeString instead of virBufferVSprintf.

>                 if (data->storage.logical_block_size > 0)
>                     virBufferVSprintf(&buf, "      <logical_block_size>%llu"
>                                       "</logical_block_size>\n",

ACK.

Matthias




More information about the libvir-list mailing list