Commit 98ec75d6 authored by Iustin Pop's avatar Iustin Pop
Browse files

KVM: Split out the pidfile computation

In some cases we only need the pidfile, but not the pid or the alive
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarOlivier Tharan <>
parent d1b83918
......@@ -94,11 +94,18 @@ class KVMHypervisor(hv_base.BaseHypervisor):
dirs = [(dname, constants.RUN_DIRS_MODE) for dname in self._DIRS]
def _InstancePidFile(self, instance_name):
"""Returns the instance pidfile.
pidfile = "%s/%s" % (self._PIDS_DIR, instance_name)
return pidfile
def _InstancePidAlive(self, instance_name):
"""Returns the instance pid and pidfile
pidfile = "%s/%s" % (self._PIDS_DIR, instance_name)
pidfile = self._InstancePidFile(instance_name)
pid = utils.ReadPidFile(pidfile)
alive = utils.IsProcessAlive(pid)
......@@ -289,7 +296,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
"""Generate KVM information to start an instance.
pidfile, pid, alive = self._InstancePidAlive(
pidfile = self._InstancePidFile(
kvm = constants.KVM_PATH
kvm_cmd = [kvm]
kvm_cmd.extend(['-m', instance.beparams[constants.BE_MEMORY]])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment