diff options
author | Ruby Loo <ruby.loo@intel.com> | 2017-10-12 18:30:52 -0400 |
---|---|---|
committer | Ruby Loo <opensrloo@gmail.com> | 2018-04-02 17:56:47 +0000 |
commit | 37b85b6a399dba120de49d9056529852b2284793 (patch) | |
tree | 15729826ce2f7701e14c3b3b3f98d89a0c347cf1 /ironic/cmd | |
parent | 5816e50766e3ed9e08ff7fd7176a85b2ab835659 (diff) | |
download | ironic-37b85b6a399dba120de49d9056529852b2284793.tar.gz |
Copy port[group] VIF info from extra to internal_info
For API versions >= 1.28, Port & portgroup's .extra['vif_port_id'] was
deprecated in Ocata. Before we can remove support for this, we need to
copy that information to the object's internal_info['tenant_vif_port_id'].
This copy/migration is done at the API layer when the user specifies the
.extra[] value, as well as when the 'ironic db-sync online_data-migrations'
is run.
In order to know whether the ports and port groups have been migrated,
their IronicObject versions are incremented.
This also fixes it so that for API versions < 1.28, the deprecation
warning is not shown, since we still need to support extra['vif_port_id']
in this case.
When a port or portgroup's .extra['vif_port_id'] is removed via a
PATCH API request, that VIF is removed from that object's internal_info.
Change-Id: I69468c935e68dd9d37a474c318c3ceb9cdfc5868
Partial-Bug: 1722850
Diffstat (limited to 'ironic/cmd')
-rw-r--r-- | ironic/cmd/dbsync.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ironic/cmd/dbsync.py b/ironic/cmd/dbsync.py index e8bf0259b..2525b3d50 100644 --- a/ironic/cmd/dbsync.py +++ b/ironic/cmd/dbsync.py @@ -29,6 +29,8 @@ from ironic.common import service from ironic.conf import CONF from ironic.db import api as db_api from ironic.db import migration +from ironic.objects import port +from ironic.objects import portgroup from ironic import version @@ -64,6 +66,12 @@ dbapi = db_api.get_instance() ONLINE_MIGRATIONS = ( # TODO(dtantsur): remove when classic drivers are removed (Rocky?) (dbapi, 'migrate_to_hardware_types'), + # Added in Rocky + # TODO(rloo): remove in Stein + (port, 'migrate_vif_port_id'), + # Added in Rocky + # TODO(rloo): remove in Stein + (portgroup, 'migrate_vif_port_id'), ) |