compute: Add server tag proxy methods
To add a tag, remove a tag, and remove all tags. Change-Id: I4c7533007bcc85e713c532830b979b9d3fedb612 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
67cd66688d
commit
6d98de4f33
@ -121,6 +121,13 @@ Server Interface Operations
|
||||
:members: create_server_interface, delete_server_interface,
|
||||
get_server_interface, server_interfaces,
|
||||
|
||||
Server Tag Operations
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: openstack.compute.v2._proxy.Proxy
|
||||
:noindex:
|
||||
:members: add_tag_to_server, remove_tag_from_server, remove_tags_from_server
|
||||
|
||||
Availability Zone Operations
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -1195,6 +1195,39 @@ class Proxy(proxy.Proxy):
|
||||
server = self._get_resource(_server.Server, server)
|
||||
server.trigger_crash_dump(self)
|
||||
|
||||
def add_tag_to_server(self, server, tag):
|
||||
"""Add a tag to a server.
|
||||
|
||||
:param server: Either the ID of a server or a
|
||||
:class:`~openstack.compute.v2.server.Server` instance.
|
||||
:param tag: The tag to add.
|
||||
:returns: None
|
||||
"""
|
||||
server = self._get_resource(_server.Server, server)
|
||||
server.add_tag(self, tag)
|
||||
|
||||
def remove_tag_from_server(self, server, tag):
|
||||
"""Remove a tag from a server.
|
||||
|
||||
:param server: Either the ID of a server or a
|
||||
:class:`~openstack.compute.v2.server.Server` instance.
|
||||
:param tag: The tag to remove.
|
||||
:returns: None
|
||||
"""
|
||||
server = self._get_resource(_server.Server, server)
|
||||
server.remove_tag(self, tag)
|
||||
|
||||
def remove_tags_from_server(self, server):
|
||||
"""Remove all tags from a server.
|
||||
|
||||
:param server: Either the ID of a server or a
|
||||
:class:`~openstack.compute.v2.server.Server` instance.
|
||||
:param tag: The tag to remove.
|
||||
:returns: None
|
||||
"""
|
||||
server = self._get_resource(_server.Server, server)
|
||||
server.remove_all_tags(self)
|
||||
|
||||
# ========== Server security groups ==========
|
||||
|
||||
def fetch_server_security_groups(self, server):
|
||||
|
@ -1277,6 +1277,30 @@ class TestCompute(TestComputeProxy):
|
||||
expected_args=[self.proxy],
|
||||
)
|
||||
|
||||
def test_server_add_tag(self):
|
||||
self._verify(
|
||||
"openstack.compute.v2.server.Server.add_tag",
|
||||
self.proxy.add_tag_to_server,
|
||||
method_args=["value", "tag"],
|
||||
expected_args=[self.proxy, "tag"],
|
||||
)
|
||||
|
||||
def test_server_remove_tag(self):
|
||||
self._verify(
|
||||
"openstack.compute.v2.server.Server.remove_tag",
|
||||
self.proxy.remove_tag_from_server,
|
||||
method_args=["value", "tag"],
|
||||
expected_args=[self.proxy, "tag"],
|
||||
)
|
||||
|
||||
def test_server_remove_tags(self):
|
||||
self._verify(
|
||||
"openstack.compute.v2.server.Server.remove_all_tags",
|
||||
self.proxy.remove_tags_from_server,
|
||||
method_args=["value"],
|
||||
expected_args=[self.proxy],
|
||||
)
|
||||
|
||||
def test_get_server_output(self):
|
||||
self._verify(
|
||||
"openstack.compute.v2.server.Server.get_console_output",
|
||||
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The following new compute proxy methods have been added:
|
||||
|
||||
- ``add_tag_to_server``
|
||||
- ``remove_tag_from_server``
|
||||
- ``remove_tags_from_server``
|
Loading…
Reference in New Issue
Block a user