'Regression test for bug #1548980.
Before fixing this bug, listing deleted instances returned a 404
because lazy-loading services from a deleted instance failed. Now
we should be able to list the deleted instance and the host_state
attribute should be "".'

def test_list_deleted_instances(self):

    server = dict(name='server1', imageRef=self.image_id, flavorRef=self.flavor_id)
    server = self.api.post_server({'server': server})
    self.api.delete_server(server['id'])
    for x in range(30):
        try:
            self.api.get_server(server['id'])
            time.sleep(1)
        except client.OpenStackApiNotFoundException:
            break
    else:
        self.fail(('Timed    out    waiting    to    delete    server:    %s' % server['id']))
    servers = self.admin_api.get_servers(search_opts={'deleted': 1})
    self.assertEqual(1, len(servers))
    self.assertEqual(server['id'], servers[0]['id'])
    self.assertEqual(0, len(servers[0]['host_status']))
