def listen_vcpu(self, vcpu_io, queue):
"""Listen to an individual virtual CPU"""
logging.info('Start listening on VCPU %s', vcpu_io.vcpu_nb)
# we need a per thread continue event
continue_event = threading.Event()
while not self.stop_request.is_set():
try:
nitro_raw_ev = vcpu_io.get_event()
except ValueError as e:
if not self.vm_io.syscall_filters:
# if there are no filters, get_event should not timeout
# since we capture all system calls
# so log the error
logging.debug(str(e))
else:
e = NitroEvent(nitro_raw_ev, vcpu_io)
# put the event in the queue
# and wait for the event to be processed,
# when the main thread will set the continue_event
item = (e, continue_event)
queue.put(item)
continue_event.wait()
# reset continue_event
continue_event.clear()
vcpu_io.continue_vm()
logging.debug('stop listening on VCPU %s', vcpu_io.vcpu_nb)
评论列表
文章目录