'Return connection info for a vnc console.'

def get_vnc_console(self, instance):

    if (instance.vm_state == vm_states.RESCUED):
        name = ('%s-rescue' % instance.name)
        vm_ref = vm_utils.lookup(self._session, name)
        if (vm_ref is None):
            raise exception.InstanceNotReady(instance_id=instance.uuid)
    else:
        vm_ref = vm_utils.lookup(self._session, instance.name)
        if (vm_ref is None):
            raise exception.InstanceNotFound(instance_id=instance.uuid)
    session_id = self._session.get_session_id()
    path = ('/console?ref=%s&session_id=%s' % (str(vm_ref), session_id))
    return ctype.ConsoleVNC(host=CONF.vnc.vncserver_proxyclient_address, port=80, internal_access_path=path)
