From 0df4d98a76571d95ed1cf26cb27ac752455b17b6 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Tue, 27 Jan 2009 11:30:57 +0000 Subject: [PATCH] KVM: classify _Instance{Monitor,Serial,KVMRuntime} Those methods need nothing from the instantiated class, and just manipulate strings, and fetch some class global variables, so they can be classmethods. Reviewed-by: iustinp --- lib/hypervisor/hv_kvm.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index fce3575cf..c01b391db 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -75,23 +75,26 @@ class KVMHypervisor(hv_base.BaseHypervisor): return (pidfile, pid, alive) - def _InstanceMonitor(self, instance_name): + @classmethod + def _InstanceMonitor(cls, instance_name): """Returns the instance monitor socket name """ - return '%s/%s.monitor' % (self._CTRL_DIR, instance_name) + return '%s/%s.monitor' % (cls._CTRL_DIR, instance_name) - def _InstanceSerial(self, instance_name): + @classmethod + def _InstanceSerial(cls, instance_name): """Returns the instance serial socket name """ - return '%s/%s.serial' % (self._CTRL_DIR, instance_name) + return '%s/%s.serial' % (cls._CTRL_DIR, instance_name) - def _InstanceKVMRuntime(self, instance_name): + @classmethod + def _InstanceKVMRuntime(cls, instance_name): """Returns the instance KVM runtime filename """ - return '%s/%s.runtime' % (self._CONF_DIR, instance_name) + return '%s/%s.runtime' % (cls._CONF_DIR, instance_name) def _WriteNetScript(self, instance, seq, nic): """Write a script to connect a net interface to the proper bridge. -- GitLab