Jun Zhu (Intern)
2010-Sep-21 11:03 UTC
[Xen-devel] [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@citrix.com>
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@lists.xensource.com
http://lists.xensource.com/xen-devel