Hi,
when I do a pdb inside a filter in scheduler, it is dropping inside the pdb shell. So far so good.
But when I execute these statements inside it as shown below, the buildrequest function get_by_instance_uuid is failing to return any db object:
----------
class ComputeFilter(filters.BaseHostFilter):
"""Filter on active Compute nodes."""
RUN_ON_REBUILD = False
def __init__(self):
self.servicegroup_api = servicegroup.API()
# Host state does not change within a request
run_filter_once_per_request = True
def host_passes(self, host_state, spec_obj):
"""Returns True for only active compute nodes."""
breakpoint(). <--------------
service = host_state.service
if service['disabled']:
LOG.debug("%(host_state)s is disabled, reason: %(reason)s",
{'host_state': host_state,
'reason': service.get('disabled_reason')})
return False
else:
if not self.servicegroup_api.service_is_up(service):
LOG.warning("%(host_state)s has not been heard from in a "
"while", {'host_state': host_state})
return False
return True
-----
at the above breakpoint, it is dropping into the pdb shell.
(pdb) from nova import objects as object
(pdb) object.BuildRequest.get_by_instance_uuid(spec_obj._context, instance_uuid=spec_obj.instance_uuid))
Build request not found for instance ....
----
But if I place the above buildrequest inside the above same filter and run it normally without breakpoint(), it is working fine. So, why am I not able to do it manually while in pdb, and succeed when done normally ?