Update attach action for RSD 2.3

Change-Id: I991fa5ed9a75a528a6281bc0a387b016dcdc7736
This commit is contained in:
Lin Yang 2019-03-18 15:20:44 -07:00
parent 2bffbbcc45
commit c3c311c904
3 changed files with 9 additions and 9 deletions

View File

@ -341,17 +341,16 @@ class AttachEndpoint(command.Command):
metavar='<resource uri>',
help='URI of the specific resource to attach to node.')
parser.add_argument(
'--capacity',
metavar='<size>',
type=int,
help='Required storage capacity in GiB.')
'--protocol',
metavar='<protocol>',
help='Specified protocol of attaching resource.')
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
rsd_client = self.app.client_manager.rsd
rsd_client.node.attach(parsed_args.node, parsed_args.resource,
parsed_args.capacity)
parsed_args.protocol)
class DetachEndpoint(command.Command):

View File

@ -106,9 +106,10 @@ class NodeTest(testtools.TestCase):
node_uri = '/redfish/v1/Nodes/1'
mock_node = mock.Mock()
self.client.get_node.return_value = mock_node
self.mgr.attach(node_uri, 'fake uri', 10)
self.mgr.attach(node_uri, 'fake uri', 'protocol')
self.mgr.client.get_node.assert_called_once_with('/redfish/v1/Nodes/1')
mock_node.attach_endpoint.assert_called_once_with('fake uri', 10)
mock_node.attach_endpoint.assert_called_once_with(
'fake uri', 'protocol')
def test_detach(self):
node_uri = '/redfish/v1/Nodes/1'

View File

@ -70,9 +70,9 @@ class NodeManager(base.Manager):
nodes, ["Identity", "Name", "UUID", "Description"])
return node_info_table
def attach(self, node_uri, endpoint=None, capacity=None):
def attach(self, node_uri, endpoint=None, protocol=None):
node = self.client.get_node(node_uri)
node.attach_endpoint(endpoint, capacity)
node.attach_endpoint(endpoint, protocol)
def detach(self, node_uri, endpoint):
node = self.client.get_node(node_uri)