← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1207344] Re: Migration 185 does not downgrade on MySQL

 

** Changed in: nova
       Status: Fix Committed => Fix Released

** Changed in: nova
    Milestone: None => havana-3

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1207344

Title:
  Migration 185 does not downgrade on MySQL

Status in OpenStack Compute (Nova):
  Fix Released

Bug description:
  When downgrading migration 185 I get the following error:

  OperationalError: (OperationalError) (1061, "Duplicate key name
  'virtual_interfaces_instance_uuid_fkey'") 'ALTER TABLE
  virtual_interfaces ADD CONSTRAINT
  virtual_interfaces_instance_uuid_fkey UNIQUE (address)' ()

  The virtual_interfaces table has a
  virtual_interfaces_instance_uuid_fkey KEY before the upgrade. That is,
  before the upgrade, virtual_interfaces looks like so:

  CREATE TABLE `virtual_interfaces` (
   `created_at` datetime DEFAULT NULL,
   `updated_at` datetime DEFAULT NULL,
   `deleted_at` datetime DEFAULT NULL,
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `address` varchar(255) DEFAULT NULL,
   `network_id` int(11) DEFAULT NULL,
   `uuid` varchar(36) DEFAULT NULL,
   `instance_uuid` varchar(36) DEFAULT NULL,
   `deleted` int(11) DEFAULT NULL,
   PRIMARY KEY (`id`),
   UNIQUE KEY `address` (`address`),
   KEY `network_id` (`network_id`),
   KEY `virtual_interfaces_instance_uuid_fkey` (`instance_uuid`),
   CONSTRAINT `virtual_interfaces_instance_uuid_fkey` FOREIGN KEY (`instance_uuid`) REFERENCES `instances` (`uuid`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8

  After the 185 upgrade the key still exists. I believe this is because
  it is not a UNIQUE key and utils.drop_unique_constraint fails
  silently. At version 185 virtual_interfaces looks like so:

  CREATE TABLE `virtual_interfaces` (
   `created_at` datetime DEFAULT NULL,
   `updated_at` datetime DEFAULT NULL,
   `deleted_at` datetime DEFAULT NULL,
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `address` varchar(255) DEFAULT NULL,
   `network_id` int(11) DEFAULT NULL,
   `uuid` varchar(36) DEFAULT NULL,
   `instance_uuid` varchar(36) DEFAULT NULL,
   `deleted` int(11) DEFAULT NULL,
   PRIMARY KEY (`id`),
   UNIQUE KEY `address` (`address`),
   UNIQUE KEY `uniq_virtual_interfaces0address` (`address`),
   KEY `network_id` (`network_id`),
   KEY `virtual_interfaces_instance_uuid_fkey` (`instance_uuid`),
   CONSTRAINT `virtual_interfaces_instance_uuid_fkey` FOREIGN KEY (`instance_uuid`) REFERENCES `instances` (`uuid`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8

  So when downgrading 185 the virtual_interfaces_instance_uuid_fkey KEY
  is created again (albeit this time UNIQUE) and fails as a duplicate.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1207344/+subscriptions