Comment 7 for bug 1907525

Revision history for this message
Hariom Sharma (hariomsharma75) wrote :

Hi Yoshito, Thanks for your prompt reply and helping out on this one.

1. I tried upgrading from one to other revision but this command is failing :

[root@localhost ~(keystone_admin)]# tacker-db-manage --config-file /etc/tacker/tacker.conf upgrade c47a733f425a:329cd1619d41
  FAILED: Range revision not allowed
[root@localhost ~(keystone_admin)]#

2. I tried with --sql option and getting the following output:

[root@localhost orion-vnfd(keystone_admin)]# tacker-db-manage --config-file /etc/tacker/tacker.conf upgrade c47a733f425a:329cd1619d41 --sql
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Generating static SQL
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade c47a733f425a -> ee98bbc0789d, add scale column
-- Running upgrade c47a733f425a -> ee98bbc0789d

ALTER TABLE vnf_instantiated_info ADD COLUMN scale_status JSON;

UPDATE alembic_version SET version_num='ee98bbc0789d' WHERE alembic_version.version_num = 'c47a733f425a';

INFO [alembic.runtime.migration] Running upgrade ee98bbc0789d -> 2c5211036579, add placement table
-- Running upgrade ee98bbc0789d -> 2c5211036579

CREATE TABLE placement_constraint (
    id VARCHAR(36) NOT NULL,
    vnf_instance_id VARCHAR(36) NOT NULL,
    affinity_or_anti_affinity VARCHAR(255) NOT NULL,
    scope VARCHAR(255) NOT NULL,
    server_group_name VARCHAR(255) NOT NULL,
    resource JSON NOT NULL,
    created_at DATETIME NOT NULL,
    updated_at DATETIME,
    deleted_at DATETIME,
    deleted BOOL,
    PRIMARY KEY (id),
    CHECK (deleted IN (0, 1))
)ENGINE=InnoDB;

UPDATE alembic_version SET version_num='2c5211036579' WHERE alembic_version.version_num = 'ee98bbc0789d';

INFO [alembic.runtime.migration] Running upgrade 2c5211036579 -> d25c7c865ce8, mod_vnflcm_subscription
-- Running upgrade 2c5211036579 -> d25c7c865ce8

ALTER TABLE vnf_lcm_filters MODIFY subscription_uuid VARCHAR(36) NOT NULL;

Traceback (most recent call last):
  File "/usr/local/bin/tacker-db-manage", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/tacker/db/migration/cli.py", line 178, in main
    CONF.command.func(config, CONF.command.name)
  File "/usr/local/lib/python3.6/site-packages/tacker/db/migration/cli.py", line 68, in do_upgrade
    do_alembic_command(config, cmd, revision, sql=CONF.command.sql)
  File "/usr/local/lib/python3.6/site-packages/tacker/db/migration/cli.py", line 47, in do_alembic_command
    getattr(alembic_command, cmd)(config, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/alembic/command.py", line 298, in upgrade
    script.run_env()
  File "/usr/lib/python3.6/site-packages/alembic/script/base.py", line 489, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/usr/lib/python3.6/site-packages/alembic/util/pyfiles.py", line 98, in load_python_file
    module = load_module_py(module_id, path)
  File "/usr/lib/python3.6/site-packages/alembic/util/compat.py", line 173, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.6/site-packages/tacker/db/migration/alembic_migrations/env.py", line 82, in <module>
    run_migrations_offline()
  File "/usr/local/lib/python3.6/site-packages/tacker/db/migration/alembic_migrations/env.py", line 54, in run_migrations_offline
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/usr/lib/python3.6/site-packages/alembic/runtime/environment.py", line 846, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/usr/lib/python3.6/site-packages/alembic/runtime/migration.py", line 518, in run_migrations
    step.migration_fn(**kw)
  File "/usr/local/lib/python3.6/site-packages/tacker/db/migration/alembic_migrations/versions/d25c7c865ce8_mod_vnflcm_subscription.py", line 47, in upgrade
    sa.Computed(sta_str)))
AttributeError: module 'sqlalchemy' has no attribute 'Computed'
[root@localhost orion-vnfd(keystone_admin)]#

3. I am planning to trying the following DB commands manually :

-- Running upgrade c47a733f425a -> ee98bbc0789d

ALTER TABLE vnf_instantiated_info ADD COLUMN scale_status JSON;

UPDATE alembic_version SET version_num='ee98bbc0789d' WHERE alembic_version.version_num = 'c47a733f425a';

INFO [alembic.runtime.migration] Running upgrade ee98bbc0789d -> 2c5211036579, add placement table
-- Running upgrade ee98bbc0789d -> 2c5211036579

CREATE TABLE placement_constraint (
    id VARCHAR(36) NOT NULL,
    vnf_instance_id VARCHAR(36) NOT NULL,
    affinity_or_anti_affinity VARCHAR(255) NOT NULL,
    scope VARCHAR(255) NOT NULL,
    server_group_name VARCHAR(255) NOT NULL,
    resource JSON NOT NULL,
    created_at DATETIME NOT NULL,
    updated_at DATETIME,
    deleted_at DATETIME,
    deleted BOOL,
    PRIMARY KEY (id),
    CHECK (deleted IN (0, 1))
)ENGINE=InnoDB;

UPDATE alembic_version SET version_num='2c5211036579' WHERE alembic_version.version_num = 'ee98bbc0789d';

INFO [alembic.runtime.migration] Running upgrade 2c5211036579 -> d25c7c865ce8, mod_vnflcm_subscription
-- Running upgrade 2c5211036579 -> d25c7c865ce8

ALTER TABLE vnf_lcm_filters MODIFY subscription_uuid VARCHAR(36) NOT NULL;

4. If #3 will not work, then I will delete the tacker database and reinstall it.

Please confirm if commands listed in #3 step are correct for manual update of DB schema.