"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "nova/pci/stats.py" between
nova-22.0.0.tar.gz and nova-22.0.1.tar.gz

About: OpenStack Nova (Core Service: Compute) manages the lifecycle of compute instances in an OpenStack environment. Responsibilities include spawning, scheduling and decomissioning of machines on demand.
The "Victoria" series (latest release).

stats.py  (nova-22.0.0):stats.py  (nova-22.0.1)
skipping to change at line 105 skipping to change at line 105
# NOTE(gibi): parent_ifname acts like a tag during pci claim but # NOTE(gibi): parent_ifname acts like a tag during pci claim but
# not provided as part of the whitelist spec as it is auto detected # not provided as part of the whitelist spec as it is auto detected
# by the virt driver. # by the virt driver.
# This key is used for match InstancePciRequest backed by neutron ports # This key is used for match InstancePciRequest backed by neutron ports
# that has resource_request and therefore that has resource allocation # that has resource_request and therefore that has resource allocation
# already in placement. # already in placement.
if dev.extra_info.get('parent_ifname'): if dev.extra_info.get('parent_ifname'):
pool['parent_ifname'] = dev.extra_info['parent_ifname'] pool['parent_ifname'] = dev.extra_info['parent_ifname']
return pool return pool
def _get_pool_with_device_type_mismatch(self, dev):
"""Check for device type mismatch in the pools for a given device.
Return (pool, device) if device type does not match or a single None
if the device type matches.
"""
for pool in self.pools:
for device in pool['devices']:
if device.address == dev.address:
if dev.dev_type != pool["dev_type"]:
return pool, device
return None
return None
def update_device(self, dev):
"""Update a device to its matching pool."""
pool_device_info = self._get_pool_with_device_type_mismatch(dev)
if pool_device_info is None:
return
pool, device = pool_device_info
pool['devices'].remove(device)
self._decrease_pool_count(self.pools, pool)
self.add_device(dev)
def add_device(self, dev): def add_device(self, dev):
"""Add a device to its matching pool.""" """Add a device to its matching pool."""
dev_pool = self._create_pool_keys_from_dev(dev) dev_pool = self._create_pool_keys_from_dev(dev)
if dev_pool: if dev_pool:
pool = self._find_pool(dev_pool) pool = self._find_pool(dev_pool)
if not pool: if not pool:
dev_pool['count'] = 0 dev_pool['count'] = 0
dev_pool['devices'] = [] dev_pool['devices'] = []
self.pools.append(dev_pool) self.pools.append(dev_pool)
self.pools.sort(key=lambda item: len(item)) self.pools.sort(key=lambda item: len(item))
 End of changes. 1 change blocks. 
0 lines changed or deleted 26 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)