mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
Honour root prefix in lxcContainerMountFSBlockAuto
The lxcContainerMountFSBlockAuto method can be used to mount the initial root filesystem, so it cannot assume a prefix of /.oldroot. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
3abb6ec077
commit
2d07f84302
@ -1144,7 +1144,8 @@ lxcContainerMountDetectFilesystem(const char *src ATTRIBUTE_UNUSED,
|
|||||||
*/
|
*/
|
||||||
static int lxcContainerMountFSBlockAuto(virDomainFSDefPtr fs,
|
static int lxcContainerMountFSBlockAuto(virDomainFSDefPtr fs,
|
||||||
int fsflags,
|
int fsflags,
|
||||||
const char *src)
|
const char *src,
|
||||||
|
const char *srcprefix)
|
||||||
{
|
{
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -1154,11 +1155,11 @@ static int lxcContainerMountFSBlockAuto(virDomainFSDefPtr fs,
|
|||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
const char *type;
|
const char *type;
|
||||||
|
|
||||||
VIR_DEBUG("src=%s dst=%s", src, fs->dst);
|
VIR_DEBUG("src=%s dst=%s srcprefix=%s", src, fs->dst, srcprefix);
|
||||||
|
|
||||||
/* First time around we use /etc/filesystems */
|
/* First time around we use /etc/filesystems */
|
||||||
retry:
|
retry:
|
||||||
if (virAsprintf(&fslist, "/.oldroot%s",
|
if (virAsprintf(&fslist, "%s%s", srcprefix,
|
||||||
tryProc ? "/proc/filesystems" : "/etc/filesystems") < 0)
|
tryProc ? "/proc/filesystems" : "/etc/filesystems") < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -1270,7 +1271,8 @@ cleanup:
|
|||||||
* probing for filesystem type
|
* probing for filesystem type
|
||||||
*/
|
*/
|
||||||
static int lxcContainerMountFSBlockHelper(virDomainFSDefPtr fs,
|
static int lxcContainerMountFSBlockHelper(virDomainFSDefPtr fs,
|
||||||
const char *src)
|
const char *src,
|
||||||
|
const char *srcprefix)
|
||||||
{
|
{
|
||||||
int fsflags = 0;
|
int fsflags = 0;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -1300,7 +1302,7 @@ static int lxcContainerMountFSBlockHelper(virDomainFSDefPtr fs,
|
|||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
} else {
|
} else {
|
||||||
ret = lxcContainerMountFSBlockAuto(fs, fsflags, src);
|
ret = lxcContainerMountFSBlockAuto(fs, fsflags, src, srcprefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -1318,7 +1320,7 @@ static int lxcContainerMountFSBlock(virDomainFSDefPtr fs,
|
|||||||
if (virAsprintf(&src, "%s%s", srcprefix, fs->src) < 0)
|
if (virAsprintf(&src, "%s%s", srcprefix, fs->src) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = lxcContainerMountFSBlockHelper(fs, src);
|
ret = lxcContainerMountFSBlockHelper(fs, src, srcprefix);
|
||||||
|
|
||||||
VIR_DEBUG("Done mounting filesystem ret=%d", ret);
|
VIR_DEBUG("Done mounting filesystem ret=%d", ret);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user