def migrate_instance_groups_to_api_db(context, count):
    main_groups = _get_main_instance_groups(context, count)
    done = 0
    for db_group in main_groups:
        group = objects.InstanceGroup(context=context,
                                      user_id=db_group.user_id,
                                      project_id=db_group.project_id,
                                      uuid=db_group.uuid,
                                      name=db_group.name,
                                      policies=db_group.policies,
                                      members=db_group.members)
        try:
            group._create(skipcheck=True)
        except exception.InstanceGroupIdExists:
            # NOTE(melwitt): This might happen if there's a failure right after
            # the InstanceGroup was created and the migration is re-run.
            pass
        db_api.instance_group_delete(context, db_group.uuid)
        done += 1
    return len(main_groups), done
Exemple #2
0
def migrate_instance_groups_to_api_db(context, count):
    main_groups = _get_main_instance_groups(context, count)
    done = 0
    for db_group in main_groups:
        group = objects.InstanceGroup(context=context,
                                      user_id=db_group.user_id,
                                      project_id=db_group.project_id,
                                      uuid=db_group.uuid,
                                      name=db_group.name,
                                      policies=db_group.policies,
                                      members=db_group.members)
        try:
            group._create(skipcheck=True)
        except exception.InstanceGroupIdExists:
            # NOTE(melwitt): This might happen if there's a failure right after
            # the InstanceGroup was created and the migration is re-run.
            pass
        db_api.instance_group_delete(context, db_group.uuid)
        done += 1
    return len(main_groups), done
Exemple #3
0
 def test_upgrade_with_deleted_instance_groups(self):
     group = db_api.instance_group_create(self.context, self.ig_values)
     db_api.instance_group_delete(self.context, group['uuid'])
     self.migration.upgrade(self.engine)
 def test_upgrade_with_deleted_instance_groups(self):
     group = db_api.instance_group_create(self.context, self.ig_values)
     db_api.instance_group_delete(self.context, group['uuid'])
     self.migration.upgrade(self.engine)