Fix resource leaking when consume_from_instance raise exception
When we boot instance with force host, and the instance
request some pci devices, all the scheduler filters
would been ignored, include: PciPassthroughFilter.
So if the specified host can't apply the pci request,
PciDeviceRequestFailed exception would been raised
from HostState.consume_from_instance, at this time
the part of compute resource had been updated,
e.g. vcpus, ram, disk and so on, we should make
the resource of HostState having chance to been reverted
in order to avoid resource leaking.
When the exception is raised from self.pci_stats.apply_requests(),
catch it and don't set the update field of HostState,
HostState will be synced with db in next scheduling,
the resource is reverted at that time.
Reviewed: https:/ /review. openstack. org/182165 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=26a4f430d1e c45f7b9a61b69f0 09a705d2d3cd52
Committed: https:/
Submitter: Jenkins
Branch: master
commit 26a4f430d1ec45f 7b9a61b69f009a7 05d2d3cd52
Author: Rui Chen <email address hidden>
Date: Mon May 11 17:45:04 2015 +0800
Fix resource leaking when consume_ from_instance raise exception
When we boot instance with force host, and the instance ilter. questFailed exception would been raised consume_ from_instance, at this time
request some pci devices, all the scheduler filters
would been ignored, include: PciPassthroughF
So if the specified host can't apply the pci request,
PciDeviceRe
from HostState.
the part of compute resource had been updated,
e.g. vcpus, ram, disk and so on, we should make
the resource of HostState having chance to been reverted
in order to avoid resource leaking.
When the exception is raised from self.pci_ stats.apply_ requests( ),
catch it and don't set the update field of HostState,
HostState will be synced with db in next scheduling,
the resource is reverted at that time.
Change-Id: I0a87088d56337b cd180606013a547 3fa2ec6c608
Related-Bug: #1391816
Closes-Bug: #1482019