Merge "fix rebuild sha1 not string error"
This commit is contained in:
commit
1778c61555
nova
@ -942,7 +942,10 @@ class LibvirtConnTestCase(test.TestCase):
|
||||
# create_fake_libvirt_mock() mocks utils.import_class().
|
||||
network_info = _fake_network_info(self.stubs, 1)
|
||||
self.create_fake_libvirt_mock()
|
||||
instance = db.instance_create(self.context, self.test_instance)
|
||||
|
||||
instance_ref = self.test_instance
|
||||
instance_ref['image_ref'] = 123456 # we send an int to test sha1 call
|
||||
instance = db.instance_create(self.context, instance_ref)
|
||||
|
||||
# Start test
|
||||
self.mox.ReplayAll()
|
||||
@ -957,6 +960,9 @@ class LibvirtConnTestCase(test.TestCase):
|
||||
try:
|
||||
conn.spawn(self.context, instance, None, network_info)
|
||||
except Exception, e:
|
||||
# assert that no exception is raised due to sha1 receiving an int
|
||||
self.assertEqual(-1, str(e.message).find('must be string or buffer'
|
||||
', not int'))
|
||||
count = (0 <= str(e.message).find('Unexpected method call'))
|
||||
|
||||
shutil.rmtree(os.path.join(FLAGS.instances_path, instance.name))
|
||||
|
@ -896,7 +896,7 @@ class LibvirtConnection(driver.ComputeDriver):
|
||||
user_id=inst['user_id'],
|
||||
project_id=inst['project_id'])
|
||||
|
||||
root_fname = hashlib.sha1(disk_images['image_id']).hexdigest()
|
||||
root_fname = hashlib.sha1(str(disk_images['image_id'])).hexdigest()
|
||||
size = FLAGS.minimum_root_size
|
||||
|
||||
inst_type_id = inst['instance_type_id']
|
||||
|
Loading…
x
Reference in New Issue
Block a user