Remove unused InstanceInfo class
We switched to using nova's InstanceInfo class a while ago [1] but
failed to remove our now-unused subclass. This cleans that up.
[1] a4e0721c6b
Change-Id: I214175f61796578e87aed82caa16828aa1c6cebc
This commit is contained in:
parent
cce490f918
commit
a92fb59ab7
|
@ -151,80 +151,6 @@ def _translate_vm_state(pvm_state):
|
|||
return nova_state
|
||||
|
||||
|
||||
class InstanceInfo(hardware.InstanceInfo):
|
||||
"""Instance Information
|
||||
|
||||
This object tries to lazy load the attributes since the compute
|
||||
manager retrieves it a lot just to check the status and doesn't need
|
||||
all the attributes.
|
||||
|
||||
:param adapter: pypowervm adapter
|
||||
:param name: instance name
|
||||
:param uuid: powervm uuid
|
||||
"""
|
||||
def __init__(self, adapter, name, uuid):
|
||||
self._adapter = adapter
|
||||
self._name = name
|
||||
self._uuid = uuid
|
||||
self._state = None
|
||||
self._mem_kb = None
|
||||
self._max_mem_kb = None
|
||||
self._num_cpu = None
|
||||
# Non-lazy loaded properties
|
||||
self.cpu_time_ns = 0
|
||||
# Todo(IBM) Should this be the instance UUID vs PowerVM?
|
||||
self.id = uuid
|
||||
|
||||
def _get_property(self, q_prop):
|
||||
return get_vm_qp(self._adapter, self._uuid, q_prop)
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
# return the state if we previously loaded it
|
||||
if self._state is not None:
|
||||
return self._state
|
||||
|
||||
# otherwise, fetch the value now
|
||||
pvm_state = self._get_property('PartitionState')
|
||||
self._state = _translate_vm_state(pvm_state)
|
||||
return self._state
|
||||
|
||||
@property
|
||||
def mem_kb(self):
|
||||
# return the memory if we previously loaded it
|
||||
if self._mem_kb is not None:
|
||||
return self._mem_kb
|
||||
|
||||
# otherwise, fetch the value now
|
||||
pvm_mem_kb = self._get_property('CurrentMemory')
|
||||
self._mem_kb = pvm_mem_kb
|
||||
return self._mem_kb
|
||||
|
||||
@property
|
||||
def max_mem_kb(self):
|
||||
# return the max memory if we previously loaded it
|
||||
if self._max_mem_kb is not None:
|
||||
return self._max_mem_kb
|
||||
|
||||
# TODO(IBM) max isn't a quick property. We need the wrapper
|
||||
return self.mem_kb()
|
||||
|
||||
@property
|
||||
def num_cpu(self):
|
||||
# return the number of cpus if we previously loaded it
|
||||
if self._num_cpu is not None:
|
||||
return self._num_cpu
|
||||
|
||||
# otherwise, fetch the value now
|
||||
pvm_num_cpu = self._get_property('AllocatedVirtualProcessors')
|
||||
self._num_cpu = pvm_num_cpu
|
||||
return self._num_cpu
|
||||
|
||||
def __eq__(self, other):
|
||||
return (self.__class__ == other.__class__ and
|
||||
self._uuid == other._uuid)
|
||||
|
||||
|
||||
class VMBuilder(object):
|
||||
"""Converts a Nova Instance/Flavor into a pypowervm LPARBuilder."""
|
||||
|
||||
|
|
Loading…
Reference in New Issue