def setup_rt(hostname, virt_resources=_VIRT_DRIVER_AVAIL_RESOURCES, estimate_overhead=overhead_zero):
 sched_client_mock = mock.MagicMock()
 notifier_mock = mock.MagicMock()
 vd = mock.MagicMock()
 virt_resources = copy.deepcopy(virt_resources)
 vd.get_available_resource.return_value = virt_resources
 vd.get_host_ip_addr.return_value = _NODENAME
 vd.estimate_instance_overhead.side_effect = estimate_overhead
 with test.nested(mock.patch('nova.scheduler.client.SchedulerClient', return_value=sched_client_mock), mock.patch('nova.rpc.get_notifier', return_value=notifier_mock)):
  rt = resource_tracker.ResourceTracker(hostname, vd)
 return (rt, sched_client_mock, vd)

def setup_rt ( hostname , virt_resources = _VIRT_DRIVER_AVAIL_RESOURCES , estimate_overhead = overhead_zero ) : sched_client_mock = mock . MagicMock ( ) notifier_mock = mock . MagicMock ( ) vd = mock . MagicMock ( ) virt_resources = copy . deepcopy ( virt_resources ) vd . get_available_resource . return_value = virt_resources vd . get_host_ip_addr . return_value = _NODENAME vd . estimate_instance_overhead . side_effect = estimate_overhead with test . nested ( mock . patch ( 'nova.scheduler.client.SchedulerClient' , return_value = sched_client_mock ) , mock . patch ( 'nova.rpc.get_notifier' , return_value = notifier_mock ) ) : rt = resource_tracker . ResourceTracker ( hostname , vd ) return ( rt , sched_client_mock , vd )
sets up the resource tracker instance with mock fixtures .