get_active_vioses should not use host UUID

Recent commit Ibe60210bb669a53e5fb0d285e7edb552da4df302 introduced the
following in get_active_vioses:

  vios_wraps = pvm_vios.VIOS.get(adapter, root_id=host_uuid, xag=xag)

The intent was to identify the host as the VIOS's parent for a feed GET;
but the effect was to specify the host_uuid as the VIOS UUID for an
entry GET.

This change set remedies the error by removing the root_id kwarg.

Change-Id: Ideb10aa6384fbf354e8c60c88b0942e1190095fd
Closes-Bug: 1584812
This commit is contained in:
Eric Fried 2016-05-23 09:50:25 -05:00
parent c6dd4fa526
commit e08975ee39
2 changed files with 3 additions and 5 deletions

View File

@ -48,9 +48,7 @@ class TestVios(test.TestCase):
vio = vioses[0]
self.assertEqual(pvm_bp.LPARState.RUNNING, vio.state)
self.assertEqual(pvm_bp.RMCState.ACTIVE, vio.rmc_state)
self.adpt.read.assert_called_with(pvm_vios.VIOS.schema_type,
root_id='host_uuid',
xag=None)
self.adpt.read.assert_called_with(pvm_vios.VIOS.schema_type, xag=None)
@mock.patch('pypowervm.wrappers.virtual_io_server.VIOS.get')
def test_get_active_vioses_w_vios_wraps(self, mock_get):

View File

@ -45,7 +45,7 @@ def get_active_vioses(adapter, host_uuid, xag=None, vios_wraps=None):
Active is defined by powered on and RMC state being 'active'.
:param adapter: The pypowervm adapter for the query.
:param host_uuid: The host server's UUID.
:param host_uuid: The host server's UUID (not used).
:param xag: (Optional, Default: None) List of extended attributes to use.
:param vios_wraps: (Optional, Default: None) A list of VIOS wrappers. If
specified, the method will check for active VIOSes
@ -53,7 +53,7 @@ def get_active_vioses(adapter, host_uuid, xag=None, vios_wraps=None):
:return: List of VIOS wrappers.
"""
if not vios_wraps:
vios_wraps = pvm_vios.VIOS.get(adapter, root_id=host_uuid, xag=xag)
vios_wraps = pvm_vios.VIOS.get(adapter, xag=xag)
return [vio for vio in vios_wraps if is_vios_active(vio)]