Hi If specified device source does not exist, Not appropriate error is displayed. ---------------------------------------------------------------------- # virsh attach-disk PV_FC7_14 NOT_EXIST_PATH xvdd libvir: Xen Daemon error : POST operation failed: (xend.err 'Device 51760 (vbd) could not be connected. Hotplug scripts not working.') ---------------------------------------------------------------------- This patch checks the existence of the device source path, and correct message is displayed in case of error. Signed-off-by: Masayuki Sunou <fj1826dm@xxxxxxxxxxxxxxxxx> Thanks, Masayuki Sunou. -------------------------------------------------------------------------------- Index: include/libvirt/virterror.h =================================================================== RCS file: /data/cvs/libvirt/include/libvirt/virterror.h,v retrieving revision 1.26 diff -u -p -r1.26 virterror.h --- include/libvirt/virterror.h 6 Jul 2007 14:56:15 -0000 1.26 +++ include/libvirt/virterror.h 12 Jul 2007 00:07:27 -0000 @@ -127,6 +127,7 @@ typedef enum { VIR_WAR_NO_NETWORK, /* failed to start network */ VIR_ERR_NO_DOMAIN, /* domain not found or unexpectedly disappeared */ VIR_ERR_NO_NETWORK, /* network not found */ + VIR_ERR_NO_DEVICE_SOURCE, /* device source not found */ } virErrorNumber; /** Index: src/virterror.c =================================================================== RCS file: /data/cvs/libvirt/src/virterror.c,v retrieving revision 1.28 diff -u -p -r1.28 virterror.c --- src/virterror.c 6 Jul 2007 14:56:15 -0000 1.28 +++ src/virterror.c 12 Jul 2007 00:07:28 -0000 @@ -646,6 +646,12 @@ __virErrorMsg(virErrorNumber error, cons else errmsg = _("Network not found: %s"); break; + case VIR_ERR_NO_DEVICE_SOURCE: + if (info == NULL) + errmsg = _("Device source not found"); + else + errmsg = _("Device source not found: %s"); + break; } return (errmsg); } Index: src/xml.c =================================================================== RCS file: /data/cvs/libvirt/src/xml.c,v retrieving revision 1.81 diff -u -p -r1.81 xml.c --- src/xml.c 11 Jul 2007 08:41:11 -0000 1.81 +++ src/xml.c 12 Jul 2007 00:07:28 -0000 @@ -18,6 +18,7 @@ #include <xs.h> #endif #include <math.h> /* for isnan() */ +#include <sys/stat.h> #include "internal.h" #include "hash.h" #include "sexpr.h" @@ -720,6 +721,7 @@ virDomainParseXMLDiskDesc(virConnectPtr int cdrom = 0; int isNoSrcCdrom = 0; int ret = 0; + struct stat st; type = xmlGetProp(node, BAD_CAST "type"); if (type != NULL) { @@ -772,6 +774,12 @@ virDomainParseXMLDiskDesc(virConnectPtr ret = -1; goto cleanup; } + } else { + if (stat(source, &st) == -1) { + virXMLError(conn, VIR_ERR_NO_DEVICE_SOURCE, (const char *) source, 0); + ret = -1; + goto cleanup; + } } if (target == NULL) { virXMLError(conn, VIR_ERR_NO_TARGET, (const char *) source, 0); -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list