Advertisement
Guest User

Untitled

a guest
Apr 20th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.45 KB | None | 0 0
  1. diff --git a/nova/cmd/manage.py b/nova/cmd/manage.py
  2. index 4c0d186..b839e77 100644
  3. --- a/nova/cmd/manage.py
  4. +++ b/nova/cmd/manage.py
  5. @@ -720,50 +720,51 @@ class DbCommands(object):
  6.                              "from table '%(table_name)s'.") %
  7.                            {'records': records, 'table_name': table_name})
  8.                  else:
  9.                      print(_("There are %(records)d records in the "
  10.                              "'%(table_name)s' table where the uuid or "
  11.                              "instance_uuid column is NULL. Run this "
  12.                              "command again with the --delete option after you "
  13.                              "have backed up any necessary data.") %
  14.                            {'records': records, 'table_name': table_name})
  15.          # check to see if we didn't find anything
  16.          if not records_found:
  17.              print(_('There were no records found where '
  18.                      'instance_uuid was NULL.'))
  19.  
  20.      def _run_migration(self, ctxt, max_count):
  21.          ran = 0
  22.          migrations = {}
  23.          for migration_meth in self.online_migrations:
  24.              count = max_count - ran
  25.              try:
  26.                  found, done = migration_meth(ctxt, count)
  27.              except Exception:
  28.                  print(_("Error attempting to run %(method)s") % dict(
  29.                        method=migration_meth))
  30.                  found = done = 0
  31. +                raise
  32.  
  33.              name = migration_meth.__name__
  34.              if found:
  35.                  print(_('%(total)i rows matched query %(meth)s, %(done)i '
  36.                          'migrated') % {'total': found,
  37.                                         'meth': name,
  38.                                         'done': done})
  39.              migrations.setdefault(name, (0, 0))
  40.              migrations[name] = (migrations[name][0] + found,
  41.                                  migrations[name][1] + done)
  42.              if max_count is not None:
  43.                  ran += done
  44.                  if ran >= max_count:
  45.                      break
  46.          return migrations
  47.  
  48.      @args('--max-count', metavar='<number>', dest='max_count',
  49.            help='Maximum number of objects to consider')
  50.      def online_data_migrations(self, max_count=None):
  51.          ctxt = context.get_admin_context()
  52.          if max_count is not None:
  53.              try:
  54.                  max_count = int(max_count)
  55.              except ValueError:
  56.                  max_count = -1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement