Added action that returns nova-compute node name.
Closes-Bug: #1911012 Change-Id: Id9a7c3a675072ed4da3b9cb9fc997e70895205cb
This commit is contained in:
parent
e76484fcd0
commit
38efefccdf
@ -301,6 +301,7 @@ deployed then see file `actions.yaml`.
|
||||
* `disable`
|
||||
* `enable`
|
||||
* `hugepagereport`
|
||||
* `node-name`
|
||||
* `openstack-upgrade`
|
||||
* `pause`
|
||||
* `register-to-cloud`
|
||||
|
@ -12,6 +12,8 @@ register-to-cloud:
|
||||
README.md, section 'Cloud downscaling'.
|
||||
openstack-upgrade:
|
||||
description: Perform openstack upgrades. Config option action-managed-upgrade must be set to True.
|
||||
node-name:
|
||||
description: Return nova-compute node name. This can be used to identify this unit in the list of nova-compute services.
|
||||
pause:
|
||||
description: Pause the nova_compute unit. This action will stop nova_compute services.
|
||||
resume:
|
||||
|
@ -136,11 +136,16 @@ def register_to_cloud():
|
||||
})
|
||||
|
||||
|
||||
def node_name():
|
||||
function_set({'node-name': cloud_utils.service_hostname()})
|
||||
|
||||
|
||||
ACTIONS = {
|
||||
'disable': disable,
|
||||
'enable': enable,
|
||||
'remove-from-cloud': remove_from_cloud,
|
||||
'register-to-cloud': register_to_cloud,
|
||||
'node-name': node_name,
|
||||
}
|
||||
|
||||
|
||||
|
1
actions/node-name
Symbolic link
1
actions/node-name
Symbolic link
@ -0,0 +1 @@
|
||||
cloud.py
|
@ -231,3 +231,19 @@ class TestRegisterToCloud(_ActionTestCase):
|
||||
|
||||
cloud.service_resume.assert_called_with('nova-compute')
|
||||
cloud.function_fail.assert_not_called()
|
||||
|
||||
|
||||
class TestNodeName(_ActionTestCase):
|
||||
NAME = 'node-name'
|
||||
|
||||
def setUp(self, to_mock=None):
|
||||
super(TestNodeName, self).setUp()
|
||||
|
||||
def test_get_compute_name(self):
|
||||
"""Test action 'node-name'"""
|
||||
hostname = 'compute0.cloud'
|
||||
cloud.cloud_utils.service_hostname.return_value = hostname
|
||||
|
||||
self.call_action()
|
||||
|
||||
cloud.function_set.assert_called_with({'node-name': hostname})
|
||||
|
Loading…
Reference in New Issue
Block a user