WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH]: libxl: function libxl_device_disk_add returns error

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH]: libxl: function libxl_device_disk_add returns error when detecting the vbd does not exist
From: "Jun Zhu (Intern)" <Jun.Zhu@xxxxxxxxxx>
Date: Tue, 21 Sep 2010 12:03:08 +0100
Accept-language: en-US
Acceptlanguage: en-US
Delivery-date: Tue, 21 Sep 2010 04:04:25 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AQHLWXyS0wbnDoqdyESV3LWz+QFsXA==
Thread-topic: [PATCH]: libxl: function libxl_device_disk_add returns error when detecting the vbd does not exist
This patch returns error to the invoker when the phy:/* vbd does not exist. 
I think it can be improved to better.  libxl_device_disk_add is called in 
libxl/xl_cmdimpl.c, libxl/libxl.c, and ocaml/libs/xl/xl_stubs.c. If the error 
log is outputed in  libxl_device_disk_add, it is better. 
But it has to modify these invokers. 

What's your option?

Signed-off-by: Jun Zhu <Jun.Zhu@xxxxxxxxxx>

diff -r 6d272b3f900b tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue Sep 21 11:40:25 2010 +0100
+++ b/tools/libxl/libxl.c       Tue Sep 21 11:51:48 2010 +0100
@@ -1814,7 +1814,10 @@ int libxl_device_disk_add(libxl_ctx *ctx
     switch (disk->phystype) {
         case PHYSTYPE_PHY: {
 
-            libxl__device_physdisk_major_minor(disk->physpath, &major, &minor);
+            if (libxl__device_physdisk_major_minor(disk->physpath, &major, 
&minor) < 0) {
+                rc = ERROR_INVAL;
+                goto out_free;
+            }
             flexarray_set(back, boffset++, "physical-device");
             flexarray_set(back, boffset++, libxl__sprintf(&gc, "%x:%x", major, 
minor));


Jun Zhu
Citrix Systems UK
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH]: libxl: function libxl_device_disk_add returns error when detecting the vbd does not exist, Jun Zhu (Intern) <=