Fix the interface to call update_server_volume
Currently when calling update_server_volume through nova client, it gives the user id of the used context, which leads failure. As this user may can't access the nova service catalog. This patch sets privileged_user as True and calls nova. Change-Id: I5861b2ca9cc1d10ba83eb088aa9fc073973aee93 Closes-bug: #1614344
This commit is contained in:
parent
15d2229d72
commit
2cd599ac6b
@ -175,9 +175,10 @@ class API(base.Base):
|
||||
|
||||
def update_server_volume(self, context, server_id, attachment_id,
|
||||
new_volume_id):
|
||||
novaclient(context).volumes.update_server_volume(server_id,
|
||||
attachment_id,
|
||||
new_volume_id)
|
||||
nova = novaclient(context, admin_endpoint=True, privileged_user=True)
|
||||
nova.volumes.update_server_volume(server_id,
|
||||
attachment_id,
|
||||
new_volume_id)
|
||||
|
||||
def create_volume_snapshot(self, context, volume_id, create_info):
|
||||
nova = novaclient(context, admin_endpoint=True, privileged_user=True)
|
||||
|
@ -162,7 +162,9 @@ class NovaApiTestCase(test.TestCase):
|
||||
self.api.update_server_volume(self.ctx, 'server_id',
|
||||
'attach_id', 'new_volume_id')
|
||||
|
||||
mock_novaclient.assert_called_once_with(self.ctx)
|
||||
mock_novaclient.assert_called_once_with(self.ctx,
|
||||
admin_endpoint=True,
|
||||
privileged_user=True)
|
||||
mock_update_server_volume.assert_called_once_with(
|
||||
'server_id',
|
||||
'attach_id',
|
||||
|
Loading…
Reference in New Issue
Block a user