Merge pull request #16873 from wanyaoqi/fix/cgrouputils-check-group-enabled

fix(host): compatible ouler
This commit is contained in:
Zexi Li
2023-04-27 09:37:34 +08:00
committed by GitHub
3 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -1712,7 +1712,7 @@ func (s *SKVMGuestInstance) pyLauncherPath() string {
}
func (s *SKVMGuestInstance) scriptStart(ctx context.Context) error {
output, err := procutils.NewRemoteCommandAsFarAsPossible("python2", s.pyLauncherPath()).Output()
output, err := procutils.NewRemoteCommandAsFarAsPossible("python", s.pyLauncherPath()).Output()
if err != nil {
return fmt.Errorf("Start VM Failed %s %s", output, err)
}
+2 -3
View File
@@ -63,8 +63,7 @@ const (
DISK_DRIVER_SATA = qemu.DISK_DRIVER_SATA
)
const guestLauncher = `
#!/usr/bin/env python
const guestLauncher = `#!/usr/bin/env python
import sys
import os
import time
@@ -111,7 +110,7 @@ else:
logfd = os.open('%s', os.O_RDWR|os.O_CREAT|os.O_APPEND)
os.dup2(logfd, 1)
os.dup2(logfd, 2)
os.write(logfd, '%%s Run command: %%s\n' %% (time.strftime('%%Y-%%m-%%d %%H:%%M:%%S', time.localtime()), cmd))
os.write(logfd, str.encode('%%s Run command: %%s\n' %% (time.strftime('%%Y-%%m-%%d %%H:%%M:%%S', time.localtime()), cmd)))
os.close(logfd)
if os.execv(cmd[0], cmd) < 0:
+4
View File
@@ -380,10 +380,14 @@ func (c *CGroupTask) init() bool {
re := regexp.MustCompile(`\s+`)
scanner := bufio.NewScanner(file)
for scanner.Scan() {
// #subsys_name hierarchy num_cgroups enabled
line := scanner.Text()
if line[0] != '#' {
parts := re.Split(line, -1)
module := parts[0]
if parts[3] == "0" { // disabled
continue
}
if !ModuleIsMounted(module) {
moduleDir := path.Join(cgroupsPath, module)
if !fileutils2.Exists(moduleDir) {