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_MAPPING = (
|
||||
{
|
||||
'nova-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-127-00000001': '089ffb20-5d19-4a8c-bb80-13650627d985',
|
||||
'z3-9-5-126-208-000001f0': '668b0882-c24a-4ae9-91c8-297e95e3fe29'
|
||||
})
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -91,7 +91,7 @@ class TestVM(test.TestCase):
|
|||
return self.resp
|
||||
|
||||
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())
|
||||
# Test it returns None even when we try to look it up
|
||||
self.assertEqual(cache.lookup('NoneExistant'), None)
|
||||
|
@ -158,7 +158,7 @@ class TestVM(test.TestCase):
|
|||
mock_feed.return_value = self.resp.feed
|
||||
lpar_list = vm.get_lpar_list(mock_adr, 'host_uuid')
|
||||
# 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)
|
||||
|
||||
@mock.patch('pypowervm.adapter.Adapter')
|
||||
|
|
|
@ -287,7 +287,7 @@ class PowerVMDriver(driver.ComputeDriver):
|
|||
: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:
|
||||
self.host_wrapper = msentry_wrapper.ManagedSystem(resp.entry)
|
||||
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):
|
||||
try:
|
||||
resp = adapter.read(pvm_consts.VIOS,
|
||||
rootId=vios_uuid,
|
||||
childType=pvm_consts.VOL_GROUP)
|
||||
root_id=vios_uuid,
|
||||
child_type=pvm_consts.VOL_GROUP)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
raise e
|
||||
|
|
|
@ -53,8 +53,8 @@ def get_vios_uuid(adapter, name):
|
|||
searchstring = "(PartitionName=='%s')" % name
|
||||
try:
|
||||
resp = adapter.read(pvm_consts.VIOS,
|
||||
suffixType='search',
|
||||
suffixParm=searchstring)
|
||||
suffix_type='search',
|
||||
suffix_parm=searchstring)
|
||||
except pvm_exc.Error as e:
|
||||
if e.response.status == 404:
|
||||
raise VIOSNotFound(vios_name=name)
|
||||
|
@ -72,7 +72,7 @@ def get_vios_uuid(adapter, name):
|
|||
|
||||
def get_vios_entry(adapter, vios_uuid, vios_name):
|
||||
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:
|
||||
if e.response.status == 404:
|
||||
raise VIOSNotFound(vios_name=vios_name)
|
||||
|
|
|
@ -94,8 +94,8 @@ class InstanceInfo(hardware.InstanceInfo):
|
|||
|
||||
def _get_property(self, q_prop):
|
||||
try:
|
||||
resp = self._adapter.read(pvm_consts.LPAR, rootId=self._uuid,
|
||||
suffixType='quick', suffixParm=q_prop)
|
||||
resp = self._adapter.read(pvm_consts.LPAR, root_id=self._uuid,
|
||||
suffix_type='quick', suffix_parm=q_prop)
|
||||
except pvm_exc.Error as e:
|
||||
if e.response.status == 404:
|
||||
raise exception.InstanceNotFound(instance_id=self._name)
|
||||
|
@ -158,8 +158,8 @@ def get_lpar_feed(adapter, host_uuid):
|
|||
feed = None
|
||||
try:
|
||||
resp = adapter.read(pvm_consts.MGT_SYS,
|
||||
rootId=host_uuid,
|
||||
childType=pvm_consts.LPAR)
|
||||
root_id=host_uuid,
|
||||
child_type=pvm_consts.LPAR)
|
||||
feed = resp.feed
|
||||
except pvm_exc.Error as e:
|
||||
LOG.exception(e)
|
||||
|
@ -188,8 +188,8 @@ def get_instance_wrapper(adapter, instance, pvm_uuids, host_uuid):
|
|||
:returns: The pypowervm logical_partition wrapper.
|
||||
"""
|
||||
pvm_inst_uuid = pvm_uuids.lookup(instance.name)
|
||||
resp = adapter.read(pvm_consts.MGT_SYS, host_uuid,
|
||||
pvm_consts.LPAR, pvm_inst_uuid)
|
||||
resp = adapter.read(pvm_consts.MGT_SYS, root_id=host_uuid,
|
||||
child_type=pvm_consts.LPAR, child_id=pvm_inst_uuid)
|
||||
return pvm_lpar.LogicalPartition(resp.entry)
|
||||
|
||||
|
||||
|
@ -222,7 +222,7 @@ def crt_lpar(adapter, host_uuid, instance, flavor):
|
|||
max_io_slots='64')
|
||||
|
||||
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):
|
||||
|
@ -231,7 +231,7 @@ def dlt_lpar(adapter, lpar_uuid):
|
|||
:param adapter: The adapter for the pypowervm API
|
||||
: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
|
||||
|
||||
|
||||
|
@ -255,8 +255,8 @@ class UUIDCache(object):
|
|||
searchstring = "(PartitionName=='%s')" % name
|
||||
try:
|
||||
resp = self._adapter.read(pvm_consts.LPAR,
|
||||
suffixType='search',
|
||||
suffixParm=searchstring)
|
||||
suffix_type='search',
|
||||
suffix_parm=searchstring)
|
||||
except pvm_exc.Error as e:
|
||||
if e.response.status == 404:
|
||||
raise exception.InstanceNotFound(instance_id=name)
|
||||
|
|
Loading…
Reference in New Issue