Check for allocated or claimed PCI status in DB
Due to the periodic update of the PCI status there is a potential when checking the pci device status after a live-migration it may still be claimed instead of allocated. Updated the DB query based on if sr-iov hotplugging is enabled to check for either allocated or claimed. Change-Id: I73c6114a67039947d30f11cb6fb3abbbdbce19ca
This commit is contained in:
parent
4b48bd2b41
commit
d8dde5e6d1
@ -452,7 +452,7 @@ class SRIOVMigration(SRIOVBase):
|
|||||||
db = CONF.whitebox_database.nova_cell1_db_name
|
db = CONF.whitebox_database.nova_cell1_db_name
|
||||||
with db_client.cursor(db) as cursor:
|
with db_client.cursor(db) as cursor:
|
||||||
cursor.execute('select COUNT(*) from pci_devices WHERE '
|
cursor.execute('select COUNT(*) from pci_devices WHERE '
|
||||||
'status = "%s"' % status)
|
'status REGEXP "%s"' % status)
|
||||||
data = cursor.fetchall()
|
data = cursor.fetchall()
|
||||||
return data[0]['COUNT(*)']
|
return data[0]['COUNT(*)']
|
||||||
|
|
||||||
@ -461,6 +461,11 @@ class SRIOVMigration(SRIOVBase):
|
|||||||
|
|
||||||
:param vnic_type: str, vnic_type to use when creating sr-iov port
|
:param vnic_type: str, vnic_type to use when creating sr-iov port
|
||||||
"""
|
"""
|
||||||
|
if CONF.compute_feature_enabled.sriov_hotplug:
|
||||||
|
pci_device_status_regex = 'allocated'
|
||||||
|
else:
|
||||||
|
pci_device_status_regex = 'allocated|claimed'
|
||||||
|
|
||||||
net_vlan = \
|
net_vlan = \
|
||||||
CONF.network_feature_enabled.provider_net_base_segmentation_id
|
CONF.network_feature_enabled.provider_net_base_segmentation_id
|
||||||
flavor = self.create_flavor()
|
flavor = self.create_flavor()
|
||||||
@ -499,7 +504,8 @@ class SRIOVMigration(SRIOVBase):
|
|||||||
|
|
||||||
# Validate the total allocation of pci devices is one and only one
|
# Validate the total allocation of pci devices is one and only one
|
||||||
# after instance migration
|
# after instance migration
|
||||||
pci_allocated_count = self._get_pci_status_count('allocated')
|
pci_allocated_count = self._get_pci_status_count(
|
||||||
|
pci_device_status_regex)
|
||||||
self.assertEqual(pci_allocated_count, 1, 'Total allocated pci devices '
|
self.assertEqual(pci_allocated_count, 1, 'Total allocated pci devices '
|
||||||
'after first migration should be 1 but instead '
|
'after first migration should be 1 but instead '
|
||||||
'is %s' % pci_allocated_count)
|
'is %s' % pci_allocated_count)
|
||||||
@ -527,7 +533,8 @@ class SRIOVMigration(SRIOVBase):
|
|||||||
|
|
||||||
# Confirm total port allocations still remains one after final
|
# Confirm total port allocations still remains one after final
|
||||||
# migration
|
# migration
|
||||||
pci_allocated_count = self._get_pci_status_count('allocated')
|
pci_allocated_count = self._get_pci_status_count(
|
||||||
|
pci_device_status_regex)
|
||||||
self.assertEqual(pci_allocated_count, 1, 'Total allocated pci devices '
|
self.assertEqual(pci_allocated_count, 1, 'Total allocated pci devices '
|
||||||
'after second migration should be 1 but instead '
|
'after second migration should be 1 but instead '
|
||||||
'is %s' % pci_allocated_count)
|
'is %s' % pci_allocated_count)
|
||||||
|
@ -259,5 +259,8 @@ compute_features_group_opts = [
|
|||||||
help="If false, skip virtio rng tests"),
|
help="If false, skip virtio rng tests"),
|
||||||
cfg.BoolOpt('rbd_download',
|
cfg.BoolOpt('rbd_download',
|
||||||
default=False,
|
default=False,
|
||||||
help="If false, skip rbd direct download tests")
|
help="If false, skip rbd direct download tests"),
|
||||||
|
cfg.BoolOpt('sriov_hotplug',
|
||||||
|
default=True,
|
||||||
|
help="Sriov hotplugging is supported in the deployment")
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user