Wrap interface_list by proper resource class
Server resource is not the right one to represent data for interfaces. This patch adds new resource class NetworkInterface for this task. Change-Id: I02cfe520643522006333f6e1e80e029959af6e1c Closes-Bug: #1554907
This commit is contained in:
parent
5afb7889af
commit
97d63e3ecc
@ -527,6 +527,15 @@ class Server(base.Resource):
|
||||
return self.manager.trigger_crash_dump(self)
|
||||
|
||||
|
||||
class NetworkInterface(base.Resource):
|
||||
@property
|
||||
def id(self):
|
||||
return self.port_id
|
||||
|
||||
def __repr__(self):
|
||||
return '<NetworkInterface: %s>' % self.id
|
||||
|
||||
|
||||
class ServerManager(base.BootingManagerWithFind):
|
||||
resource_class = Server
|
||||
|
||||
@ -1636,7 +1645,7 @@ class ServerManager(base.BootingManagerWithFind):
|
||||
:param server: The :class:`Server` (or its ID) to query.
|
||||
"""
|
||||
return self._list('/servers/%s/os-interface' % base.getid(server),
|
||||
'interfaceAttachments')
|
||||
'interfaceAttachments', obj_class=NetworkInterface)
|
||||
|
||||
def interface_attach(self, server, port_id, net_id, fixed_ip):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user