On Fri, Jan 31, 2014 at 11:46 AM, Jose A. Lopes <[email protected]> wrote:
> This is necessary in order to create TAP interfaces for the
> communication mechanism, which are named 'gnt.com.%d', where '%d' is a
> unique number within a given node.
>
> Signed-off-by: Jose A. Lopes <[email protected]>
> ---
>  lib/hypervisor/hv_kvm.py | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py
> index 3295482..1440d1a 100644
> --- a/lib/hypervisor/hv_kvm.py
> +++ b/lib/hypervisor/hv_kvm.py
> @@ -283,7 +283,7 @@ def _ProbeTapVnetHdr(fd, _features_fn=_GetTunFeatures):
>    return result
>
>
> -def _OpenTap(vnet_hdr=True):
> +def _OpenTap(vnet_hdr=True, name=""):
>    """Open a new tap device and return its file descriptor.
>
>    This is intended to be used by a qemu-type hypervisor together with the 
> -net
> @@ -291,6 +291,11 @@ def _OpenTap(vnet_hdr=True):
>
>    @type vnet_hdr: boolean
>    @param vnet_hdr: Enable the VNET Header
> +
> +  @type name: string
> +  @param name: name for the TAP interface being created; if an empty
> +               string is passed, the OS will generate a unique name
> +
>    @return: (ifname, tapfd)
>    @rtype: tuple
>
> @@ -306,7 +311,7 @@ def _OpenTap(vnet_hdr=True):
>      flags |= IFF_VNET_HDR
>
>    # The struct ifreq ioctl request (see netdevice(7))
> -  ifr = struct.pack("16sh", "", flags)
> +  ifr = struct.pack("16sh", name, flags)
>
>    try:
>      res = fcntl.ioctl(tapfd, TUNSETIFF, ifr)
> --
> 1.8.5.3
>

LGTM, thanks.
Michele

-- 
Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to