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

[Xen-devel] [PATCH]: libxl: function libxl_device_disk_add returns error when detecting the vbd does not exist


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • 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
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • 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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.