Merge "Fix list of server migrations"
This commit is contained in:
commit
76e088a056
@ -18,15 +18,15 @@ from openstack import utils
|
||||
class ServerMigration(resource.Resource):
|
||||
resource_key = 'migration'
|
||||
resources_key = 'migrations'
|
||||
base_path = '/servers/%(server_uuid)s/migrations'
|
||||
base_path = '/servers/%(server_id)s/migrations'
|
||||
|
||||
# capabilities
|
||||
allow_fetch = True
|
||||
allow_list = True
|
||||
allow_delete = True
|
||||
|
||||
#: The ID for the server.
|
||||
server_id = resource.URI('server_uuid')
|
||||
#: The ID for the server from the URI of the resource
|
||||
server_id = resource.URI('server_id')
|
||||
|
||||
#: The date and time when the resource was created.
|
||||
created_at = resource.Body('created_at')
|
||||
@ -53,11 +53,8 @@ class ServerMigration(resource.Resource):
|
||||
#: The ID of the project that initiated the server migration (since
|
||||
#: microversion 2.80)
|
||||
project_id = resource.Body('project_id')
|
||||
# FIXME(stephenfin): This conflicts since there is a server ID in the URI
|
||||
# *and* in the body. We need a field that handles both or we need to use
|
||||
# different names.
|
||||
# #: The UUID of the server
|
||||
# server_id = resource.Body('server_uuid')
|
||||
#: The UUID of the server from the response body
|
||||
server_uuid = resource.Body('server_uuid')
|
||||
#: The source compute of the migration.
|
||||
source_compute = resource.Body('source_compute')
|
||||
#: The source node of the migration.
|
||||
@ -80,7 +77,7 @@ class ServerMigration(resource.Resource):
|
||||
microversion = self._get_microversion(session, action='list')
|
||||
|
||||
url = utils.urljoin(
|
||||
self.base_path % {'server_uuid': self.server_id},
|
||||
self.base_path % {'server_id': self.server_id},
|
||||
self.id,
|
||||
'action',
|
||||
)
|
||||
|
@ -17,6 +17,7 @@ from openstack.tests.unit import base
|
||||
|
||||
EXAMPLE = {
|
||||
'id': 4,
|
||||
'server_id': '4cfba335-03d8-49b2-8c52-e69043d1e8fe',
|
||||
'server_uuid': '4cfba335-03d8-49b2-8c52-e69043d1e8fe',
|
||||
'user_id': '8dbaa0f0-ab95-4ffe-8cb4-9c89d2ac9d24',
|
||||
'project_id': '5f705771-3aa9-4f4c-8660-0d9522ffdbea',
|
||||
@ -51,7 +52,7 @@ class TestServerMigration(base.TestCase):
|
||||
sot = server_migration.ServerMigration()
|
||||
self.assertEqual('migration', sot.resource_key)
|
||||
self.assertEqual('migrations', sot.resources_key)
|
||||
self.assertEqual('/servers/%(server_uuid)s/migrations', sot.base_path)
|
||||
self.assertEqual('/servers/%(server_id)s/migrations', sot.base_path)
|
||||
self.assertFalse(sot.allow_create)
|
||||
self.assertTrue(sot.allow_fetch)
|
||||
self.assertTrue(sot.allow_list)
|
||||
@ -105,7 +106,7 @@ class TestServerMigration(base.TestCase):
|
||||
self.assertIsNone(sot.force_complete(self.sess))
|
||||
|
||||
url = 'servers/%s/migrations/%s/action' % (
|
||||
EXAMPLE['server_uuid'],
|
||||
EXAMPLE['server_id'],
|
||||
EXAMPLE['id'],
|
||||
)
|
||||
body = {'force_complete': None}
|
||||
|
Loading…
x
Reference in New Issue
Block a user