Fix "in" comparisons with one element tuples

A single value enclosed in parentheses is not a tuple (it needs a comma
after the element) therefore the comparisons like 'if foo in ("bar")'
are wrong.

Closes-Bug: #1248443
Change-Id: I29a2227c9d83efc17ecfacc86d507d75edd4eaca
This commit is contained in:
Alvaro Lopez Garcia 2013-11-06 09:29:05 +01:00
parent 4a944ab86e
commit 47c95694e9
3 changed files with 4 additions and 4 deletions

View File

@ -91,7 +91,7 @@ class FakeVirtAPITest(VirtAPIBaseTest):
else:
e_args = args
if method in ('block_device_mapping_get_all_by_instance'):
if method == 'block_device_mapping_get_all_by_instance':
e_kwargs = {}
else:
e_kwargs = kwargs

View File

@ -2594,7 +2594,7 @@ class LibvirtDriver(driver.ComputeDriver):
# In managed mode, the configured device will be automatically
# detached from the host OS drivers when the guest is started,
# and then re-attached when the guest shuts down.
if CONF.libvirt.virt_type not in ('xen'):
if CONF.libvirt.virt_type != 'xen':
# we do manual detach only for xen
return
try:
@ -2946,7 +2946,7 @@ class LibvirtDriver(driver.ComputeDriver):
dev.domain, dev.bus, dev.slot, dev.function = dbsf
# only kvm support managed mode
if CONF.libvirt.virt_type in ('xen'):
if CONF.libvirt.virt_type in ('xen',):
dev.managed = 'no'
if CONF.libvirt.virt_type in ('kvm', 'qemu'):
dev.managed = 'yes'

View File

@ -539,7 +539,7 @@ class SessionBase(object):
_db_content['SR'][sr_ref]['uuid'] = sr_uuid
_db_content['SR'][sr_ref]['forgotten'] = 0
vdi_per_lun = False
if type in ('iscsi'):
if type == 'iscsi':
# Just to be clear
vdi_per_lun = True
if vdi_per_lun: