: libxl: function libxl_device_disk_add returns error when detecting the vbd does not exist
PATCH 1/1 : 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 <[email protected]>
tools/libxl/libxl.c +4 -1
@@ -1814,7 +1814,10 @@ int libxl_device_disk_add(libxl_ctx *ctxswitch (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