Zhou Zheng Sheng has posted comments on this change. Change subject: vdsmd.init: Add init adapter ......................................................................
Patch Set 1: (5 inline comments) .................................................... File vdsm/init/daemonAdapter Line 38: help='Ajust nice according to configuration file') Line 39: parser.add_argument('-r', '--respawn-pid-file', dest='respawnPidFile', Line 40: default=None, metavar='respawn_pid_file_path', Line 41: help='Run with respawn watchdog protection and ' Line 42: 'specify the respawn pid file path') 1. Yes, my mistake. shell script can exec a command without fork. With respawn, it forks VDSM, without respawn, it can exec VDSM directly. 2. Currently the pid file is created by VDSM itself. The SysV init wrapper does not create the empty pid file nor delete the pid file after stop. Maybe it's a bug... I think we can add a --no-pidfile option to VDSM main entry to skip pidfile creation, but I'm not sure if the pidfile is used by other subsystems, modules, tools, ... So in this patch, I kept all the pid related things the same as it was. Line 43: args = parser.parse_args(sys.argv[1:]) Line 44: return args Line 45: Line 46: if __name__ == '__main__': Line 51: os.nice(config.getint('vars', 'vdsm_nice')) Line 52: except OSError as e: Line 53: sys.stderr.write("daemon adapter: failed to renice, %s" % e) Line 54: Line 55: if args.user is not None: Good idea, we can have supervdsm renice vdsm, because -20 looks too extreme even it is only at the start. Line 56: userPw = pwd.getpwnam(args.user) Line 57: os.environ.update({ Line 58: 'LOGNAME': userPw.pw_name, Line 59: 'USER': userPw.pw_name, Line 64: Line 65: cmd = [] Line 66: if args.respawnPidFile: Line 67: cmd += [os.path.join(P_VDSM, 'respawn'), '--minlifetime', '10', Line 68: '--daemon', '--masterpid', args.respawnPidFile] Sounds good. Line 69: Line 70: cmd.append(os.path.join(P_VDSM, 'vdsm')) Line 71: Line 72: env = os.environ Line 82: os.open("/dev/null", os.O_RDONLY) Line 83: os.close(1) Line 84: os.open("/dev/null", os.O_WRONLY) Line 85: os.close(2) Line 86: os.open("/dev/null", os.O_WRONLY) Done Line 87: Line 84: os.open("/dev/null", os.O_WRONLY) Line 85: os.close(2) Line 86: os.open("/dev/null", os.O_WRONLY) Line 87: Line 88: os.execve(cmd[0], cmd, env) I think your first idea is better, use supervdsm to renice vdsm. The vdsm main process passes its pid and required nice level to supervdsm, then supervice renice the pid, simple and clean. Care must be taken to make sure the renice action happens before vdsm forks any child. -- To view, visit http://gerrit.ovirt.org/15578 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id8e514df1ca88500f746242134ddb24c31588046 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng <zhshz...@linux.vnet.ibm.com> Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com> Gerrit-Reviewer: Mark Wu <wu...@linux.vnet.ibm.com> Gerrit-Reviewer: Yaniv Bronhaim <ybron...@redhat.com> Gerrit-Reviewer: Zhou Zheng Sheng <zhshz...@linux.vnet.ibm.com> Gerrit-Reviewer: oVirt Jenkins CI Server _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches