'Create a cluster from acceptance test environment variables.
See the Flocker documentation acceptance testing page for more details.
:param dict env: Dictionary mapping acceptance test environment names
to values.
:return: A ``BenchmarkCluster`` instance.
:raise KeyError: if expected environment variables do not exist.
:raise ValueError: if environment variables are malformed.
:raise jsonschema.ValidationError: if host mapping is not a valid
format.'

@classmethod
def from_acceptance_test_env(cls, env):

    control_node_address = env['FLOCKER_ACCEPTANCE_CONTROL_NODE']
    certs = FilePath(env['FLOCKER_ACCEPTANCE_API_CERTIFICATES_PATH'])
    try:
        host_to_public = json.loads(env['FLOCKER_ACCEPTANCE_HOSTNAME_TO_PUBLIC_ADDRESS'])
        validate_host_mapping(host_to_public)
        public_addresses = {IPAddress(k): IPAddress(v) for (k, v) in host_to_public.items()}
    except ValueError as e:
        raise type(e)(':    '.join((('FLOCKER_ACCEPTANCE_HOSTNAME_TO_PUBLIC_ADDRESS',) + e.args)))
    control_service = partial(FlockerClient, host=control_node_address, port=4523, ca_cluster_path=certs.child('cluster.crt'), cert_path=certs.child('user.crt'), key_path=certs.child('user.key'))
    try:
        control_node_ip = IPAddress(control_node_address)
    except ValueError as e:
        raise type(e)(':    '.join((('FLOCKER_ACCEPTANCE_CONTROL_NODE',) + e.args)))
    try:
        default_volume_size = int(env['FLOCKER_ACCEPTANCE_DEFAULT_VOLUME_SIZE'])
    except ValueError as e:
        raise type(e)(':    '.join((('FLOCKER_ACCEPTANCE_DEFAULT_VOLUME_SIZE',) + e.args)))
    return cls(control_node_ip, control_service, public_addresses, default_volume_size)
