def test_check_requested_destination(self):
    self.mox.StubOutWithMock(db, 'service_get_by_compute_host')
    self.mox.StubOutWithMock(self.task, '_get_compute_info')
    self.mox.StubOutWithMock(self.task.servicegroup_api, 'service_is_up')
    self.mox.StubOutWithMock(self.task.compute_rpcapi, 'check_can_live_migrate_destination')
    db.service_get_by_compute_host(self.context, self.destination).AndReturn('service')
    self.task.servicegroup_api.service_is_up('service').AndReturn(True)
    hypervisor_details = {'hypervisor_type': 'a', 'hypervisor_version': 6.1, 'free_ram_mb': 513}
    self.task._get_compute_info(self.destination).AndReturn(hypervisor_details)
    self.task._get_compute_info(self.instance_host).AndReturn(hypervisor_details)
    self.task._get_compute_info(self.destination).AndReturn(hypervisor_details)
    self.task.compute_rpcapi.check_can_live_migrate_destination(self.context, self.instance, self.destination, self.block_migration, self.disk_over_commit).AndReturn('migrate_data')
    self.mox.ReplayAll()
    self.task._check_requested_destination()
    self.assertEqual('migrate_data', self.task.migrate_data)
def test_check_requested_destination(self):
    self.mox.StubOutWithMock(db, 'service_get_by_compute_host')
    self.mox.StubOutWithMock(self.task, '_get_compute_info')
    self.mox.StubOutWithMock(self.task.servicegroup_api, 'service_is_up')
    self.mox.StubOutWithMock(self.task.compute_rpcapi, 'check_can_live_migrate_destination')
    db.service_get_by_compute_host(self.context, self.destination).AndReturn('service')
    self.task.servicegroup_api.service_is_up('service').AndReturn(True)
    hypervisor_details = {'hypervisor_type': 'a', 'hypervisor_version': 6.1, 'free_ram_mb': 513}
    self.task._get_compute_info(self.destination).AndReturn(hypervisor_details)
    self.task._get_compute_info(self.instance_host).AndReturn(hypervisor_details)
    self.task._get_compute_info(self.destination).AndReturn(hypervisor_details)
    self.task.compute_rpcapi.check_can_live_migrate_destination(self.context, self.instance, self.destination, self.block_migration, self.disk_over_commit).AndReturn('migrate_data')
    self.mox.ReplayAll()
    self.task._check_requested_destination()
    self.assertEqual('migrate_data', self.task.migrate_data)