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

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

 



Hi

Would you give me a comment on this patch?
If not, please apply it.

Thanks,
Masayuki Sunou.

In message <200705251942.EHG12443.279NEGK3@xxxxxxxxxxxxxxxxx>
   " [PATCH] Fix strange error message in virsh attach-device"
   "Masayuki Sunou <fj1826dm@xxxxxxxxxxxxxxxxx>" 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

This patch fixes this strange error message displaying "@\x14\xce".

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);
     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;
     }
     else if (xmlStrEqual(node->name, BAD_CAST "interface")) {
         if (virDomainParseXMLIfDesc(conn, node, &buf, hvm) != 0)
----------------------------------------------------------------------

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[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]