Fix incorrect numeric comparisons
In a few places, we're using "is" or "is not", when comparing numeric variables. This is incorrect and will give unexpected results when the types do not match (for example, if one of the variables is a long int): http://paste.openstack.org/raw/730618/ This change fixes those comparisons. Closes-Bug: #1794068 Change-Id: Ibf28778879050cfdfa82ef4f9b587170dde6203f
This commit is contained in:
parent
c29ff8bf92
commit
1f8200ef79
|
@ -78,7 +78,7 @@ class MetricsUtils(baseutils.BaseUtilsVirt):
|
|||
disks = self._get_vm_resources(vm_name,
|
||||
self._STORAGE_ALLOC_SETTING_DATA_CLASS)
|
||||
filtered_disks = [d for d in disks if
|
||||
d.ResourceSubType is not self._DVD_DISK_RES_SUB_TYPE]
|
||||
d.ResourceSubType != self._DVD_DISK_RES_SUB_TYPE]
|
||||
|
||||
# enable metrics for disk.
|
||||
for disk in filtered_disks:
|
||||
|
|
|
@ -768,7 +768,7 @@ class NetworkUtils(baseutils.BaseUtilsVirt):
|
|||
raise exceptions.HyperVException(_('Cannot get VM summary data '
|
||||
'for: %s') % port.ElementName)
|
||||
|
||||
return summary_info[0].EnabledState is self._HYPERV_VM_STATE_ENABLED
|
||||
return summary_info[0].EnabledState == self._HYPERV_VM_STATE_ENABLED
|
||||
|
||||
def create_security_rules(self, switch_port_name, sg_rules):
|
||||
port = self._get_switch_port_allocation(switch_port_name)[0]
|
||||
|
@ -800,7 +800,7 @@ class NetworkUtils(baseutils.BaseUtilsVirt):
|
|||
self._conn, self._PORT_EXT_ACL_SET_DATA,
|
||||
element_instance_id=port.InstanceID)
|
||||
filtered_acls = [a for a in acls if
|
||||
a.Action is not self._ACL_ACTION_METER]
|
||||
a.Action != self._ACL_ACTION_METER]
|
||||
|
||||
if filtered_acls:
|
||||
self._jobutils.remove_multiple_virt_features(filtered_acls)
|
||||
|
|
Loading…
Reference in New Issue