libvirt: drop MIN_QEMU_DISCARD_VERSION
We now require a minimum QEMU version (2.1.0) that is high enough such that we can drop this compatibility code. Change-Id: If07c6f242f6b7ad50f51587bbbdb480153a77694
This commit is contained in:
parent
f59f83f10d
commit
8e479d3022
|
@ -290,22 +290,3 @@ class LibvirtVolumeTestCase(LibvirtISCSIVolumeBaseTestCase):
|
||||||
conf = libvirt_driver.get_config(connection_info, self.disk_info)
|
conf = libvirt_driver.get_config(connection_info, self.disk_info)
|
||||||
tree = conf.format_dom()
|
tree = conf.format_dom()
|
||||||
self.assertIsNone(tree.find("driver[@discard]"))
|
self.assertIsNone(tree.find("driver[@discard]"))
|
||||||
|
|
||||||
@mock.patch('nova.virt.libvirt.host.Host.has_min_version')
|
|
||||||
def test_libvirt_volume_driver_discard_true_bad_version(
|
|
||||||
self, mock_has_min_version):
|
|
||||||
# Check the discard attrib is not present in driver section
|
|
||||||
mock_has_min_version.return_value = False
|
|
||||||
libvirt_driver = volume.LibvirtVolumeDriver(self.fake_host)
|
|
||||||
connection_info = {
|
|
||||||
'driver_volume_type': 'fake',
|
|
||||||
'data': {
|
|
||||||
'device_path': '/foo',
|
|
||||||
'discard': True,
|
|
||||||
},
|
|
||||||
'serial': 'fake_serial',
|
|
||||||
}
|
|
||||||
|
|
||||||
conf = libvirt_driver.get_config(connection_info, self.disk_info)
|
|
||||||
tree = conf.format_dom()
|
|
||||||
self.assertIsNone(tree.find("driver[@discard]"))
|
|
||||||
|
|
|
@ -212,8 +212,6 @@ NEXT_MIN_QEMU_VERSION = (2, 5, 0)
|
||||||
# Libvirt version 1.2.17 is required for successful block live migration
|
# Libvirt version 1.2.17 is required for successful block live migration
|
||||||
# of vm booted from image with attached devices
|
# of vm booted from image with attached devices
|
||||||
MIN_LIBVIRT_BLOCK_LM_WITH_VOLUMES_VERSION = (1, 2, 17)
|
MIN_LIBVIRT_BLOCK_LM_WITH_VOLUMES_VERSION = (1, 2, 17)
|
||||||
# libvirt discard feature
|
|
||||||
MIN_QEMU_DISCARD_VERSION = (1, 6, 0)
|
|
||||||
# While earlier versions could support NUMA reporting and
|
# While earlier versions could support NUMA reporting and
|
||||||
# NUMA placement, not until 1.2.7 was there the ability
|
# NUMA placement, not until 1.2.7 was there the ability
|
||||||
# to pin guest nodes to host nodes, so mandate that. Without
|
# to pin guest nodes to host nodes, so mandate that. Without
|
||||||
|
@ -3471,14 +3469,6 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||||
|
|
||||||
def _get_guest_disk_config(self, instance, name, disk_mapping, inst_type,
|
def _get_guest_disk_config(self, instance, name, disk_mapping, inst_type,
|
||||||
image_type=None):
|
image_type=None):
|
||||||
if CONF.libvirt.hw_disk_discard:
|
|
||||||
if not self._host.has_min_version(hv_ver=MIN_QEMU_DISCARD_VERSION,
|
|
||||||
hv_type=host.HV_DRIVER_QEMU):
|
|
||||||
msg = (_('Volume sets discard option, qemu %(qemu)s'
|
|
||||||
' or later is required.') %
|
|
||||||
{'qemu': MIN_QEMU_DISCARD_VERSION})
|
|
||||||
raise exception.Invalid(msg)
|
|
||||||
|
|
||||||
disk = self.image_backend.by_name(instance, name, image_type)
|
disk = self.image_backend.by_name(instance, name, image_type)
|
||||||
if (name == 'disk.config' and image_type == 'rbd' and
|
if (name == 'disk.config' and image_type == 'rbd' and
|
||||||
not disk.exists()):
|
not disk.exists()):
|
||||||
|
|
|
@ -26,15 +26,12 @@ from nova.i18n import _LW
|
||||||
from nova import profiler
|
from nova import profiler
|
||||||
from nova.virt.libvirt import config as vconfig
|
from nova.virt.libvirt import config as vconfig
|
||||||
import nova.virt.libvirt.driver
|
import nova.virt.libvirt.driver
|
||||||
from nova.virt.libvirt import host
|
|
||||||
from nova.virt.libvirt import utils as libvirt_utils
|
from nova.virt.libvirt import utils as libvirt_utils
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
CONF = nova.conf.CONF
|
CONF = nova.conf.CONF
|
||||||
|
|
||||||
SHOULD_LOG_DISCARD_WARNING = True
|
|
||||||
|
|
||||||
|
|
||||||
@profiler.trace_cls("volume_api")
|
@profiler.trace_cls("volume_api")
|
||||||
class LibvirtBaseVolumeDriver(object):
|
class LibvirtBaseVolumeDriver(object):
|
||||||
|
@ -96,23 +93,7 @@ class LibvirtBaseVolumeDriver(object):
|
||||||
|
|
||||||
# Configure usage of discard
|
# Configure usage of discard
|
||||||
if data.get('discard', False) is True:
|
if data.get('discard', False) is True:
|
||||||
min_qemu = nova.virt.libvirt.driver.MIN_QEMU_DISCARD_VERSION
|
conf.driver_discard = 'unmap'
|
||||||
if self.host.has_min_version(
|
|
||||||
hv_ver=min_qemu,
|
|
||||||
hv_type=host.HV_DRIVER_QEMU):
|
|
||||||
conf.driver_discard = 'unmap'
|
|
||||||
else:
|
|
||||||
global SHOULD_LOG_DISCARD_WARNING
|
|
||||||
if SHOULD_LOG_DISCARD_WARNING:
|
|
||||||
SHOULD_LOG_DISCARD_WARNING = False
|
|
||||||
LOG.warning(_LW('Unable to attach %(type)s volume '
|
|
||||||
'%(serial)s with discard enabled: qemu '
|
|
||||||
'%(qemu)s or later is required.'),
|
|
||||||
{
|
|
||||||
'qemu': min_qemu,
|
|
||||||
'serial': conf.serial,
|
|
||||||
'type': connection_info['driver_volume_type']
|
|
||||||
})
|
|
||||||
|
|
||||||
return conf
|
return conf
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue