[virt-tools-list] [virt-manager PATCH] sshtunnels: resolve the name if host is specified
Cole Robinson
crobinso at redhat.com
Wed May 6 17:03:53 UTC 2015
On 05/06/2015 01:01 PM, Cole Robinson wrote:
> On 05/06/2015 08:29 AM, Giuseppe Scrivano wrote:
>> bug introduced with commit a2d453f3e20d103a4767394300c5183fde9a6bb4
>>
>> Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1218958
>>
>> Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
>> ---
>> virtManager/sshtunnels.py | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/virtManager/sshtunnels.py b/virtManager/sshtunnels.py
>> index 53f43be..263a6ed 100644
>> --- a/virtManager/sshtunnels.py
>> +++ b/virtManager/sshtunnels.py
>> @@ -48,6 +48,8 @@ class ConnectionInfo(object):
>> self._connhost = "127.0.0.1"
>>
>> def _is_listen_localhost(self, host=None):
>> + if host:
>> + host = socket.gethostbyname(host)
>> return ipaddr.IPNetwork(host or self.gaddr).is_loopback
>>
>> def _is_listen_any(self):
>>
>
> gethostbyname will throw an exception if the host name isn't resolvable.
>
> I think we should just wrap the IPNetwork check in try:/except, and if it
> errors we return True. This is really just meant to be a best effort check
>
We need to do the same for _is_listen_any as well, since <graphics listen=...
can be a hostname too, libvirt/qemu doesn't restrict it
- Cole
More information about the virt-tools-list
mailing list