Support actions for zun
Add ZunAction for zun. Zun is an OpenStack Container service. It aims to provide an API service for running application containers without the need to manage servers or clusters. Change-Id: Ibbe4777528b5af6fdb3a6c2ed3345f8f9c804bef Signed-off-by: pengdake <19921207pq@gmail.com>
This commit is contained in:
parent
94e20726b2
commit
11896ba733
@ -129,6 +129,7 @@ python-tackerclient==0.8.0
|
|||||||
python-troveclient==2.2.0
|
python-troveclient==2.2.0
|
||||||
python-vitrageclient==2.0.0
|
python-vitrageclient==2.0.0
|
||||||
python-zaqarclient==1.0.0
|
python-zaqarclient==1.0.0
|
||||||
|
python-zunclient==1.0.0
|
||||||
pytz==2013.6
|
pytz==2013.6
|
||||||
PyYAML==3.12
|
PyYAML==3.12
|
||||||
reno==2.5.0
|
reno==2.5.0
|
||||||
|
@ -21,7 +21,7 @@ SUPPORTED_MODULES = [
|
|||||||
'Nova', 'Glance', 'Keystone', 'Heat', 'Neutron', 'Cinder',
|
'Nova', 'Glance', 'Keystone', 'Heat', 'Neutron', 'Cinder',
|
||||||
'Trove', 'Ironic', 'Baremetal Introspection', 'Swift', 'SwiftService',
|
'Trove', 'Ironic', 'Baremetal Introspection', 'Swift', 'SwiftService',
|
||||||
'Zaqar', 'Barbican', 'Mistral', 'Designate', 'Magnum', 'Murano', 'Tacker',
|
'Zaqar', 'Barbican', 'Mistral', 'Designate', 'Magnum', 'Murano', 'Tacker',
|
||||||
'Aodh', 'Gnocchi', 'Glare', 'Vitrage', 'Senlin'
|
'Aodh', 'Gnocchi', 'Glare', 'Vitrage', 'Senlin', 'Zun'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ tackerclient = _try_import('tackerclient.v1_0.client')
|
|||||||
troveclient = _try_import('troveclient.v1.client')
|
troveclient = _try_import('troveclient.v1.client')
|
||||||
vitrageclient = _try_import('vitrageclient.v1.client')
|
vitrageclient = _try_import('vitrageclient.v1.client')
|
||||||
zaqarclient = _try_import('zaqarclient.queues.client')
|
zaqarclient = _try_import('zaqarclient.queues.client')
|
||||||
|
zunclient = _try_import('zunclient.v1.client')
|
||||||
|
|
||||||
|
|
||||||
class NovaAction(base.OpenStackAction):
|
class NovaAction(base.OpenStackAction):
|
||||||
@ -940,3 +941,36 @@ class VitrageAction(base.OpenStackAction):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def _get_fake_client(cls):
|
def _get_fake_client(cls):
|
||||||
return cls._get_client_class()()
|
return cls._get_client_class()()
|
||||||
|
|
||||||
|
|
||||||
|
class ZunAction(base.OpenStackAction):
|
||||||
|
_service_name = 'appcontainer'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _get_client_class(cls):
|
||||||
|
return zunclient.Client
|
||||||
|
|
||||||
|
def _create_client(self, context):
|
||||||
|
|
||||||
|
LOG.debug("Zun action security context: %s", context)
|
||||||
|
|
||||||
|
keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()
|
||||||
|
zun_endpoint = self.get_service_endpoint()
|
||||||
|
session_and_auth = self.get_session_and_auth(context)
|
||||||
|
|
||||||
|
client = self._get_client_class()(
|
||||||
|
'1',
|
||||||
|
endpoint_override=zun_endpoint.url,
|
||||||
|
auth_url=keystone_endpoint.url,
|
||||||
|
session=session_and_auth['session']
|
||||||
|
)
|
||||||
|
|
||||||
|
return client
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _get_fake_client(cls):
|
||||||
|
session = keystone_utils.get_admin_session()
|
||||||
|
return cls._get_client_class()(
|
||||||
|
endpoint_override="http://127.0.0.1:9517/",
|
||||||
|
session=session
|
||||||
|
)
|
||||||
|
@ -1268,5 +1268,42 @@
|
|||||||
"webhook_show": "webhook.show",
|
"webhook_show": "webhook.show",
|
||||||
"webhook_add": "webhook.add",
|
"webhook_add": "webhook.add",
|
||||||
"webhook_delete": "webhook.delete"
|
"webhook_delete": "webhook.delete"
|
||||||
|
},
|
||||||
|
"zun":{
|
||||||
|
"_comment": "It uses zunclient.v1. ",
|
||||||
|
"containers_add_security_group": "containers.add_security_group",
|
||||||
|
"containers_attach": "containers.attach",
|
||||||
|
"containers_commit": "containers.commit",
|
||||||
|
"containers_create": "containers.create",
|
||||||
|
"containers_delete": "containers.delete",
|
||||||
|
"containers_execute": "containers.execute",
|
||||||
|
"containers_execute_resize": "containers.execute_resize",
|
||||||
|
"containers_get": "containers.get",
|
||||||
|
"containers_get_archive": "containers.get_archive",
|
||||||
|
"containers_kill": "containers.kill",
|
||||||
|
"containers_list": "containers.list",
|
||||||
|
"containers_logs": "containers.logs",
|
||||||
|
"containers_network_attach": "containers.network_attach",
|
||||||
|
"containers_network_detach": "containers.network_detach",
|
||||||
|
"containers_pause": "containers.pause",
|
||||||
|
"containers_put_archive": "containers.put_archive",
|
||||||
|
"containers_remove_security_group": "containers.remove_security_group",
|
||||||
|
"containers_rename": "containers.rename",
|
||||||
|
"containers_resize": "containers.resize",
|
||||||
|
"containers_restart": "containers.restart",
|
||||||
|
"containers_run": "containers.run",
|
||||||
|
"containers_start": "containers.start",
|
||||||
|
"containers_stats": "containers.stats",
|
||||||
|
"containers_stop": "containers.stop",
|
||||||
|
"containers_top": "containers.top",
|
||||||
|
"containers_update": "containers.update",
|
||||||
|
"hosts_list": "hosts.list",
|
||||||
|
"hosts_get": "hosts.get",
|
||||||
|
"images_delete": "images.delete",
|
||||||
|
"images_list": "images.list",
|
||||||
|
"services_delete": "services.delete",
|
||||||
|
"services_disable": "services.disable",
|
||||||
|
"services_enable": "services.enable",
|
||||||
|
"services_list": "services.list"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,8 @@ MODULE_MAPPING = {
|
|||||||
'aodh': ['aodh.alarm_list', actions.AodhAction],
|
'aodh': ['aodh.alarm_list', actions.AodhAction],
|
||||||
'gnocchi': ['gnocchi.metric_list', actions.GnocchiAction],
|
'gnocchi': ['gnocchi.metric_list', actions.GnocchiAction],
|
||||||
'glare': ['glare.artifacts_list', actions.GlareAction],
|
'glare': ['glare.artifacts_list', actions.GlareAction],
|
||||||
'vitrage': ['vitrage.alarm_get', actions.VitrageAction]
|
'vitrage': ['vitrage.alarm_get', actions.VitrageAction],
|
||||||
|
'zun': ['zun.containers_list', actions.ZunAction]
|
||||||
}
|
}
|
||||||
|
|
||||||
EXTRA_MODULES = ['neutron', 'swift', 'zaqar', 'tacker', 'senlin']
|
EXTRA_MODULES = ['neutron', 'swift', 'zaqar', 'tacker', 'senlin']
|
||||||
|
@ -359,3 +359,18 @@ class OpenStackActionTest(base.BaseTestCase):
|
|||||||
|
|
||||||
self.assertTrue(mocked().alarm.get.called)
|
self.assertTrue(mocked().alarm.get.called)
|
||||||
mocked().alarm.get.assert_called_once_with(vitrage_id="1234-abcd")
|
mocked().alarm.get.assert_called_once_with(vitrage_id="1234-abcd")
|
||||||
|
|
||||||
|
@mock.patch.object(actions.ZunAction, '_get_client')
|
||||||
|
def test_zun_action(self, mocked):
|
||||||
|
mock_ctx = mock.Mock()
|
||||||
|
method_name = "containers.get"
|
||||||
|
action_class = actions.ZunAction
|
||||||
|
action_class.client_method_name = method_name
|
||||||
|
params = {'container_id': '1234-abcd'}
|
||||||
|
action = action_class(**params)
|
||||||
|
action.run(mock_ctx)
|
||||||
|
|
||||||
|
self.assertTrue(mocked().containers.get.called)
|
||||||
|
mocked().containers.get.assert_called_once_with(
|
||||||
|
container_id="1234-abcd"
|
||||||
|
)
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Add Mistral actions for Openstack Zun, the container service.
|
@ -50,6 +50,7 @@ python-ironicclient>=2.3.0 # Apache-2.0
|
|||||||
python-ironic-inspector-client>=1.5.0 # Apache-2.0
|
python-ironic-inspector-client>=1.5.0 # Apache-2.0
|
||||||
python-vitrageclient>=2.0.0 # Apache-2.0
|
python-vitrageclient>=2.0.0 # Apache-2.0
|
||||||
python-zaqarclient>=1.0.0 # Apache-2.0
|
python-zaqarclient>=1.0.0 # Apache-2.0
|
||||||
|
python-zunclient>=1.0.0 # Apache-2.0
|
||||||
PyJWT>=1.0.1 # MIT
|
PyJWT>=1.0.1 # MIT
|
||||||
PyYAML>=3.12 # MIT
|
PyYAML>=3.12 # MIT
|
||||||
requests>=2.14.2 # Apache-2.0
|
requests>=2.14.2 # Apache-2.0
|
||||||
|
Loading…
Reference in New Issue
Block a user