Add the basic calls for add_fixed_ip/remove_fixed_ip.

Implementation depends on extensions to the OpenStack API
This commit is contained in:
Kevin L. Mitchell 2011-06-07 17:56:33 -05:00
parent 117e455bb6
commit 0b43ddbc93

@ -63,6 +63,22 @@ class Server(base.Resource):
"""
self.manager.unshare_ip(self, address)
def add_fixed_ip(self, network_id):
"""
Add an IP address on a network.
:param network_id: The ID of the network the IP should be on.
"""
self.manager.add_fixed_ip(self, network_id)
def remove_fixed_ip(self, address):
"""
Remove an IP address.
:param address: The IP address to remove.
"""
self.manager.remove_fixed_ip(self, address)
def reboot(self, type=REBOOT_SOFT):
"""
Reboot the server.
@ -282,6 +298,26 @@ class ServerManager(base.BootingManagerWithFind):
server = base.getid(server)
self._delete("/servers/%s/ips/public/%s" % (server, address))
def add_fixed_ip(self, server, network_id):
"""
Add an IP address on a network.
:param server: The :class:`Server` (or its ID) to add an IP to.
:param network_id: The ID of the network the IP should be on.
"""
server = base.getid(server)
# TODO(Vek) Call extension to add fixed IP
def remove_fixed_ip(self, server, address):
"""
Remove an IP address.
:param server: The :class:`Server` (or its ID) to add an IP to.
:param address: The IP address to remove.
"""
server = base.getid(server)
# TODO(Vek) Call extension to remove fixed IP
def reboot(self, server, type=REBOOT_SOFT):
"""
Reboot a server.