Refix disk size during live migration with disk over-commit

Currently available disk of targer host is calculated based on
local_gb, not available disk(free_disk_gb). This check can be
negative if the target host has no free disk.

Change-Id: Iec50269ef31dfe090f0cd4db95a37909661bd910
closes-bug: 1744079
This commit is contained in:
int32bit 2018-01-22 20:15:21 +08:00
parent 38eb95384f
commit e2cc275063
2 changed files with 3 additions and 3 deletions

View File

@ -7749,7 +7749,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
instance_ref.vcpu_model = test_vcpu_model.fake_vcpumodel
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
compute_info = {'disk_available_least': -1000,
'local_gb': 100,
'free_disk_gb': 50,
'cpu_info': 'asdf',
}
filename = "file"
@ -7766,7 +7766,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
return_value.is_volume_backed = False
self.assertThat({"filename": "file",
'image_type': 'default',
'disk_available_mb': 102400,
'disk_available_mb': 51200,
"disk_over_commit": True,
"block_migration": True,
"is_volume_backed": False},

View File

@ -6327,7 +6327,7 @@ class LibvirtDriver(driver.ComputeDriver):
:returns: a LibvirtLiveMigrateData object
"""
if disk_over_commit:
disk_available_gb = dst_compute_info['local_gb']
disk_available_gb = dst_compute_info['free_disk_gb']
else:
disk_available_gb = dst_compute_info['disk_available_least']
disk_available_mb = (