def _determine_vm_ip(self, vm_name):
        ssh_opt = "-o StrictHostKeyChecking=no"
        script_path = os.path.dirname(__file__) + "/virsh/get_domain_ip.sh"

        cmd = ["scp", ssh_opt, script_path,
               "%s:~/get_domain_ip.sh" % self.config["connection"]]
        subprocess.check_call(cmd)

        tries = 0
        ip = None
        while tries < 3 and not ip:
            cmd = ["ssh", ssh_opt, self.config["connection"],
                   "./get_domain_ip.sh", vm_name]
            out = subprocess.check_output(cmd)
            try:
                ip = netaddr.IPAddress(out)
            except netaddr.core.AddrFormatError:
                ip = None
            tries += 1
            time.sleep(10)
        # TODO(akscram): In case of None this method returns result "None".
        return str(ip)
dataset/ETHPy150Open openstack/rally/rally/deployment/serverprovider/providers/virsh.py/VirshProvider._determine_vm_ip/original