Commit c4fbefc8 authored by Guido Trotter's avatar Guido Trotter
Browse files

KVM: Remove sockets after shutdown

Abstract the monitor and serial socket naming in two functions, and
reuse them to cleanup the files after shutdown.

Reviewed-by: iustinp
parent c4469f75
......@@ -57,6 +57,18 @@ class KVMHypervisor(hv_base.BaseHypervisor):
if not os.path.exists(mydir):
def _InstanceMonitor(self, instance_name):
"""Returns the instance monitor socket name
return '%s/%s.monitor' % (self._CTRL_DIR, instance_name)
def _InstanceSerial(self, instance_name):
"""Returns the instance serial socket name
return '%s/%s.serial' % (self._CTRL_DIR, instance_name)
def _WriteNetScript(self, instance, seq, nic):
"""Write a script to connect a net interface to the proper bridge.
......@@ -229,10 +241,10 @@ class KVMHypervisor(hv_base.BaseHypervisor):
# How do we decide whether to have it or not?? :(
base_control = '%s/%s' % (self._CTRL_DIR,
monitor_dev = 'unix:%s.monitor,server,nowait' % base_control
monitor_dev = 'unix:%s,server,nowait' % \
kvm_cmd.extend(['-monitor', monitor_dev])
serial_dev = 'unix:%s.serial,server,nowait' % base_control
serial_dev = 'unix:%s,server,nowait' % self._InstanceSerial(
kvm_cmd.extend(['-serial', serial_dev])
result = utils.RunCmd(kvm_cmd)
......@@ -270,6 +282,8 @@ class KVMHypervisor(hv_base.BaseHypervisor):
if not utils.IsProcessAlive(pid):
def RebootInstance(self, instance):
"""Reboot an instance.
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