From 422a26c501782cb566cf2a2f978dd77c17e9a5e6 Mon Sep 17 00:00:00 2001 From: Crazykev Date: Wed, 17 May 2017 19:11:05 +0800 Subject: [PATCH] add symbol link vm root in container root dir Signed-off-by: Crazykev --- supervisor/container.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/supervisor/container.go b/supervisor/container.go index 69866e3b..e31ccb81 100644 --- a/supervisor/container.go +++ b/supervisor/container.go @@ -157,6 +157,13 @@ func (c *Container) create() error { return err } + // Create vm root dir symbol link in container root dir + vmRootLinkPath := filepath.Join(stateDir, "vm-root") + vmRootPath := filepath.Join(hypervisor.BaseDir, c.ownerPod.vm.Id) + if err := os.Symlink(vmRootPath, vmRootLinkPath); err != nil { + return fmt.Errorf("failed to create symbol link %q: %v", vmRootLinkPath, err) + } + err = execPrestartHooks(c.Spec, state) if err != nil { glog.V(1).Infof("execute Prestart hooks failed, %s\n", err.Error())