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

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



On Thu, Dec 03, 2009 at 11:08:01PM +0100, Matthias Bolte wrote:
> 2009/12/1 Cole Robinson <crobinso redhat com>:
> > Provides the CDROM label for current media. Only implemented for the udev
> > backend.
> >
> > Signed-off-by: Cole Robinson <crobinso 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.

  Good point, if the label includes & or < this would break the XML

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

  Applied with teh suggested fix, thanks !

Daniel

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


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