def _get_cpu_thread_policy_constraints(flavor, image_meta):
 (flavor_policy, image_policy) = _get_flavor_image_meta('cpu_thread_policy', flavor, image_meta)
 if (flavor_policy in [None, fields.CPUThreadAllocationPolicy.PREFER]):
  policy = (flavor_policy or image_policy)
 elif (image_policy and (image_policy != flavor_policy)):
  raise exception.ImageCPUThreadPolicyForbidden()
 else:
  policy = flavor_policy
 return policy

def _get_cpu_thread_policy_constraints ( flavor , image_meta ) : ( flavor_policy , image_policy ) = _get_flavor_image_meta ( 'cpu_thread_policy' , flavor , image_meta ) if ( flavor_policy in [ None , fields . CPUThreadAllocationPolicy . PREFER ] ) : policy = ( flavor_policy or image_policy ) elif ( image_policy and ( image_policy != flavor_policy ) ) : raise exception . ImageCPUThreadPolicyForbidden ( ) else : policy = flavor_policy return policy
validate and return the requested cpu thread policy .