Add properties argument when create ironic node
This commit simply adds local boot argument to ironic creation process. Change-Id: Id1435d6e9bb2a33ccd0e10a0f920070a8e37537d
This commit is contained in:
parent
cc7836fd59
commit
6fccce5d52
@ -4,6 +4,8 @@
|
|||||||
-
|
-
|
||||||
args:
|
args:
|
||||||
driver: "fake"
|
driver: "fake"
|
||||||
|
properties:
|
||||||
|
capabilities: "boot_option:local"
|
||||||
runner:
|
runner:
|
||||||
type: "constant"
|
type: "constant"
|
||||||
times: 100
|
times: 100
|
||||||
@ -15,4 +17,4 @@
|
|||||||
sla:
|
sla:
|
||||||
failure_rate:
|
failure_rate:
|
||||||
max: 0
|
max: 0
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -32,12 +32,14 @@ from rally.task import validation
|
|||||||
name="IronicNodes.create_and_list_node")
|
name="IronicNodes.create_and_list_node")
|
||||||
class CreateAndListNode(utils.IronicScenario):
|
class CreateAndListNode(utils.IronicScenario):
|
||||||
|
|
||||||
def run(self, driver, associated=None, maintenance=None, detail=False,
|
def run(self, driver, properties=None, associated=None, maintenance=None,
|
||||||
sort_dir=None, marker=None, limit=None, sort_key=None,
|
detail=False, sort_dir=None, marker=None, limit=None,
|
||||||
**kwargs):
|
sort_key=None, **kwargs):
|
||||||
"""Create and list nodes.
|
"""Create and list nodes.
|
||||||
|
|
||||||
:param driver: The name of the driver used to manage this Node.
|
:param driver: The name of the driver used to manage this Node.
|
||||||
|
:param properties: Key/value pair describing the physical
|
||||||
|
characteristics of the node.
|
||||||
:param associated: Optional argument of list request. Either a Boolean
|
:param associated: Optional argument of list request. Either a Boolean
|
||||||
or a string representation of a Boolean that indicates whether to
|
or a string representation of a Boolean that indicates whether to
|
||||||
return a list of associated (True or "True") or unassociated
|
return a list of associated (True or "True") or unassociated
|
||||||
@ -56,7 +58,7 @@ class CreateAndListNode(utils.IronicScenario):
|
|||||||
:param kwargs: Optional additional arguments for node creation
|
:param kwargs: Optional additional arguments for node creation
|
||||||
"""
|
"""
|
||||||
|
|
||||||
node = self._create_node(driver, **kwargs)
|
node = self._create_node(driver, properties, **kwargs)
|
||||||
list_nodes = self._list_nodes(
|
list_nodes = self._list_nodes(
|
||||||
associated=associated, maintenance=maintenance, detail=detail,
|
associated=associated, maintenance=maintenance, detail=detail,
|
||||||
sort_dir=sort_dir)
|
sort_dir=sort_dir)
|
||||||
@ -70,11 +72,13 @@ class CreateAndListNode(utils.IronicScenario):
|
|||||||
name="IronicNodes.create_and_delete_node")
|
name="IronicNodes.create_and_delete_node")
|
||||||
class CreateAndDeleteNode(utils.IronicScenario):
|
class CreateAndDeleteNode(utils.IronicScenario):
|
||||||
|
|
||||||
def run(self, driver, **kwargs):
|
def run(self, driver, properties=None, **kwargs):
|
||||||
"""Create and delete node.
|
"""Create and delete node.
|
||||||
|
|
||||||
:param driver: The name of the driver used to manage this Node.
|
:param driver: The name of the driver used to manage this Node.
|
||||||
|
:param properties: Key/value pair describing the physical
|
||||||
|
characteristics of the node.
|
||||||
:param kwargs: Optional additional arguments for node creation
|
:param kwargs: Optional additional arguments for node creation
|
||||||
"""
|
"""
|
||||||
node = self._create_node(driver, **kwargs)
|
node = self._create_node(driver, properties, **kwargs)
|
||||||
self._delete_node(node)
|
self._delete_node(node)
|
||||||
|
@ -61,15 +61,18 @@ class IronicScenario(scenario.OpenStackScenario):
|
|||||||
RESOURCE_NAME_ALLOWED_CHARACTERS = string.ascii_lowercase + string.digits
|
RESOURCE_NAME_ALLOWED_CHARACTERS = string.ascii_lowercase + string.digits
|
||||||
|
|
||||||
@atomic.action_timer("ironic.create_node")
|
@atomic.action_timer("ironic.create_node")
|
||||||
def _create_node(self, driver, **kwargs):
|
def _create_node(self, driver, properties, **kwargs):
|
||||||
"""Create node immediately.
|
"""Create node immediately.
|
||||||
|
|
||||||
:param driver: The name of the driver used to manage this Node.
|
:param driver: The name of the driver used to manage this Node.
|
||||||
|
:param properties: Key/value pair describing the physical
|
||||||
|
characteristics of the node.
|
||||||
:param kwargs: optional parameters to create image
|
:param kwargs: optional parameters to create image
|
||||||
:returns: node object
|
:returns: node object
|
||||||
"""
|
"""
|
||||||
kwargs["name"] = self.generate_random_name()
|
kwargs["name"] = self.generate_random_name()
|
||||||
node = self.admin_clients("ironic").node.create(driver=driver,
|
node = self.admin_clients("ironic").node.create(driver=driver,
|
||||||
|
properties=properties,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
self.sleep_between(CONF.benchmark.ironic_node_create_poll_interval)
|
self.sleep_between(CONF.benchmark.ironic_node_create_poll_interval)
|
||||||
|
@ -2,7 +2,10 @@
|
|||||||
"IronicNodes.create_and_delete_node": [
|
"IronicNodes.create_and_delete_node": [
|
||||||
{
|
{
|
||||||
"args": {
|
"args": {
|
||||||
"driver": "pxe_ssh"
|
"driver": "pxe_ssh",
|
||||||
|
"properties": {
|
||||||
|
"capabilities": "boot_option:local"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"runner": {
|
"runner": {
|
||||||
"type": "constant",
|
"type": "constant",
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
-
|
-
|
||||||
args:
|
args:
|
||||||
driver: "pxe_ssh"
|
driver: "pxe_ssh"
|
||||||
|
properties:
|
||||||
|
capabilities: "boot_option:local"
|
||||||
runner:
|
runner:
|
||||||
type: "constant"
|
type: "constant"
|
||||||
times: 10
|
times: 10
|
||||||
|
@ -33,6 +33,7 @@ class IronicNodesTestCase(test.ScenarioTestCase):
|
|||||||
return_value=[Node(name)
|
return_value=[Node(name)
|
||||||
for name in ("node_obj1", "node_obj2", "node_obj3")])
|
for name in ("node_obj1", "node_obj2", "node_obj3")])
|
||||||
driver = "foo"
|
driver = "foo"
|
||||||
|
properties = "fake_prop"
|
||||||
fake_params = {
|
fake_params = {
|
||||||
"sort_dir": "foo1",
|
"sort_dir": "foo1",
|
||||||
"associated": "foo2",
|
"associated": "foo2",
|
||||||
@ -42,9 +43,9 @@ class IronicNodesTestCase(test.ScenarioTestCase):
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Positive case:
|
# Positive case:
|
||||||
scenario.run(driver, **fake_params)
|
scenario.run(driver, properties, **fake_params)
|
||||||
|
|
||||||
scenario._create_node.assert_called_once_with(driver,
|
scenario._create_node.assert_called_once_with(driver, properties,
|
||||||
fake_parameter1="foo7")
|
fake_parameter1="foo7")
|
||||||
scenario._list_nodes.assert_called_once_with(
|
scenario._list_nodes.assert_called_once_with(
|
||||||
sort_dir="foo1", associated="foo2", detail=True,
|
sort_dir="foo1", associated="foo2", detail=True,
|
||||||
@ -53,9 +54,9 @@ class IronicNodesTestCase(test.ScenarioTestCase):
|
|||||||
# Negative case: created node not in the list of available nodes
|
# Negative case: created node not in the list of available nodes
|
||||||
scenario._create_node = mock.Mock(uuid="foooo")
|
scenario._create_node = mock.Mock(uuid="foooo")
|
||||||
self.assertRaises(exceptions.RallyAssertionError,
|
self.assertRaises(exceptions.RallyAssertionError,
|
||||||
scenario.run, driver, **fake_params)
|
scenario.run, driver, properties, **fake_params)
|
||||||
|
|
||||||
scenario._create_node.assert_called_with(driver,
|
scenario._create_node.assert_called_with(driver, properties,
|
||||||
fake_parameter1="foo7")
|
fake_parameter1="foo7")
|
||||||
scenario._list_nodes.assert_called_with(
|
scenario._list_nodes.assert_called_with(
|
||||||
sort_dir="foo1", associated="foo2", detail=True,
|
sort_dir="foo1", associated="foo2", detail=True,
|
||||||
@ -68,10 +69,13 @@ class IronicNodesTestCase(test.ScenarioTestCase):
|
|||||||
scenario._delete_node = mock.Mock()
|
scenario._delete_node = mock.Mock()
|
||||||
|
|
||||||
driver = "fake"
|
driver = "fake"
|
||||||
|
properties = "fake_prop"
|
||||||
|
|
||||||
scenario.run(driver, fake_parameter1="fake1", fake_parameter2="fake2")
|
scenario.run(driver, properties, fake_parameter1="fake1",
|
||||||
|
fake_parameter2="fake2")
|
||||||
scenario._create_node.assert_called_once_with(
|
scenario._create_node.assert_called_once_with(
|
||||||
driver, fake_parameter1="fake1", fake_parameter2="fake2")
|
driver, properties, fake_parameter1="fake1",
|
||||||
|
fake_parameter2="fake2")
|
||||||
|
|
||||||
scenario._delete_node.assert_called_once_with(
|
scenario._delete_node.assert_called_once_with(
|
||||||
scenario._create_node.return_value)
|
scenario._create_node.return_value)
|
||||||
|
@ -29,10 +29,11 @@ class IronicScenarioTestCase(test.ScenarioTestCase):
|
|||||||
scenario = utils.IronicScenario(self.context)
|
scenario = utils.IronicScenario(self.context)
|
||||||
scenario.generate_random_name = mock.Mock()
|
scenario.generate_random_name = mock.Mock()
|
||||||
|
|
||||||
scenario._create_node(driver="fake", fake_param="foo")
|
scenario._create_node(driver="fake", properties="fake_prop",
|
||||||
|
fake_param="foo")
|
||||||
|
|
||||||
self.admin_clients("ironic").node.create.assert_called_once_with(
|
self.admin_clients("ironic").node.create.assert_called_once_with(
|
||||||
driver="fake", fake_param="foo",
|
driver="fake", properties="fake_prop", fake_param="foo",
|
||||||
name=scenario.generate_random_name.return_value)
|
name=scenario.generate_random_name.return_value)
|
||||||
self.assertTrue(mock_wait_for_status.called)
|
self.assertTrue(mock_wait_for_status.called)
|
||||||
self._test_atomic_action_timer(scenario.atomic_actions(),
|
self._test_atomic_action_timer(scenario.atomic_actions(),
|
||||||
|
Loading…
Reference in New Issue
Block a user