libvirt: Decode disk_info before use
The fix for OSSA 2016-007 / CVE-2016-2140 in f302bf04
assumed that
disk_info is always a plain, decoded list. However prior to Liberty
when preforming a live block migration the compute manager populates
disk_info with an encoded JSON string when calling
self.driver.get_instance_disk_info. In the live migration case without
block migration disk_info is None.
As a result we should always decode disk_info when a block migration
is called for to ensure that we can iterate over the disks and rebuild
the disk.info file.
The following change removed the JSON encoding from
get_instance_disk_info and other methods within the libvirt driver for
Liberty.
libvirt: Remove unnecessary JSON conversions
https://review.openstack.org/#/c/177437/6
Closes-Bug: #1558697
Change-Id: Icfe1f23cc3af2d0166dac82109111e341623fc4a
This commit is contained in:
parent
2d7166db25
commit
a0b86d806e
|
@ -6640,7 +6640,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
drvr.pre_live_migration(self.context, instance,
|
||||
block_device_info=None,
|
||||
network_info=[],
|
||||
disk_info=disk_info,
|
||||
disk_info=jsonutils.dumps(disk_info),
|
||||
migrate_data=migrate_data)
|
||||
write_to_file.assert_called_with(disk_info_path,
|
||||
jsonutils.dumps(image_disk_info))
|
||||
|
|
|
@ -5830,7 +5830,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
# contents of each file when using the Raw backend.
|
||||
if disk_info:
|
||||
image_disk_info = {}
|
||||
for info in disk_info:
|
||||
for info in jsonutils.loads(disk_info):
|
||||
image_file = os.path.basename(info['path'])
|
||||
image_path = os.path.join(instance_dir, image_file)
|
||||
image_disk_info[image_path] = info['type']
|
||||
|
|
Loading…
Reference in New Issue