Changes needed for the pypowervm refactor
Changed the driver to use new pypowervm interfaces. Change-Id: Ia2d3d56b8f4eae85103822bba1a11fafddcc2830
This commit is contained in:
parent
37e76fe8ec
commit
b62940706f
|
@ -30,8 +30,8 @@ from nova_powervm.virt.powervm import vm
|
||||||
LPAR_HTTPRESP_FILE = "lpar.txt"
|
LPAR_HTTPRESP_FILE = "lpar.txt"
|
||||||
LPAR_MAPPING = (
|
LPAR_MAPPING = (
|
||||||
{
|
{
|
||||||
'nova-z3-9-5-126-127-00000001': '089ffb20-5d19-4a8c-bb80-13650627d985',
|
'z3-9-5-126-127-00000001': '089ffb20-5d19-4a8c-bb80-13650627d985',
|
||||||
'nova-z3-9-5-126-208-000001f0': '668b0882-c24a-4ae9-91c8-297e95e3fe29'
|
'z3-9-5-126-208-000001f0': '668b0882-c24a-4ae9-91c8-297e95e3fe29'
|
||||||
})
|
})
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
@ -91,7 +91,7 @@ class TestVM(test.TestCase):
|
||||||
return self.resp
|
return self.resp
|
||||||
|
|
||||||
mock_adr.read.side_effect = return_response
|
mock_adr.read.side_effect = return_response
|
||||||
self.assertEqual(cache.lookup('nova-z3-9-5-126-127-00000001'),
|
self.assertEqual(cache.lookup('z3-9-5-126-127-00000001'),
|
||||||
'089ffb20-5d19-4a8c-bb80-13650627d985'.upper())
|
'089ffb20-5d19-4a8c-bb80-13650627d985'.upper())
|
||||||
# Test it returns None even when we try to look it up
|
# Test it returns None even when we try to look it up
|
||||||
self.assertEqual(cache.lookup('NoneExistant'), None)
|
self.assertEqual(cache.lookup('NoneExistant'), None)
|
||||||
|
@ -158,7 +158,7 @@ class TestVM(test.TestCase):
|
||||||
mock_feed.return_value = self.resp.feed
|
mock_feed.return_value = self.resp.feed
|
||||||
lpar_list = vm.get_lpar_list(mock_adr, 'host_uuid')
|
lpar_list = vm.get_lpar_list(mock_adr, 'host_uuid')
|
||||||
# Check the first one in the feed and the length of the feed
|
# Check the first one in the feed and the length of the feed
|
||||||
self.assertEqual(lpar_list[0], 'nova-z3-9-5-126-127-00000001')
|
self.assertEqual(lpar_list[0], 'z3-9-5-126-127-00000001')
|
||||||
self.assertEqual(len(lpar_list), 21)
|
self.assertEqual(len(lpar_list), 21)
|
||||||
|
|
||||||
@mock.patch('pypowervm.adapter.Adapter')
|
@mock.patch('pypowervm.adapter.Adapter')
|
||||||
|
|
|
@ -287,7 +287,7 @@ class PowerVMDriver(driver.ComputeDriver):
|
||||||
:returns: Dictionary describing resources
|
:returns: Dictionary describing resources
|
||||||
"""
|
"""
|
||||||
|
|
||||||
resp = self.adapter.read(pvm_consts.MGT_SYS, rootId=self.host_uuid)
|
resp = self.adapter.read(pvm_consts.MGT_SYS, root_id=self.host_uuid)
|
||||||
if resp:
|
if resp:
|
||||||
self.host_wrapper = msentry_wrapper.ManagedSystem(resp.entry)
|
self.host_wrapper = msentry_wrapper.ManagedSystem(resp.entry)
|
||||||
data = pvm_host.build_host_resource_from_entry(self.host_wrapper)
|
data = pvm_host.build_host_resource_from_entry(self.host_wrapper)
|
||||||
|
|
|
@ -129,8 +129,8 @@ class LocalStorage(blockdev.StorageAdapter):
|
||||||
def _get_vg_uuid(self, adapter, vios_uuid, name):
|
def _get_vg_uuid(self, adapter, vios_uuid, name):
|
||||||
try:
|
try:
|
||||||
resp = adapter.read(pvm_consts.VIOS,
|
resp = adapter.read(pvm_consts.VIOS,
|
||||||
rootId=vios_uuid,
|
root_id=vios_uuid,
|
||||||
childType=pvm_consts.VOL_GROUP)
|
child_type=pvm_consts.VOL_GROUP)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(e)
|
LOG.exception(e)
|
||||||
raise e
|
raise e
|
||||||
|
|
|
@ -53,8 +53,8 @@ def get_vios_uuid(adapter, name):
|
||||||
searchstring = "(PartitionName=='%s')" % name
|
searchstring = "(PartitionName=='%s')" % name
|
||||||
try:
|
try:
|
||||||
resp = adapter.read(pvm_consts.VIOS,
|
resp = adapter.read(pvm_consts.VIOS,
|
||||||
suffixType='search',
|
suffix_type='search',
|
||||||
suffixParm=searchstring)
|
suffix_parm=searchstring)
|
||||||
except pvm_exc.Error as e:
|
except pvm_exc.Error as e:
|
||||||
if e.response.status == 404:
|
if e.response.status == 404:
|
||||||
raise VIOSNotFound(vios_name=name)
|
raise VIOSNotFound(vios_name=name)
|
||||||
|
@ -72,7 +72,7 @@ def get_vios_uuid(adapter, name):
|
||||||
|
|
||||||
def get_vios_entry(adapter, vios_uuid, vios_name):
|
def get_vios_entry(adapter, vios_uuid, vios_name):
|
||||||
try:
|
try:
|
||||||
resp = adapter.read(pvm_consts.VIOS, rootId=vios_uuid)
|
resp = adapter.read(pvm_consts.VIOS, root_id=vios_uuid)
|
||||||
except pvm_exc.Error as e:
|
except pvm_exc.Error as e:
|
||||||
if e.response.status == 404:
|
if e.response.status == 404:
|
||||||
raise VIOSNotFound(vios_name=vios_name)
|
raise VIOSNotFound(vios_name=vios_name)
|
||||||
|
|
|
@ -94,8 +94,8 @@ class InstanceInfo(hardware.InstanceInfo):
|
||||||
|
|
||||||
def _get_property(self, q_prop):
|
def _get_property(self, q_prop):
|
||||||
try:
|
try:
|
||||||
resp = self._adapter.read(pvm_consts.LPAR, rootId=self._uuid,
|
resp = self._adapter.read(pvm_consts.LPAR, root_id=self._uuid,
|
||||||
suffixType='quick', suffixParm=q_prop)
|
suffix_type='quick', suffix_parm=q_prop)
|
||||||
except pvm_exc.Error as e:
|
except pvm_exc.Error as e:
|
||||||
if e.response.status == 404:
|
if e.response.status == 404:
|
||||||
raise exception.InstanceNotFound(instance_id=self._name)
|
raise exception.InstanceNotFound(instance_id=self._name)
|
||||||
|
@ -158,8 +158,8 @@ def get_lpar_feed(adapter, host_uuid):
|
||||||
feed = None
|
feed = None
|
||||||
try:
|
try:
|
||||||
resp = adapter.read(pvm_consts.MGT_SYS,
|
resp = adapter.read(pvm_consts.MGT_SYS,
|
||||||
rootId=host_uuid,
|
root_id=host_uuid,
|
||||||
childType=pvm_consts.LPAR)
|
child_type=pvm_consts.LPAR)
|
||||||
feed = resp.feed
|
feed = resp.feed
|
||||||
except pvm_exc.Error as e:
|
except pvm_exc.Error as e:
|
||||||
LOG.exception(e)
|
LOG.exception(e)
|
||||||
|
@ -188,8 +188,8 @@ def get_instance_wrapper(adapter, instance, pvm_uuids, host_uuid):
|
||||||
:returns: The pypowervm logical_partition wrapper.
|
:returns: The pypowervm logical_partition wrapper.
|
||||||
"""
|
"""
|
||||||
pvm_inst_uuid = pvm_uuids.lookup(instance.name)
|
pvm_inst_uuid = pvm_uuids.lookup(instance.name)
|
||||||
resp = adapter.read(pvm_consts.MGT_SYS, host_uuid,
|
resp = adapter.read(pvm_consts.MGT_SYS, root_id=host_uuid,
|
||||||
pvm_consts.LPAR, pvm_inst_uuid)
|
child_type=pvm_consts.LPAR, child_id=pvm_inst_uuid)
|
||||||
return pvm_lpar.LogicalPartition(resp.entry)
|
return pvm_lpar.LogicalPartition(resp.entry)
|
||||||
|
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ def crt_lpar(adapter, host_uuid, instance, flavor):
|
||||||
max_io_slots='64')
|
max_io_slots='64')
|
||||||
|
|
||||||
adapter.create(lpar_elem, pvm_consts.MGT_SYS,
|
adapter.create(lpar_elem, pvm_consts.MGT_SYS,
|
||||||
rootId=host_uuid, childType=pvm_lpar.LPAR)
|
root_id=host_uuid, child_type=pvm_lpar.LPAR)
|
||||||
|
|
||||||
|
|
||||||
def dlt_lpar(adapter, lpar_uuid):
|
def dlt_lpar(adapter, lpar_uuid):
|
||||||
|
@ -231,7 +231,7 @@ def dlt_lpar(adapter, lpar_uuid):
|
||||||
:param adapter: The adapter for the pypowervm API
|
:param adapter: The adapter for the pypowervm API
|
||||||
:param lpar_uuid: The lpar to delete
|
:param lpar_uuid: The lpar to delete
|
||||||
"""
|
"""
|
||||||
resp = adapter.delete(pvm_consts.LPAR, rootId=lpar_uuid)
|
resp = adapter.delete(pvm_consts.LPAR, root_id=lpar_uuid)
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
|
|
||||||
|
@ -255,8 +255,8 @@ class UUIDCache(object):
|
||||||
searchstring = "(PartitionName=='%s')" % name
|
searchstring = "(PartitionName=='%s')" % name
|
||||||
try:
|
try:
|
||||||
resp = self._adapter.read(pvm_consts.LPAR,
|
resp = self._adapter.read(pvm_consts.LPAR,
|
||||||
suffixType='search',
|
suffix_type='search',
|
||||||
suffixParm=searchstring)
|
suffix_parm=searchstring)
|
||||||
except pvm_exc.Error as e:
|
except pvm_exc.Error as e:
|
||||||
if e.response.status == 404:
|
if e.response.status == 404:
|
||||||
raise exception.InstanceNotFound(instance_id=name)
|
raise exception.InstanceNotFound(instance_id=name)
|
||||||
|
|
Loading…
Reference in New Issue