Fix return values in OneView deploy interface
This patch is about to add the return values of some methods in the OneView drivers deploy interface and remove it when return was not needed. Change-Id: I700380fa85461eec506a953d2b2d823870b196bb Closes-Bug: 1641162
This commit is contained in:
parent
83b2d563a9
commit
1198811d8f
@ -232,7 +232,7 @@ class OneViewIscsiDeploy(iscsi_deploy.ISCSIDeploy, OneViewPeriodicTasks):
|
|||||||
self.oneview_client = common.get_oneview_client()
|
self.oneview_client = common.get_oneview_client()
|
||||||
|
|
||||||
def get_properties(self):
|
def get_properties(self):
|
||||||
deploy_utils.get_properties()
|
return deploy_utils.get_properties()
|
||||||
|
|
||||||
@METRICS.timer('OneViewIscsiDeploy.validate')
|
@METRICS.timer('OneViewIscsiDeploy.validate')
|
||||||
def validate(self, task):
|
def validate(self, task):
|
||||||
@ -255,7 +255,7 @@ class OneViewIscsiDeploy(iscsi_deploy.ISCSIDeploy, OneViewPeriodicTasks):
|
|||||||
if (common.is_dynamic_allocation_enabled(task.node) and
|
if (common.is_dynamic_allocation_enabled(task.node) and
|
||||||
not CONF.conductor.automated_clean):
|
not CONF.conductor.automated_clean):
|
||||||
deploy_utils.tear_down(self.oneview_client, task)
|
deploy_utils.tear_down(self.oneview_client, task)
|
||||||
super(OneViewIscsiDeploy, self).tear_down(task)
|
return super(OneViewIscsiDeploy, self).tear_down(task)
|
||||||
|
|
||||||
@METRICS.timer('OneViewIscsiDeploy.prepare_cleaning')
|
@METRICS.timer('OneViewIscsiDeploy.prepare_cleaning')
|
||||||
def prepare_cleaning(self, task):
|
def prepare_cleaning(self, task):
|
||||||
@ -267,7 +267,7 @@ class OneViewIscsiDeploy(iscsi_deploy.ISCSIDeploy, OneViewPeriodicTasks):
|
|||||||
def tear_down_cleaning(self, task):
|
def tear_down_cleaning(self, task):
|
||||||
if common.is_dynamic_allocation_enabled(task.node):
|
if common.is_dynamic_allocation_enabled(task.node):
|
||||||
deploy_utils.tear_down_cleaning(self.oneview_client, task)
|
deploy_utils.tear_down_cleaning(self.oneview_client, task)
|
||||||
return super(OneViewIscsiDeploy, self).tear_down_cleaning(task)
|
super(OneViewIscsiDeploy, self).tear_down_cleaning(task)
|
||||||
|
|
||||||
|
|
||||||
# NOTE (thiagop): We overwrite this interface because we cannot change the boot
|
# NOTE (thiagop): We overwrite this interface because we cannot change the boot
|
||||||
@ -367,7 +367,7 @@ class OneViewAgentDeploy(OneViewAgentDeployMixin, agent.AgentDeploy,
|
|||||||
self.oneview_client = common.get_oneview_client()
|
self.oneview_client = common.get_oneview_client()
|
||||||
|
|
||||||
def get_properties(self):
|
def get_properties(self):
|
||||||
deploy_utils.get_properties()
|
return deploy_utils.get_properties()
|
||||||
|
|
||||||
@METRICS.timer('OneViewAgentDeploy.validate')
|
@METRICS.timer('OneViewAgentDeploy.validate')
|
||||||
def validate(self, task):
|
def validate(self, task):
|
||||||
@ -390,7 +390,7 @@ class OneViewAgentDeploy(OneViewAgentDeployMixin, agent.AgentDeploy,
|
|||||||
if (common.is_dynamic_allocation_enabled(task.node) and
|
if (common.is_dynamic_allocation_enabled(task.node) and
|
||||||
not CONF.conductor.automated_clean):
|
not CONF.conductor.automated_clean):
|
||||||
deploy_utils.tear_down(self.oneview_client, task)
|
deploy_utils.tear_down(self.oneview_client, task)
|
||||||
super(OneViewAgentDeploy, self).tear_down(task)
|
return super(OneViewAgentDeploy, self).tear_down(task)
|
||||||
|
|
||||||
@METRICS.timer('OneViewAgentDeploy.prepare_cleaning')
|
@METRICS.timer('OneViewAgentDeploy.prepare_cleaning')
|
||||||
def prepare_cleaning(self, task):
|
def prepare_cleaning(self, task):
|
||||||
@ -402,4 +402,4 @@ class OneViewAgentDeploy(OneViewAgentDeployMixin, agent.AgentDeploy,
|
|||||||
def tear_down_cleaning(self, task):
|
def tear_down_cleaning(self, task):
|
||||||
if common.is_dynamic_allocation_enabled(task.node):
|
if common.is_dynamic_allocation_enabled(task.node):
|
||||||
deploy_utils.tear_down_cleaning(self.oneview_client, task)
|
deploy_utils.tear_down_cleaning(self.oneview_client, task)
|
||||||
return super(OneViewAgentDeploy, self).tear_down_cleaning(task)
|
super(OneViewAgentDeploy, self).tear_down_cleaning(task)
|
||||||
|
@ -585,6 +585,10 @@ class OneViewIscsiDeployTestCase(db_base.DbTestCase):
|
|||||||
node_id=self.node.id)
|
node_id=self.node.id)
|
||||||
self.info = common.get_oneview_info(self.node)
|
self.info = common.get_oneview_info(self.node)
|
||||||
|
|
||||||
|
def test_get_properties(self, mock_get_ov_client):
|
||||||
|
expected = common.COMMON_PROPERTIES
|
||||||
|
self.assertEqual(expected, self.driver.deploy.get_properties())
|
||||||
|
|
||||||
@mock.patch.object(iscsi_deploy.ISCSIDeploy, 'validate',
|
@mock.patch.object(iscsi_deploy.ISCSIDeploy, 'validate',
|
||||||
spec_set=True, autospec=True)
|
spec_set=True, autospec=True)
|
||||||
def test_validate(self, iscsi_deploy_validate_mock, mock_get_ov_client):
|
def test_validate(self, iscsi_deploy_validate_mock, mock_get_ov_client):
|
||||||
@ -655,8 +659,9 @@ class OneViewIscsiDeployTestCase(db_base.DbTestCase):
|
|||||||
iscsi_tear_down_mock.return_value = states.DELETED
|
iscsi_tear_down_mock.return_value = states.DELETED
|
||||||
with task_manager.acquire(self.context, self.node.uuid,
|
with task_manager.acquire(self.context, self.node.uuid,
|
||||||
shared=False) as task:
|
shared=False) as task:
|
||||||
task.driver.deploy.tear_down(task)
|
returned_state = task.driver.deploy.tear_down(task)
|
||||||
iscsi_tear_down_mock.assert_called_once_with(mock.ANY, task)
|
iscsi_tear_down_mock.assert_called_once_with(mock.ANY, task)
|
||||||
|
self.assertEqual(states.DELETED, returned_state)
|
||||||
|
|
||||||
@mock.patch.object(iscsi_deploy.ISCSIDeploy, 'tear_down', spec_set=True,
|
@mock.patch.object(iscsi_deploy.ISCSIDeploy, 'tear_down', spec_set=True,
|
||||||
autospec=True)
|
autospec=True)
|
||||||
@ -674,8 +679,10 @@ class OneViewIscsiDeployTestCase(db_base.DbTestCase):
|
|||||||
|
|
||||||
with task_manager.acquire(self.context, self.node.uuid,
|
with task_manager.acquire(self.context, self.node.uuid,
|
||||||
shared=False) as task:
|
shared=False) as task:
|
||||||
task.driver.deploy.tear_down(task)
|
returned_state = task.driver.deploy.tear_down(task)
|
||||||
iscsi_tear_down_mock.assert_called_once_with(mock.ANY, task)
|
iscsi_tear_down_mock.assert_called_once_with(mock.ANY, task)
|
||||||
|
self.assertEqual(states.DELETED, returned_state)
|
||||||
|
self.assertTrue(deallocate_server_hardware_mock.called)
|
||||||
|
|
||||||
@mock.patch.object(iscsi_deploy.ISCSIDeploy, 'prepare_cleaning',
|
@mock.patch.object(iscsi_deploy.ISCSIDeploy, 'prepare_cleaning',
|
||||||
spec_set=True, autospec=True)
|
spec_set=True, autospec=True)
|
||||||
@ -760,6 +767,10 @@ class OneViewAgentDeployTestCase(db_base.DbTestCase):
|
|||||||
node_id=self.node.id)
|
node_id=self.node.id)
|
||||||
self.info = common.get_oneview_info(self.node)
|
self.info = common.get_oneview_info(self.node)
|
||||||
|
|
||||||
|
def test_get_properties(self, mock_get_ov_client):
|
||||||
|
expected = common.COMMON_PROPERTIES
|
||||||
|
self.assertEqual(expected, self.driver.deploy.get_properties())
|
||||||
|
|
||||||
@mock.patch.object(agent.AgentDeploy, 'validate',
|
@mock.patch.object(agent.AgentDeploy, 'validate',
|
||||||
spec_set=True, autospec=True)
|
spec_set=True, autospec=True)
|
||||||
def test_validate(self, agent_deploy_validate_mock, mock_get_ov_client):
|
def test_validate(self, agent_deploy_validate_mock, mock_get_ov_client):
|
||||||
@ -830,8 +841,9 @@ class OneViewAgentDeployTestCase(db_base.DbTestCase):
|
|||||||
agent_tear_down_mock.return_value = states.DELETED
|
agent_tear_down_mock.return_value = states.DELETED
|
||||||
with task_manager.acquire(self.context, self.node.uuid,
|
with task_manager.acquire(self.context, self.node.uuid,
|
||||||
shared=False) as task:
|
shared=False) as task:
|
||||||
task.driver.deploy.tear_down(task)
|
returned_state = task.driver.deploy.tear_down(task)
|
||||||
agent_tear_down_mock.assert_called_once_with(mock.ANY, task)
|
agent_tear_down_mock.assert_called_once_with(mock.ANY, task)
|
||||||
|
self.assertEqual(states.DELETED, returned_state)
|
||||||
|
|
||||||
@mock.patch.object(agent.AgentDeploy, 'tear_down', spec_set=True,
|
@mock.patch.object(agent.AgentDeploy, 'tear_down', spec_set=True,
|
||||||
autospec=True)
|
autospec=True)
|
||||||
@ -849,8 +861,10 @@ class OneViewAgentDeployTestCase(db_base.DbTestCase):
|
|||||||
|
|
||||||
with task_manager.acquire(self.context, self.node.uuid,
|
with task_manager.acquire(self.context, self.node.uuid,
|
||||||
shared=False) as task:
|
shared=False) as task:
|
||||||
task.driver.deploy.tear_down(task)
|
returned_state = task.driver.deploy.tear_down(task)
|
||||||
agent_tear_down_mock.assert_called_once_with(mock.ANY, task)
|
agent_tear_down_mock.assert_called_once_with(mock.ANY, task)
|
||||||
|
self.assertEqual(states.DELETED, returned_state)
|
||||||
|
self.assertTrue(deallocate_server_hardware_mock.called)
|
||||||
|
|
||||||
@mock.patch.object(agent.AgentDeploy, 'prepare_cleaning',
|
@mock.patch.object(agent.AgentDeploy, 'prepare_cleaning',
|
||||||
spec_set=True, autospec=True)
|
spec_set=True, autospec=True)
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- Fixes an issue where the OneView deploy interface does not
|
||||||
|
return the node properties and in the tear down phase does
|
||||||
|
not return the state of the node.
|
Loading…
Reference in New Issue
Block a user