Fixes LP688545
This commit is contained in:
parent
40de3b9ffb
commit
6a8f011789
@ -327,6 +327,7 @@ class ComputeManager(manager.Manager):
|
||||
instance_ref["internal_id"])
|
||||
return self.driver.get_diagnostics(instance_ref)
|
||||
|
||||
@exception.wrap_exception
|
||||
def suspend_instance(self, context, instance_id):
|
||||
"""suspend the instance with instance_id"""
|
||||
context = context.elevated()
|
||||
|
@ -19,6 +19,25 @@
|
||||
"""
|
||||
SQLAlchemy database backend
|
||||
"""
|
||||
import logging
|
||||
import time
|
||||
|
||||
from sqlalchemy.exc import OperationalError
|
||||
|
||||
from nova import flags
|
||||
from nova.db.sqlalchemy import models
|
||||
|
||||
models.register_models()
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
|
||||
|
||||
for i in xrange(FLAGS.sql_max_retries):
|
||||
if i > 0:
|
||||
time.sleep(FLAGS.sql_retry_interval)
|
||||
|
||||
try:
|
||||
models.register_models()
|
||||
break
|
||||
except OperationalError:
|
||||
logging.exception(_("Data store is unreachable."
|
||||
" Trying again in %d seconds.") % FLAGS.sql_retry_interval)
|
||||
|
@ -266,6 +266,8 @@ DEFINE_string('sql_connection',
|
||||
DEFINE_string('sql_idle_timeout',
|
||||
'3600',
|
||||
'timeout for idle sql database connections')
|
||||
DEFINE_integer('sql_max_retries', 12, 'sql connection attempts')
|
||||
DEFINE_integer('sql_retry_interval', 10, 'sql connection retry interval')
|
||||
|
||||
DEFINE_string('compute_manager', 'nova.compute.manager.ComputeManager',
|
||||
'Manager for compute')
|
||||
|
@ -250,15 +250,16 @@ class XenAPIVMTestCase(test.TestCase):
|
||||
|
||||
def _create_instance(self):
|
||||
"""Creates and spawns a test instance"""
|
||||
values = {'name': 1, 'id': 1,
|
||||
'project_id': self.project.id,
|
||||
'user_id': self.user.id,
|
||||
'image_id': 1,
|
||||
'kernel_id': 2,
|
||||
'ramdisk_id': 3,
|
||||
'instance_type': 'm1.large',
|
||||
'mac_address': 'aa:bb:cc:dd:ee:ff'
|
||||
}
|
||||
values = {
|
||||
'name': 1,
|
||||
'id': 1,
|
||||
'project_id': self.project.id,
|
||||
'user_id': self.user.id,
|
||||
'image_id': 1,
|
||||
'kernel_id': 2,
|
||||
'ramdisk_id': 3,
|
||||
'instance_type': 'm1.large',
|
||||
'mac_address': 'aa:bb:cc:dd:ee:ff'}
|
||||
instance = db.instance_create(values)
|
||||
self.conn.spawn(instance)
|
||||
return instance
|
||||
|
Loading…
Reference in New Issue
Block a user