From 0634a38cdcb756199160aa1e476c8212c7145250 Mon Sep 17 00:00:00 2001 From: Matt Riedemann <mriedem@us.ibm.com> Date: Tue, 5 Apr 2016 17:32:20 -0400 Subject: [PATCH] Remove busted baremetal CLIs and API bindings The os-baremetal-nodes compute API does not proxy baremetal node create/delete or interface add/remove requests to Ironic, so there is no point in even having CLIs or python bindings for these operations in the client. There isn't a point in deprecating these since they are already unusable, so let's just remove them. Change-Id: Id5dd7fbddff87e506460904e352713ae777a8073 Closes-Bug: #1566535 --- .../tests/unit/v2/contrib/test_baremetal.py | 24 --- novaclient/v2/contrib/baremetal.py | 174 ------------------ 2 files changed, 198 deletions(-) diff --git a/novaclient/tests/unit/v2/contrib/test_baremetal.py b/novaclient/tests/unit/v2/contrib/test_baremetal.py index 406e617af..fdcd4f5fb 100644 --- a/novaclient/tests/unit/v2/contrib/test_baremetal.py +++ b/novaclient/tests/unit/v2/contrib/test_baremetal.py @@ -41,30 +41,6 @@ class BaremetalExtensionTest(utils.TestCase): self.cs.assert_called('GET', '/os-baremetal-nodes/1') self.assertIsInstance(n, baremetal.BareMetalNode) - def test_create_node(self): - n = self.cs.baremetal.create("service_host", 1, 1024, 2048, - "aa:bb:cc:dd:ee:ff") - self.assert_request_id(n, fakes.FAKE_REQUEST_ID_LIST) - self.cs.assert_called('POST', '/os-baremetal-nodes') - self.assertIsInstance(n, baremetal.BareMetalNode) - - def test_delete_node(self): - n = self.cs.baremetal.get(1) - ret = self.cs.baremetal.delete(n) - self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST) - self.cs.assert_called('DELETE', '/os-baremetal-nodes/1') - - def test_node_add_interface(self): - i = self.cs.baremetal.add_interface(1, "bb:cc:dd:ee:ff:aa", 1, 2) - self.assert_request_id(i, fakes.FAKE_REQUEST_ID_LIST) - self.cs.assert_called('POST', '/os-baremetal-nodes/1/action') - self.assertIsInstance(i, baremetal.BareMetalNodeInterface) - - def test_node_remove_interface(self): - ret = self.cs.baremetal.remove_interface(1, "bb:cc:dd:ee:ff:aa") - self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST) - self.cs.assert_called('POST', '/os-baremetal-nodes/1/action') - def test_node_list_interfaces(self): il = self.cs.baremetal.list_interfaces(1) self.assert_request_id(il, fakes.FAKE_REQUEST_ID_LIST) diff --git a/novaclient/v2/contrib/baremetal.py b/novaclient/v2/contrib/baremetal.py index 911944212..4307d6cc1 100644 --- a/novaclient/v2/contrib/baremetal.py +++ b/novaclient/v2/contrib/baremetal.py @@ -46,51 +46,6 @@ class BareMetalNodeManager(base.ManagerWithFind): """ resource_class = BareMetalNode - def create(self, - service_host, - cpus, - memory_mb, - local_gb, - prov_mac_address, - pm_address=None, - pm_user=None, - pm_password=None, - terminal_port=None): - """ - Create a baremetal node. - - :param service_host: Name of controlling compute host - :param cpus: Number of CPUs in the node - :param memory_mb: Megabytes of RAM in the node - :param local_gb: Gigabytes of local storage in the node - :param pm_address: Power management IP for the node - :param pm_user: Username for the node's power management - :param pm_password: Password for the node's power management - :param prov_mac_address: MAC address to provision the node - :param terminal_port: ShellInABox port - :rtype: :class:`BareMetalNode` - """ - body = {'node': {'service_host': service_host, - 'cpus': cpus, - 'memory_mb': memory_mb, - 'local_gb': local_gb, - 'pm_address': pm_address, - 'pm_user': pm_user, - 'pm_password': pm_password, - 'prov_mac_address': prov_mac_address, - 'terminal_port': terminal_port}} - - return self._create('/os-baremetal-nodes', body, 'node') - - def delete(self, node): - """ - Delete a baremetal node. - - :param node: The :class:`BareMetalNode` to delete. - :returns: An instance of novaclient.base.TupleWithMeta - """ - return self._delete('/os-baremetal-nodes/%s' % base.getid(node)) - def get(self, node_id): """ Get a baremetal node. @@ -108,37 +63,6 @@ class BareMetalNodeManager(base.ManagerWithFind): """ return self._list('/os-baremetal-nodes', 'nodes') - def add_interface(self, node_id, address, datapath_id=0, port_no=0): - """ - Add an interface to a baremetal node. - - :param node_id: The ID of the node to modify. - :param address: The MAC address to add. - :param datapath_id: Datapath ID of OpenFlow switch for the interface - :param port_no: OpenFlow port number for the interface - :rtype: :class:`BareMetalNodeInterface` - """ - body = {'add_interface': {'address': address, - 'datapath_id': datapath_id, - 'port_no': port_no}} - url = '/os-baremetal-nodes/%s/action' % node_id - resp, body = self.api.client.post(url, body=body) - return BareMetalNodeInterface(self, body['interface'], resp=resp) - - def remove_interface(self, node_id, address): - """ - Remove an interface from a baremetal node. - - :param node_id: The ID of the node to modify. - :param address: The MAC address to remove. - :returns: An instance of novaclient.base.TupleWithMeta - """ - req_body = {'remove_interface': {'address': address}} - url = '/os-baremetal-nodes/%s/action' % node_id - resp, body = self.api.client.post(url, body=req_body) - - return self.convert_into_with_meta(body, resp) - def list_interfaces(self, node_id): """ List the interfaces on a baremetal node. @@ -155,69 +79,6 @@ class BareMetalNodeManager(base.ManagerWithFind): return interfaces -@utils.arg( - 'service_host', - metavar='<service_host>', - help=_('Name of nova compute host which will control this baremetal ' - 'node')) -@utils.arg( - 'cpus', - metavar='<cpus>', - type=int, - help=_('Number of CPUs in the node')) -@utils.arg( - 'memory_mb', - metavar='<memory_mb>', - type=int, - help=_('Megabytes of RAM in the node')) -@utils.arg( - 'local_gb', - metavar='<local_gb>', - type=int, - help=_('Gigabytes of local storage in the node')) -@utils.arg( - 'prov_mac_address', - metavar='<prov_mac_address>', - help=_('MAC address to provision the node')) -@utils.arg( - '--pm_address', default=None, - metavar='<pm_address>', - help=_('Power management IP for the node')) -@utils.arg( - '--pm_user', default=None, - metavar='<pm_user>', - help=_('Username for the node\'s power management')) -@utils.arg( - '--pm_password', default=None, - metavar='<pm_password>', - help=_('Password for the node\'s power management')) -@utils.arg( - '--terminal_port', default=None, - metavar='<terminal_port>', - type=int, - help=_('ShellInABox port?')) -def do_baremetal_node_create(cs, args): - """Create a baremetal node.""" - node = cs.baremetal.create(args.service_host, args.cpus, - args.memory_mb, args.local_gb, - args.prov_mac_address, - pm_address=args.pm_address, - pm_user=args.pm_user, - pm_password=args.pm_password, - terminal_port=args.terminal_port) - _print_baremetal_resource(node) - - -@utils.arg( - 'node', - metavar='<node>', - help=_('ID of the node to delete.')) -def do_baremetal_node_delete(cs, args): - """Remove a baremetal node and any associated interfaces.""" - node = _find_baremetal_node(cs, args.node) - cs.baremetal.delete(node) - - def _translate_baremetal_node_keys(collection): convert = [('service_host', 'host'), ('local_gb', 'disk_gb'), @@ -300,41 +161,6 @@ def do_baremetal_node_show(cs, args): _print_baremetal_resource(node) -@utils.arg( - 'node', - metavar='<node>', - help=_("ID of node")) -@utils.arg( - 'address', - metavar='<address>', - help=_("MAC address of interface")) -@utils.arg( - '--datapath_id', - default=0, - metavar='<datapath_id>', - help=_("OpenFlow Datapath ID of interface")) -@utils.arg( - '--port_no', - default=0, - metavar='<port_no>', - help=_("OpenFlow port number of interface")) -def do_baremetal_interface_add(cs, args): - """Add a network interface to a baremetal node.""" - bmif = cs.baremetal.add_interface(args.node, args.address, - args.datapath_id, args.port_no) - _print_baremetal_resource(bmif) - - -@utils.arg('node', metavar='<node>', help=_("ID of node")) -@utils.arg( - 'address', - metavar='<address>', - help=_("MAC address of interface")) -def do_baremetal_interface_remove(cs, args): - """Remove a network interface from a baremetal node.""" - cs.baremetal.remove_interface(args.node, args.address) - - @utils.arg('node', metavar='<node>', help=_("ID of node")) def do_baremetal_interface_list(cs, args): """List network interfaces associated with a baremetal node."""