[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [virt-tools-list] [RFC] enable direct interface selection



On 03/25/2011 11:33 AM, Gerhard Stenzel wrote:
> Hi,
> here are two patches to enable direct interface selection when defining
> a new VM. One is for virtinst and one is for virt-manager. I combine
> them in one posting because they are closely related.
> 
> If the approach looks okay, I am happy to resend as attachments if
> necessary.
> If the approach looks not okay, please advice ....
> 
> 
> 

Thanks for the patches, though they are line wrapped, probably from just
pasting into your mail client. Since we are using git now, it's probably worth
configuring git send-email and sending patches directly to the list that way.
Please also send 2 separate patches, specifying either virtinst: or
virt-manager: in the subject

> 
> 
> The following patch adds support to select direct interfaces
> when defining a virtual machine via virt-manager
> 
> Signed-off-by: Gerhard Stenzel <gerhard stenzel de ibm com>
> 
> virtinst:
> 
> diff --git a/virtinst/VirtualNetworkInterface.py
> b/virtinst/VirtualNetworkInterface.py
> index 65bfe2b..ae20d05 100644
> --- a/virtinst/VirtualNetworkInterface.py
> +++ b/virtinst/VirtualNetworkInterface.py
> @@ -352,6 +352,8 @@ class
> VirtualNetworkInterface(VirtualDevice.VirtualDevice):
>              src_xml     = "      <source network='%s'/>\n" %
> self.network
>          elif self.type == self.TYPE_ETHERNET and self.source_dev:
>              src_xml     = "      <source dev='%s'/>\n" %
> self.source_dev
> +        elif self.type == self.TYPE_DIRECT and self.bridge:
> +            src_xml     = "      <source dev='%s' mode='vepa'/>\n" %
> self.bridge

We should use source_dev instead of bridge here.

>  
>          if self.model:
>              model_xml   = "      <model type='%s'/>\n" % self.model
> 
> 
> virt-manager
> 
> Index: virt-manager/src/virtManager/uihelpers.py
> ===================================================================
> --- virt-manager.orig/src/virtManager/uihelpers.py
> +++ virt-manager/src/virtManager/uihelpers.py
> @@ -440,8 +440,10 @@ def populate_network_list(net_list, conn
>                  bridge_name = name
>                  brlabel = _("(Empty bridge)")
>          else:
> -            sensitive = False
> -            brlabel = "(%s)" % _("Not bridged")
> +            sensitive = True
> +            nettype = VirtualNetworkInterface.TYPE_DIRECT
> +            bridge_name = name
> +            brlabel = ": %s" % _("direct")
>  
>          label = _("Host device %s %s") % (br.get_name(), brlabel)
>          if hasShared and not brIdxLabel:
> @@ -530,6 +532,8 @@ def validate_network(parent, conn, netty
>              netname = devname
>          elif nettype == VirtualNetworkInterface.TYPE_BRIDGE:
>              bridge = devname
> +        elif nettype == VirtualNetworkInterface.TYPE_DIRECT:
> +            bridge = devname
>          elif nettype == VirtualNetworkInterface.TYPE_USER:
>              pass
>  
> 

We probably only want to enable this option for qemu connection and a
sufficiently new libvirt. You can enable this by adding a check in
virtinst/support.py, just follow the example for
SUPPORT_CONN_HV_CHAR_SPICEVMC, but set the qemu version to 0 instead of 14000.

Just to make sure I understand this correctly, a 'direct' interface in this
context uses macvtap/macvlan to fake a single nic into having multiple MAC
addresses, with the kernel multiplexing the network traffic as necc. Guests
will get IP addresses from the host network, similar to using a shared bridge.
Does this work with all hardware? Are there any downsides or caveats? Right
now you hardcode vepa mode, what is the functional difference between bridge
and vepa mode?

Thanks,
Cole


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]