def cpu_affinity_by_task(pid, vcpu_pid):
 cmd = ("cat /proc/%s/task/%s/status|grep Cpus_allowed:| awk '{print $2}'" % (pid, vcpu_pid))
 output = system_output(cmd, ignore_status=False)
 return output

def cpu_affinity_by_task ( pid , vcpu_pid ) : cmd = ( "cat /proc/%s/task/%s/status|grep Cpus_allowed:| awk '{print $2}'" % ( pid , vcpu_pid ) ) output = system_output ( cmd , ignore_status = False ) return output
this function returns the allowed cpus from the proc entry for each vcpus through its task id for a pid .