

def _deploy_instance_on_random_host(self, one_instance, availability_zone):
    one_instance = copy.deepcopy(message)
    dst_compute = self.dst_cloud.resources[utils.COMPUTE_RESOURCE]
    _instance = one_instance[utils.INSTANCES_TYPE].values()[0]
    instance_body = _instance[utils.INSTANCE_BODY]
    hosts = dst_compute.get_compute_hosts(availability_zone)
    if (not hosts):
        message = "No hosts in availability zone '{az}' found on destination.".format(az=availability_zone)
        raise DestinationCloudNotOperational(message)
    random.shuffle(hosts)
    while hosts:
        one_instance = network_utils.prepare_networks(one_instance, self.cfg.migrate.keep_ip, self.dst_cloud.resources[utils.NETWORK_RESOURCE], self.dst_cloud.resources[utils.IDENTITY_RESOURCE])
        if self.cfg.migrate.keep_floatingip:
            network_utils.associate_floatingip(one_instance, self.dst_cloud.resources[utils.NETWORK_RESOURCE])
        next_host = hosts.pop()
        host_az = ':'.join([availability_zone, next_host])
        _updated_instance = one_instance[utils.INSTANCES_TYPE].values()[0]
        updated_instance_body = _updated_instance[utils.INSTANCE_BODY]
        try:
            new_id = dst_compute.deploy(updated_instance_body, availability_zone=host_az)
            return (one_instance, new_id)
        except exception.TimeoutException:
            pass
    message = "Unable to schedule VM '{vm}' on any of available compute nodes.".format(vm=instance_body['name'])
    LOG.error(message)
    raise DestinationCloudNotOperational(message)

dataset/ETHPy150Open MirantisWorkloadMobility/CloudFerry/cloudferry/lib/os/actions/transport_instance.py TransportInstance._deploy_instance_on_random_host/VarMisuse@20/33 `one_instance`->`message`