Implement Power On / Off of instance
Provides the implementation in the nova driver for the instance power on and off functions. Change-Id: I5f79af11194447502b880ee5907476a19af7d036
This commit is contained in:
parent
70b989d85b
commit
c99453bcab
|
@ -24,6 +24,7 @@ from oslo.config import cfg
|
|||
|
||||
from pypowervm import adapter as pvm_apt
|
||||
from pypowervm.helpers import log_helper as log_hlp
|
||||
from pypowervm.jobs import power
|
||||
from pypowervm.wrappers import constants as pvm_consts
|
||||
from pypowervm.wrappers import managed_system as msentry_wrapper
|
||||
|
||||
|
@ -175,11 +176,21 @@ class PowerVMDriver(driver.ComputeDriver):
|
|||
|
||||
def power_off(self, instance):
|
||||
"""Power off the specified instance."""
|
||||
raise NotImplementedError()
|
||||
power.power_off(self.adapter,
|
||||
vm.get_instance_wrapper(self.adapter,
|
||||
instance,
|
||||
self.pvm_uuids,
|
||||
self._get_host_uuid()),
|
||||
self.host_uuid)
|
||||
|
||||
def power_on(self, instance):
|
||||
"""Power on the specified instance."""
|
||||
raise NotImplementedError()
|
||||
power.power_on(self.adapter,
|
||||
vm.get_instance_wrapper(self.adapter,
|
||||
instance,
|
||||
self.pvm_uuids,
|
||||
self._get_host_uuid()),
|
||||
self.host_uuid)
|
||||
|
||||
def get_available_resource(self, nodename):
|
||||
"""Retrieve resource information.
|
||||
|
|
|
@ -175,6 +175,21 @@ def get_lpar_list(adapter, host_uuid):
|
|||
return lpar_list
|
||||
|
||||
|
||||
def get_instance_wrapper(adapter, instance, pvm_uuids, host_uuid):
|
||||
"""Get the LogicalPartition wrapper for a given Nova instance.
|
||||
|
||||
:param adapter: The adapter for the pypowervm API
|
||||
:param instance: The nova instance.
|
||||
:param pvm_uuids: The PowerVM UUID map (from the UUIDCache)
|
||||
:param host_uuid: (TEMPORARY) The host UUID
|
||||
:returns: The pypowervm logical_partition wrapper.
|
||||
"""
|
||||
pvm_inst_uuid = pvm_uuids.lookup(instance.name)
|
||||
entry = adapter.read(pvm_consts.MGT_SYS, host_uuid,
|
||||
pvm_consts.LPAR, pvm_inst_uuid)
|
||||
return pvm_lpar.LogicalPartition(entry)
|
||||
|
||||
|
||||
class UUIDCache(object):
|
||||
"""Cache of instance names to PVM UUID value
|
||||
|
||||
|
|
Loading…
Reference in New Issue