コード例 #1
0
    def revert_resize(self, context, instance_id):
        """Reverts a resize, deleting the 'new' instance in the process."""
        context = context.elevated()
        migration_ref = self.db.migration_get_by_instance_and_status(
            context, instance_id, 'finished')
        if not migration_ref:
            raise exception.MigrationNotFoundByStatus(instance_id=instance_id,
                                                      status='finished')

        params = {'migration_id': migration_ref['id']}
        self._cast_compute_message('revert_resize',
                                   context,
                                   instance_id,
                                   migration_ref['dest_compute'],
                                   params=params)
        self.db.migration_update(context, migration_ref['id'],
                                 {'status': 'reverted'})
コード例 #2
0
    def confirm_resize(self, context, instance_id):
        """Confirms a migration/resize and deletes the 'old' instance."""
        context = context.elevated()
        migration_ref = self.db.migration_get_by_instance_and_status(
            context, instance_id, 'finished')
        if not migration_ref:
            raise exception.MigrationNotFoundByStatus(instance_id=instance_id,
                                                      status='finished')
        instance_ref = self.db.instance_get(context, instance_id)
        params = {'migration_id': migration_ref['id']}
        self._cast_compute_message('confirm_resize',
                                   context,
                                   instance_id,
                                   migration_ref['source_compute'],
                                   params=params)

        self.db.migration_update(context, migration_ref['id'],
                                 {'status': 'confirmed'})
        self.db.instance_update(context, instance_id, {
            'host': migration_ref['dest_compute'],
        })
コード例 #3
0
 def test_force_complete_migration_not_found(self):
     self._test_force_complete_failed_with_exception(
         exception.MigrationNotFoundByStatus(instance_id='', status=''),
         webob.exc.HTTPBadRequest)
コード例 #4
0
 def revert_resize_mock(*args):
     raise exception.MigrationNotFoundByStatus(instance_id=1,
                                               status='finished')