Re: [PATCH] Fix strange error message in virsh attach-device

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

 



Hi Daniel

>   can you provide floppy.xml content too to test the problem ?
> 
I attach the XML file which I used by the test.

Thanks,
Masayuki Sunou.

In message <20070601135415.GE9279@xxxxxxxxxx>
   "Re:  [PATCH] Fix strange error message in virsh attach-device"
   "Daniel Veillard <veillard@xxxxxxxxxx>" wrote:

> On Fri, May 25, 2007 at 07:42:12PM +0900, Masayuki Sunou wrote:
> > Hi
> > 
> > Now, virsh attach-device displays the following messages when "device"
> > attribute of "disk" element is "floppy" in XML.
> > 
> > # virsh attach-device HVM_RH4_file floppy.xml
> > libvir: Xen Daemon error : POST operation failed: (xend.err 'Invalid Configuration: XendConfig: @\x14\xce not a valid device type')
> > error: Failed to attach device from floppy.xml
> 
>   can you provide floppy.xml content too to test the problem ?
> 
> > This patch fixes this strange error message displaying "@\x14\xce".
> 
>   okay, buffer problem.
> 
> > Description of this patch 
> >   VirDomainParseXMLDiskDesc() returns 0 without putting data in virBuffer,
> >   when "floppy" is set.
> >   Therefore, virParseXMLDevice() returns no initialized data, and
> >   xenDaemonAttachDevice() passes Xen this data. 
> >   Because virDomainParseXMLDesc() works wrong when this patch changes
> >   return value of VirDomainParseXMLDiskDesc(),this patch fixes
> >   virParseXMLDevice() as follows.
> >     - Initialize data
> >     - Return error if data does not change.
> >   As a result, xenDaemonAttachDevice() doesn't pass strange data to Xen,
> >   and Xen doesn't return strange error message.
> > 
> > 
> > Signed-off-by: Masayuki Sunou <fj1826dm@xxxxxxxxxxxxxxxxx>
> > 
> > Thanks,
> > Masayuki Sunou.
> > 
> > ----------------------------------------------------------------------
> > Index: src/xml.c
> > ===================================================================
> > RCS file: /data/cvs/libvirt/src/xml.c,v
> > retrieving revision 1.73
> > diff -u -p -r1.73 xml.c
> > --- src/xml.c   23 Apr 2007 07:41:23 -0000      1.73
> > +++ src/xml.c   25 May 2007 09:46:56 -0000
> > @@ -1481,6 +1481,7 @@ virParseXMLDevice(virConnectPtr conn, ch
> >          return (NULL);
> >      buf.size = 1000;
> >      buf.use = 0;
> > +    memset(buf.content, 0, (size_t)buf.size);
> 
>  buf.use = 0 means we are using 0 bytes of the buffer. That's the semantic
> of buffer usage, if you really want to make it zero terminated, just use
>        buf.content[0] = 0;
> 
> >      xml = xmlReadDoc((const xmlChar *) xmldesc, "domain.xml", NULL,
> >                       XML_PARSE_NOENT | XML_PARSE_NONET |
> >                       XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
> > @@ -1492,6 +1493,9 @@ virParseXMLDevice(virConnectPtr conn, ch
> >      if (xmlStrEqual(node->name, BAD_CAST "disk")) {
> >          if (virDomainParseXMLDiskDesc(conn, node, &buf, hvm, xendConfigVersion) != 0)
> >              goto error;
> > +         /* SXP is not created when device is "floppy". */
> > +        else if (!strlen(buf.content))
> > +            goto error;
> 
>   use buf->use instead of strlen(buf.content)
> 
> If you provide the XML to reproduce it I could double-check this, 
> 
>   thanks,
> 
> Daniel
> 
> -- 
> Red Hat Virtualization group http://redhat.com/virtualization/
> Daniel Veillard      | virtualization library  http://libvirt.org/
> veillard@xxxxxxxxxx  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
> http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/
> 
<disk type='file' device='floppy'>
  <driver name='file'/>
  <source file='/dev/sda10'/>
  <target dev='hda'/>
</disk>

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]