def swap_xapi_host(url, host_addr):
 temp_url = urlparse.urlparse(url)
 temp_netloc = temp_url.netloc.replace(temp_url.hostname, ('%s' % host_addr))
 replaced = temp_url._replace(netloc=temp_netloc)
 return urlparse.urlunparse(replaced)

def swap_xapi_host ( url , host_addr ) : temp_url = urlparse . urlparse ( url ) temp_netloc = temp_url . netloc . replace ( temp_url . hostname , ( '%s' % host_addr ) ) replaced = temp_url . _replace ( netloc = temp_netloc ) return urlparse . urlunparse ( replaced )
replace the xenserver address present in url with host_addr .