virtcontainers: change container's rootfs from string to mount alike struct

container's rootfs is a string type, which cannot represent a
block storage backed rootfs which hasn't been mounted.
Change it to a mount alike struct as below:
    RootFs struct {
            // Source specify the BlockDevice path
            Source string
            // Target specify where the rootfs is mounted if it has been mounted
            Target string
            // Type specifies the type of filesystem to mount.
            Type string
            // Options specifies zero or more fstab style mount options.
            Options []string
            // Mounted specifies whether the rootfs has be mounted or not
            Mounted bool
     }

If the container's rootfs has been mounted as before, then this struct can be
initialized as: RootFs{Target: <rootfs>, Mounted: true} to be compatible with
previous case.

Fixes:#1158

Signed-off-by: lifupan <lifupan@gmail.com>
This commit is contained in:
lifupan
2019-04-02 10:54:05 +08:00
parent 8e72cf15e6
commit 628ea46c58
16 changed files with 174 additions and 50 deletions

View File

@@ -594,7 +594,7 @@ func createContainer(context *cli.Context) error {
containerConfig := vc.ContainerConfig{
ID: id,
RootFs: context.String("rootfs"),
RootFs: vc.RootFs{Target: context.String("rootfs"), Mounted: true},
Cmd: cmd,
}