If a dir does not exist, raise an immediate error in logs
rather than letting virFileResolveAllLinks fail, since this
gives better error reporting to the user.
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
{
char *newroot;
size_t i;
+ char ebuf[1024];
VIR_DEBUG("Resolving symlinks");
virDomainFSDefPtr fs = vmDef->fss[i];
if (!fs->src)
continue;
+
+ if (access(fs->src, F_OK)) {
+ VIR_DEBUG("Failed to access '%s': %s", fs->src,
+ virStrerror(errno, ebuf, sizeof(ebuf)));
+ return -1;
+ }
+
VIR_DEBUG("Resolving '%s'", fs->src);
if (virFileResolveAllLinks(fs->src, &newroot) < 0) {
VIR_DEBUG("Failed to resolve symlink at %s", fs->src);