mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
LXC: Fix some error reporting in filesystem setup
A couple of places in LXC setup for filesystems did not do a "goto cleanup" after reporting errors. While fixing this, also add in many more debug statements to aid troubleshooting Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
1a82e01c97
commit
2e832b18d6
@ -618,6 +618,8 @@ static int lxcContainerPrepareRoot(virDomainDefPtr def,
|
|||||||
char *dst;
|
char *dst;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
|
VIR_DEBUG("Prepare root %d", root->type);
|
||||||
|
|
||||||
if (root->type == VIR_DOMAIN_FS_TYPE_MOUNT)
|
if (root->type == VIR_DOMAIN_FS_TYPE_MOUNT)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1286,7 +1288,8 @@ static int lxcContainerMountFSBlockHelper(virDomainFSDefPtr fs,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (format) {
|
if (format) {
|
||||||
VIR_DEBUG("Mount %s with detected format %s", src, format);
|
VIR_DEBUG("Mount '%s' on '%s' with detected format '%s'",
|
||||||
|
src, fs->dst, format);
|
||||||
if (mount(src, fs->dst, format, fsflags, NULL) < 0) {
|
if (mount(src, fs->dst, format, fsflags, NULL) < 0) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("Failed to mount device %s to %s as %s"),
|
_("Failed to mount device %s to %s as %s"),
|
||||||
@ -1391,12 +1394,12 @@ static int lxcContainerMountFS(virDomainFSDefPtr fs,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unexpected filesystem type %s"),
|
_("Unexpected filesystem type %s"),
|
||||||
virDomainFSTypeToString(fs->type));
|
virDomainFSTypeToString(fs->type));
|
||||||
break;
|
return -1;
|
||||||
default:
|
default:
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Cannot mount filesystem type %s"),
|
_("Cannot mount filesystem type %s"),
|
||||||
virDomainFSTypeToString(fs->type));
|
virDomainFSTypeToString(fs->type));
|
||||||
break;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1570,8 +1573,9 @@ static int lxcContainerResolveSymlinks(virDomainDefPtr vmDef)
|
|||||||
virDomainFSDefPtr fs = vmDef->fss[i];
|
virDomainFSDefPtr fs = vmDef->fss[i];
|
||||||
if (!fs->src)
|
if (!fs->src)
|
||||||
continue;
|
continue;
|
||||||
|
VIR_DEBUG("Resolving '%s'", fs->src);
|
||||||
if (virFileResolveAllLinks(fs->src, &newroot) < 0) {
|
if (virFileResolveAllLinks(fs->src, &newroot) < 0) {
|
||||||
VIR_DEBUG("Fail to resolve link %s", fs->src);
|
VIR_DEBUG("Failed to resolve symlink at %s", fs->src);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1580,6 +1584,7 @@ static int lxcContainerResolveSymlinks(virDomainDefPtr vmDef)
|
|||||||
VIR_FREE(fs->src);
|
VIR_FREE(fs->src);
|
||||||
fs->src = newroot;
|
fs->src = newroot;
|
||||||
}
|
}
|
||||||
|
VIR_DEBUG("Resolved all filesystem symlinks");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1708,6 +1713,7 @@ static int lxcContainerChild(void *data)
|
|||||||
if (lxcContainerResolveSymlinks(vmDef) < 0)
|
if (lxcContainerResolveSymlinks(vmDef) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
VIR_DEBUG("Setting up pivot");
|
||||||
if (lxcContainerSetupPivotRoot(vmDef, root,
|
if (lxcContainerSetupPivotRoot(vmDef, root,
|
||||||
argv->ttyPaths, argv->nttyPaths,
|
argv->ttyPaths, argv->nttyPaths,
|
||||||
argv->securityDriver) < 0)
|
argv->securityDriver) < 0)
|
||||||
|
@ -453,6 +453,8 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl)
|
|||||||
size_t i;
|
size_t i;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
|
VIR_DEBUG("Setting up loop devices for filesystems");
|
||||||
|
|
||||||
for (i = 0; i < ctrl->def->nfss; i++) {
|
for (i = 0; i < ctrl->def->nfss; i++) {
|
||||||
virDomainFSDefPtr fs = ctrl->def->fss[i];
|
virDomainFSDefPtr fs = ctrl->def->fss[i];
|
||||||
int fd;
|
int fd;
|
||||||
@ -486,9 +488,12 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl)
|
|||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("fs driver %s is not supported"),
|
_("fs driver %s is not supported"),
|
||||||
virDomainFSDriverTypeTypeToString(fs->fsdriver));
|
virDomainFSDriverTypeTypeToString(fs->fsdriver));
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VIR_DEBUG("Setting up loop devices for disks");
|
||||||
|
|
||||||
for (i = 0; i < ctrl->def->ndisks; i++) {
|
for (i = 0; i < ctrl->def->ndisks; i++) {
|
||||||
virDomainDiskDefPtr disk = ctrl->def->disks[i];
|
virDomainDiskDefPtr disk = ctrl->def->disks[i];
|
||||||
int fd;
|
int fd;
|
||||||
@ -541,6 +546,7 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl)
|
|||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("disk driver %s is not supported"),
|
_("disk driver %s is not supported"),
|
||||||
disk->driverName);
|
disk->driverName);
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user