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

Re: [libvirt] Providing custom arguments/environment to network scripts



On Wed, May 23, 2012 at 03:49:00PM +0200, Tore Anderson wrote:
> I'm trying to build a setup where the VMs only have point-to-point
> Ethernet connections to the hypervisor, which will then act as a layer-3
> router. When the VM starts, the hypervisor needs to UP the assigned tap
> interface and configure an IP/mask on it (that will be the VMs default
> gateway). So I'm currently looking at a config looking like this:
> 
> <interface type='ethernet'>
>   <script path='/sbin/vm-ifup'/>
> </interface>
> 
> The problem I'm facing is that there appears to be no way supply
> information to the script by way of command-line arguments or custom
> environment variables. So something like:
> 
> <script path='/sbin/vm-ifup 2001:db8::/64'/>
> 
> ...fails because it tries to execute the whole string, space included,
> as the script file.
> 
> The only information I have available in the script is the assigned tap
> device in the hypervisor (which is automatically passed in as the first
> argument to the script). As the device name is automatically assigned on
> VM start, it is useless as a lookup key of sorts for finding more
> information. One workaround would be to have one network script per VM
> that hard-codes all the necessary information, but if you have a large
> number of hypervisors with an even larger number of VMs, this quickly
> becomes impractical.
> 
> So my question is, is there some other way to pass configuration
> information to the network script or to accomplish what I'm trying to do?

The device name does not have to be auto-assigned. As long as you provide
a tap device name that does not have the prefix 'vnetXXX', then libvirt
will honour that tap device name. So the simple option would be to make
sure your VMs are given a TAP device name like  'vmFOO' where 'FOO' is the
name of the guest.


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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