Skip to content

Commit

Permalink
Filter migrations by user_id/project_id
Browse files Browse the repository at this point in the history
In microversion 2.80, the ``GET /os-migrations`` API will have
optional ``user_id`` and ``project_id`` query parameters for
filtering migrations by user and/or project:

* GET /os-migrations?user_id=ef9d34b4-45d0-4530-871b-3fb535988394
* GET /os-migrations?project_id=011ee9f4-8f16-4c38-8633-a254d420fd54
* GET /os-migrations?user_id=ef9d34b4-45d0-4530-871b-3fb535988394&project_id=011ee9f4-8f16-4c38-8633-a254d420fd54

And expose the ``user_id`` and ``project_id`` fields in the following APIs:

* GET /os-migrations
* GET /servers/{server_id}/migrations
* GET /servers/{server_id}/migrations/{migration_id}

Co-Authored-By: Qiu Fossen <qiujunting>
Part of blueprint add-user-id-field-to-the-migrations-table
Change-Id: I7313d6cde1a5e1dc7dd6f3c0dff9f30bbf4bee2c
  • Loading branch information
1049965823 authored and kk7ds committed Oct 14, 2019
1 parent d14ae3a commit ac16511
Show file tree
Hide file tree
Showing 35 changed files with 1,115 additions and 25 deletions.
13 changes: 8 additions & 5 deletions api-ref/source/os-migrations.inc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Request
- marker: migration_marker
- changes-since: changes_since_migration
- changes-before: changes_before_migration
- user_id: user_id_query_migrations
- project_id: project_id_query_migrations

Response
--------
Expand All @@ -62,19 +64,20 @@ Response
- links: migration_links_2_23
- uuid: migration_uuid
- migrations_links: migration_next_links_2_59
- user_id: user_id_migration_2_80
- project_id: project_id_migration_2_80

**Example List Migrations: JSON response**

.. literalinclude:: ../../doc/api_samples/os-migrations/migrations-get.json
:language: javascript

**Example List Migrations (v2.59):**
**Example List Migrations (v2.80):**

.. literalinclude:: ../../doc/api_samples/os-migrations/v2.59/migrations-get.json
.. literalinclude:: ../../doc/api_samples/os-migrations/v2.80/migrations-get.json
:language: javascript

**Example List Migrations With Paging (v2.59):**
**Example List Migrations With Paging (v2.80):**

.. literalinclude:: ../../doc/api_samples/os-migrations/v2.59/migrations-get-with-limit.json
.. literalinclude:: ../../doc/api_samples/os-migrations/v2.80/migrations-get-with-limit.json
:language: javascript

30 changes: 30 additions & 0 deletions api-ref/source/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,13 @@ progress_query_server:
in: query
required: false
type: integer
project_id_query_migrations:
description: |
Filter the migrations by the given project ID.
in: query
required: false
type: string
min_version: 2.80
project_id_query_server:
description: |
Filter the list of servers by the given project ID.
Expand Down Expand Up @@ -1409,6 +1416,13 @@ usage_marker:
required: false
type: string
min_version: 2.40
user_id_query_migrations:
description: |
Filter the migrations by the given user ID.
in: query
required: false
type: string
min_version: 2.80
user_id_query_quota:
description: |
ID of user to list the quotas for.
Expand Down Expand Up @@ -5697,6 +5711,14 @@ project_id:
in: body
required: false
type: string
project_id_migration_2_80:
description: |
The ID of the project which initiated the server migration. The value
may be ``null`` for older migration records.
in: body
required: true
type: string
min_version: 2.80
project_id_server:
description: |
The ID of the project that this server belongs to.
Expand Down Expand Up @@ -7113,6 +7135,14 @@ user_id:
in: body
required: true
type: string
user_id_migration_2_80:
description: |
The ID of the user which initiated the server migration. The value
may be ``null`` for older migration records.
in: body
required: true
type: string
min_version: 2.80
user_id_server_action:
description: |
The ID of the user which initiated the server action.
Expand Down
12 changes: 8 additions & 4 deletions api-ref/source/server-migrations.inc
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ Response
- status: migrate_status
- updated_at: updated
- uuid: migration_uuid
- user_id: user_id_migration_2_80
- project_id: project_id_migration_2_80

**Example List Migrations (2.59)**
**Example List Migrations (2.80)**

.. literalinclude:: ../../doc/api_samples/server-migrations/v2.59/migrations-index.json
.. literalinclude:: ../../doc/api_samples/server-migrations/v2.80/migrations-index.json
:language: javascript

Show Migration Details
Expand Down Expand Up @@ -107,10 +109,12 @@ Response
- status: migrate_status
- updated_at: updated
- uuid: migration_uuid
- user_id: user_id_migration_2_80
- project_id: project_id_migration_2_80

**Example Show Migration Details (2.59)**
**Example Show Migration Details (2.80)**

.. literalinclude:: ../../doc/api_samples/server-migrations/v2.59/migrations-get.json
.. literalinclude:: ../../doc/api_samples/server-migrations/v2.80/migrations-get.json
:language: javascript

Force Migration Complete Action (force_complete Action)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"migrations": [
{
"created_at": "2016-01-29T11:42:02.000000",
"dest_compute": "compute2",
"dest_host": "1.2.3.4",
"dest_node": "node2",
"id": 1,
"instance_uuid": "8600d31b-d1a1-4632-b2ff-45c2be1a70ff",
"links": [
{
"href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/servers/8600d31b-d1a1-4632-b2ff-45c2be1a70ff/migrations/1",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/servers/8600d31b-d1a1-4632-b2ff-45c2be1a70ff/migrations/1",
"rel": "bookmark"
}
],
"new_instance_type_id": 1,
"old_instance_type_id": 1,
"source_compute": "compute1",
"source_node": "node1",
"status": "running",
"migration_type": "live-migration",
"updated_at": "2016-01-29T11:42:02.000000",
"uuid": "12341d4b-346a-40d0-83c6-5f4f6892b650",
"user_id": "5c48ebaa-193f-4c5d-948a-f559cc92cd5e",
"project_id": "ef92ccff-00f3-46e4-b015-811110e36ee4"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"migrations": [
{
"created_at": "2016-06-23T14:42:02.000000",
"dest_compute": "compute20",
"dest_host": "5.6.7.8",
"dest_node": "node20",
"id": 4,
"instance_uuid": "9128d044-7b61-403e-b766-7547076ff6c1",
"new_instance_type_id": 6,
"old_instance_type_id": 5,
"source_compute": "compute10",
"source_node": "node10",
"status": "migrating",
"migration_type": "resize",
"updated_at": "2016-06-23T14:42:02.000000",
"uuid": "42341d4b-346a-40d0-83c6-5f4f6892b650",
"user_id": "78348f0e-97ee-4d70-ad34-189692673ea2",
"project_id": "9842f0f7-1229-4355-afe7-15ebdbb8c3d8"
},
{
"created_at": "2016-06-23T13:42:02.000000",
"dest_compute": "compute20",
"dest_host": "5.6.7.8",
"dest_node": "node20",
"id": 3,
"instance_uuid": "9128d044-7b61-403e-b766-7547076ff6c1",
"new_instance_type_id": 6,
"old_instance_type_id": 5,
"source_compute": "compute10",
"source_node": "node10",
"status": "error",
"migration_type": "resize",
"updated_at": "2016-06-23T13:42:02.000000",
"uuid": "32341d4b-346a-40d0-83c6-5f4f6892b650",
"user_id": "78348f0e-97ee-4d70-ad34-189692673ea2",
"project_id": "9842f0f7-1229-4355-afe7-15ebdbb8c3d8"
}
]
}
28 changes: 28 additions & 0 deletions doc/api_samples/os-migrations/v2.80/migrations-get-with-limit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"migrations": [
{
"created_at": "2016-06-23T14:42:02.000000",
"dest_compute": "compute20",
"dest_host": "5.6.7.8",
"dest_node": "node20",
"id": 4,
"instance_uuid": "9128d044-7b61-403e-b766-7547076ff6c1",
"new_instance_type_id": 6,
"old_instance_type_id": 5,
"source_compute": "compute10",
"source_node": "node10",
"status": "migrating",
"migration_type": "resize",
"updated_at": "2016-06-23T14:42:02.000000",
"uuid": "42341d4b-346a-40d0-83c6-5f4f6892b650",
"user_id": "78348f0e-97ee-4d70-ad34-189692673ea2",
"project_id": "9842f0f7-1229-4355-afe7-15ebdbb8c3d8"
}
],
"migrations_links": [
{
"href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/os-migrations?limit=1&marker=42341d4b-346a-40d0-83c6-5f4f6892b650",
"rel": "next"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"migrations": [
{
"created_at": "2016-01-29T11:42:02.000000",
"dest_compute": "compute2",
"dest_host": "1.2.3.4",
"dest_node": "node2",
"id": 1,
"instance_uuid": "8600d31b-d1a1-4632-b2ff-45c2be1a70ff",
"links": [
{
"href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/servers/8600d31b-d1a1-4632-b2ff-45c2be1a70ff/migrations/1",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/servers/8600d31b-d1a1-4632-b2ff-45c2be1a70ff/migrations/1",
"rel": "bookmark"
}
],
"new_instance_type_id": 1,
"old_instance_type_id": 1,
"source_compute": "compute1",
"source_node": "node1",
"status": "running",
"migration_type": "live-migration",
"updated_at": "2016-01-29T11:42:02.000000",
"uuid": "12341d4b-346a-40d0-83c6-5f4f6892b650",
"user_id": "5c48ebaa-193f-4c5d-948a-f559cc92cd5e",
"project_id": "ef92ccff-00f3-46e4-b015-811110e36ee4"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"migrations": [
{
"created_at": "2016-01-29T12:42:02.000000",
"dest_compute": "compute2",
"dest_host": "1.2.3.4",
"dest_node": "node2",
"id": 2,
"instance_uuid": "8600d31b-d1a1-4632-b2ff-45c2be1a70ff",
"new_instance_type_id": 1,
"old_instance_type_id": 1,
"source_compute": "compute1",
"source_node": "node1",
"status": "error",
"migration_type": "live-migration",
"updated_at": "2016-01-29T12:42:02.000000",
"uuid": "22341d4b-346a-40d0-83c6-5f4f6892b650",
"user_id": "5c48ebaa-193f-4c5d-948a-f559cc92cd5e",
"project_id": "ef92ccff-00f3-46e4-b015-811110e36ee4"
},
{
"created_at": "2016-01-29T11:42:02.000000",
"dest_compute": "compute2",
"dest_host": "1.2.3.4",
"dest_node": "node2",
"id": 1,
"instance_uuid": "8600d31b-d1a1-4632-b2ff-45c2be1a70ff",
"links": [
{
"href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/servers/8600d31b-d1a1-4632-b2ff-45c2be1a70ff/migrations/1",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/servers/8600d31b-d1a1-4632-b2ff-45c2be1a70ff/migrations/1",
"rel": "bookmark"
}
],
"new_instance_type_id": 1,
"old_instance_type_id": 1,
"source_compute": "compute1",
"source_node": "node1",
"status": "running",
"migration_type": "live-migration",
"updated_at": "2016-01-29T11:42:02.000000",
"uuid": "12341d4b-346a-40d0-83c6-5f4f6892b650",
"user_id": "5c48ebaa-193f-4c5d-948a-f559cc92cd5e",
"project_id": "ef92ccff-00f3-46e4-b015-811110e36ee4"
}
]
}
86 changes: 86 additions & 0 deletions doc/api_samples/os-migrations/v2.80/migrations-get.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"migrations": [
{
"created_at": "2016-06-23T14:42:02.000000",
"dest_compute": "compute20",
"dest_host": "5.6.7.8",
"dest_node": "node20",
"id": 4,
"instance_uuid": "9128d044-7b61-403e-b766-7547076ff6c1",
"new_instance_type_id": 6,
"old_instance_type_id": 5,
"source_compute": "compute10",
"source_node": "node10",
"status": "migrating",
"migration_type": "resize",
"updated_at": "2016-06-23T14:42:02.000000",
"uuid": "42341d4b-346a-40d0-83c6-5f4f6892b650",
"user_id": "78348f0e-97ee-4d70-ad34-189692673ea2",
"project_id": "9842f0f7-1229-4355-afe7-15ebdbb8c3d8"
},
{
"created_at": "2016-06-23T13:42:02.000000",
"dest_compute": "compute20",
"dest_host": "5.6.7.8",
"dest_node": "node20",
"id": 3,
"instance_uuid": "9128d044-7b61-403e-b766-7547076ff6c1",
"new_instance_type_id": 6,
"old_instance_type_id": 5,
"source_compute": "compute10",
"source_node": "node10",
"status": "error",
"migration_type": "resize",
"updated_at": "2016-06-23T13:42:02.000000",
"uuid": "32341d4b-346a-40d0-83c6-5f4f6892b650",
"user_id": "78348f0e-97ee-4d70-ad34-189692673ea2",
"project_id": "9842f0f7-1229-4355-afe7-15ebdbb8c3d8"
},
{
"created_at": "2016-01-29T12:42:02.000000",
"dest_compute": "compute2",
"dest_host": "1.2.3.4",
"dest_node": "node2",
"id": 2,
"instance_uuid": "8600d31b-d1a1-4632-b2ff-45c2be1a70ff",
"new_instance_type_id": 1,
"old_instance_type_id": 1,
"source_compute": "compute1",
"source_node": "node1",
"status": "error",
"migration_type": "live-migration",
"updated_at": "2016-01-29T12:42:02.000000",
"uuid": "22341d4b-346a-40d0-83c6-5f4f6892b650",
"user_id": "5c48ebaa-193f-4c5d-948a-f559cc92cd5e",
"project_id": "ef92ccff-00f3-46e4-b015-811110e36ee4"
},
{
"created_at": "2016-01-29T11:42:02.000000",
"dest_compute": "compute2",
"dest_host": "1.2.3.4",
"dest_node": "node2",
"id": 1,
"instance_uuid": "8600d31b-d1a1-4632-b2ff-45c2be1a70ff",
"links": [
{
"href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/servers/8600d31b-d1a1-4632-b2ff-45c2be1a70ff/migrations/1",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/servers/8600d31b-d1a1-4632-b2ff-45c2be1a70ff/migrations/1",
"rel": "bookmark"
}
],
"new_instance_type_id": 1,
"old_instance_type_id": 1,
"source_compute": "compute1",
"source_node": "node1",
"status": "running",
"migration_type": "live-migration",
"updated_at": "2016-01-29T11:42:02.000000",
"uuid": "12341d4b-346a-40d0-83c6-5f4f6892b650",
"user_id": "5c48ebaa-193f-4c5d-948a-f559cc92cd5e",
"project_id": "ef92ccff-00f3-46e4-b015-811110e36ee4"
}
]
}
Loading

0 comments on commit ac16511

Please sign in to comment.