mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +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 *tmp;
|
||||
|
||||
VIR_DEBUG("Prepare root %d", root->type);
|
||||
|
||||
if (root->type == VIR_DOMAIN_FS_TYPE_MOUNT)
|
||||
return 0;
|
||||
|
||||
@ -1286,7 +1288,8 @@ static int lxcContainerMountFSBlockHelper(virDomainFSDefPtr fs,
|
||||
goto cleanup;
|
||||
|
||||
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) {
|
||||
virReportSystemError(errno,
|
||||
_("Failed to mount device %s to %s as %s"),
|
||||
@ -1391,12 +1394,12 @@ static int lxcContainerMountFS(virDomainFSDefPtr fs,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unexpected filesystem type %s"),
|
||||
virDomainFSTypeToString(fs->type));
|
||||
break;
|
||||
return -1;
|
||||
default:
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Cannot mount filesystem type %s"),
|
||||
virDomainFSTypeToString(fs->type));
|
||||
break;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1570,8 +1573,9 @@ static int lxcContainerResolveSymlinks(virDomainDefPtr vmDef)
|
||||
virDomainFSDefPtr fs = vmDef->fss[i];
|
||||
if (!fs->src)
|
||||
continue;
|
||||
VIR_DEBUG("Resolving '%s'", fs->src);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1580,6 +1584,7 @@ static int lxcContainerResolveSymlinks(virDomainDefPtr vmDef)
|
||||
VIR_FREE(fs->src);
|
||||
fs->src = newroot;
|
||||
}
|
||||
VIR_DEBUG("Resolved all filesystem symlinks");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1708,6 +1713,7 @@ static int lxcContainerChild(void *data)
|
||||
if (lxcContainerResolveSymlinks(vmDef) < 0)
|
||||
goto cleanup;
|
||||
|
||||
VIR_DEBUG("Setting up pivot");
|
||||
if (lxcContainerSetupPivotRoot(vmDef, root,
|
||||
argv->ttyPaths, argv->nttyPaths,
|
||||
argv->securityDriver) < 0)
|
||||
|
@ -453,6 +453,8 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl)
|
||||
size_t i;
|
||||
int ret = -1;
|
||||
|
||||
VIR_DEBUG("Setting up loop devices for filesystems");
|
||||
|
||||
for (i = 0; i < ctrl->def->nfss; i++) {
|
||||
virDomainFSDefPtr fs = ctrl->def->fss[i];
|
||||
int fd;
|
||||
@ -486,9 +488,12 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl)
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("fs driver %s is not supported"),
|
||||
virDomainFSDriverTypeTypeToString(fs->fsdriver));
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
VIR_DEBUG("Setting up loop devices for disks");
|
||||
|
||||
for (i = 0; i < ctrl->def->ndisks; i++) {
|
||||
virDomainDiskDefPtr disk = ctrl->def->disks[i];
|
||||
int fd;
|
||||
@ -541,6 +546,7 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl)
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("disk driver %s is not supported"),
|
||||
disk->driverName);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user