Nova: Remove unused server operations

Some of the APIs implemented in manila.compute.nova.API are not used
by any implementation. This change drops unused implementations rather
than keeping them maintained for no use.

Change-Id: I5195c31c6a95ed22eb89d734f3eea6a077eb2f68
This commit is contained in:
Takashi Kajinami 2022-01-26 13:55:02 +09:00 committed by Goutham Pacha Ravi
parent 39a031e65c
commit a7be9c3824
2 changed files with 0 additions and 71 deletions

View File

@ -162,34 +162,11 @@ class API(base.Base):
raise exception.ManilaException(msg) raise exception.ManilaException(msg)
return _untranslate_server_summary_view(server) return _untranslate_server_summary_view(server)
@translate_server_exception
def server_pause(self, context, instance_id):
novaclient(context).servers.pause(instance_id)
@translate_server_exception
def server_unpause(self, context, instance_id):
novaclient(context).servers.unpause(instance_id)
@translate_server_exception
def server_suspend(self, context, instance_id):
novaclient(context).servers.suspend(instance_id)
@translate_server_exception
def server_resume(self, context, instance_id):
novaclient(context).servers.resume(instance_id)
@translate_server_exception @translate_server_exception
def server_reboot(self, context, instance_id, soft_reboot=False): def server_reboot(self, context, instance_id, soft_reboot=False):
hardness = 'SOFT' if soft_reboot else 'HARD' hardness = 'SOFT' if soft_reboot else 'HARD'
novaclient(context).servers.reboot(instance_id, hardness) novaclient(context).servers.reboot(instance_id, hardness)
@translate_server_exception
def server_rebuild(self, context, instance_id, image_id, password=None):
return _untranslate_server_summary_view(
novaclient(context).servers.rebuild(instance_id, image_id,
password)
)
@translate_server_exception @translate_server_exception
def instance_volume_attach(self, context, instance_id, volume_id, def instance_volume_attach(self, context, instance_id, volume_id,
device=None): device=None):
@ -222,15 +199,6 @@ class API(base.Base):
novaclient(context).servers.update(instance_id, name=name) novaclient(context).servers.update(instance_id, name=name)
) )
def update_server_volume(self, context, instance_id, volume_id,
new_volume_id):
novaclient(context).volumes.update_server_volume(instance_id,
volume_id,
new_volume_id)
def keypair_create(self, context, name):
return novaclient(context).keypairs.create(name)
def keypair_import(self, context, name, public_key): def keypair_import(self, context, name, public_key):
return novaclient(context).keypairs.create(name, public_key) return novaclient(context).keypairs.create(name, public_key)

View File

@ -242,26 +242,6 @@ class NovaApiTestCase(test.TestCase):
instance_id = 'instance_id' instance_id = 'instance_id'
self.assertRaises(manila_e, self.api.server_get, self.ctx, instance_id) self.assertRaises(manila_e, self.api.server_get, self.ctx, instance_id)
def test_server_pause(self):
self.mock_object(self.novaclient.servers, 'pause')
self.api.server_pause(self.ctx, 'id1')
self.novaclient.servers.pause.assert_called_once_with('id1')
def test_server_unpause(self):
self.mock_object(self.novaclient.servers, 'unpause')
self.api.server_unpause(self.ctx, 'id1')
self.novaclient.servers.unpause.assert_called_once_with('id1')
def test_server_suspend(self):
self.mock_object(self.novaclient.servers, 'suspend')
self.api.server_suspend(self.ctx, 'id1')
self.novaclient.servers.suspend.assert_called_once_with('id1')
def test_server_resume(self):
self.mock_object(self.novaclient.servers, 'resume')
self.api.server_resume(self.ctx, 'id1')
self.novaclient.servers.resume.assert_called_once_with('id1')
def test_server_reboot_hard(self): def test_server_reboot_hard(self):
self.mock_object(self.novaclient.servers, 'reboot') self.mock_object(self.novaclient.servers, 'reboot')
self.api.server_reboot(self.ctx, 'id1') self.api.server_reboot(self.ctx, 'id1')
@ -274,13 +254,6 @@ class NovaApiTestCase(test.TestCase):
self.novaclient.servers.reboot.assert_called_once_with( self.novaclient.servers.reboot.assert_called_once_with(
'id1', nova_servers.REBOOT_SOFT) 'id1', nova_servers.REBOOT_SOFT)
def test_server_rebuild(self):
self.mock_object(self.novaclient.servers, 'rebuild')
self.api.server_rebuild(self.ctx, 'id1', 'fake_image')
self.novaclient.servers.rebuild.assert_called_once_with('id1',
'fake_image',
None)
def test_instance_volume_attach(self): def test_instance_volume_attach(self):
self.mock_object(self.novaclient.volumes, 'create_server_volume') self.mock_object(self.novaclient.volumes, 'create_server_volume')
self.api.instance_volume_attach(self.ctx, 'instance_id', self.api.instance_volume_attach(self.ctx, 'instance_id',
@ -313,18 +286,6 @@ class NovaApiTestCase(test.TestCase):
self.novaclient.servers.update.assert_called_once_with('id1', self.novaclient.servers.update.assert_called_once_with('id1',
name='new_name') name='new_name')
def test_update_server_volume(self):
self.mock_object(self.novaclient.volumes, 'update_server_volume')
self.api.update_server_volume(self.ctx, 'instance_id', 'att_id',
'new_vol_id')
(self.novaclient.volumes.update_server_volume.
assert_called_once_with('instance_id', 'att_id', 'new_vol_id'))
def test_keypair_create(self):
self.mock_object(self.novaclient.keypairs, 'create')
self.api.keypair_create(self.ctx, 'keypair_name')
self.novaclient.keypairs.create.assert_called_once_with('keypair_name')
def test_keypair_import(self): def test_keypair_import(self):
self.mock_object(self.novaclient.keypairs, 'create') self.mock_object(self.novaclient.keypairs, 'create')
self.api.keypair_import(self.ctx, 'keypair_name', 'fake_pub_key') self.api.keypair_import(self.ctx, 'keypair_name', 'fake_pub_key')