Skip to content

Allow VSOCK as Ansible host#816

Open
francoisfreitag wants to merge 1 commit intopytest-dev:mainfrom
francoisfreitag:ff/vsock
Open

Allow VSOCK as Ansible host#816
francoisfreitag wants to merge 1 commit intopytest-dev:mainfrom
francoisfreitag:ff/vsock

Conversation

@francoisfreitag
Copy link
Contributor

@francoisfreitag francoisfreitag commented Feb 28, 2026

From https://man.archlinux.org/man/vsock.7:

The VSOCK address family facilitates communication between virtual machines and the host they are running on.

An example: https://wiki.archlinux.org/title/QEMU#Accessing_SSH_via_vsock

The separator between the "vsock" identifier and the CID can either be a forward slash (/) or a percent sign (%). urllib.parse.urlparse will mistake the forward slash for the beginning of the URL path, but a percent sign is accepted.

>>> urlparse("ansible://vsock/555")
ParseResult(scheme='ansible', netloc='vsock', path='/555', params='', query='', fragment='')
>>> urlparse("ansible://vsock%555")
ParseResult(scheme='ansible', netloc='vsock%555', path='', params='', query='', fragment='')

@francoisfreitag francoisfreitag changed the title Allow VSOCK in Ansible hostnames Allow VSOCK as Ansible host Feb 28, 2026
From https://man.archlinux.org/man/vsock.7:
> The VSOCK address family facilitates communication between virtual
  machines and the host they are running on.

An example:
https://wiki.archlinux.org/title/QEMU#Accessing_SSH_via_vsock

The separator between the "vsock" identifier and the CID can either be a
forward slash (`/`) or a percent sign (`%`). `urllib.parse.urlparse`
will mistake the forward slash for the beginning of the URL path, but a
percent sign is accepted.

```
>>> urlparse("ansible://vsock/555")
ParseResult(scheme='ansible', netloc='vsock', path='/555', params='', query='', fragment='')
>>> urlparse("ansible://vsock%555")
ParseResult(scheme='ansible', netloc='vsock%555', path='', params='', query='', fragment='')
```
spec += "[" + testinfra_host + "]"
else:
spec += testinfra_host
spec += urllib.parse.quote(testinfra_host)
Copy link
Contributor Author

@francoisfreitag francoisfreitag Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches

name = urllib.parse.unquote(name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant