bkearney | 5 Aug 22:37
Favicon

[PATCH] Multiple nic patch with DLutterkort's comments applied

# HG changeset patch
# User bkearney@...
# Date 1217876425 14400
# Node ID d9910a83bbf6a7aa85ebcc14f949071c9e9c5eb6
# Parent  6a207373b908ab521d33cd675c7c8d3854bdc1f1
multiple nic support for virt-image. Added support to allow multiple
interface elements in the virt-image.xml. The command line can specify
any number of -w or -b elements and the tool will add default networks
up to the number of nics specified. It is assumbed that eth0 is the first
item specified.

diff -r 6a207373b908 -r d9910a83bbf6 doc/image.rng
--- a/doc/image.rng	Tue Jul 29 11:21:07 2008 -0400
+++ b/doc/image.rng	Mon Aug 04 15:00:25 2008 -0400
@@ -47,8 +47,10 @@
       <element name="vcpu"><ref name="countCPU"/></element>
       <!-- Size of memory (in kB) -->
       <element name="memory"><ref name="memoryKB"/></element>
-      <!-- Whether the VM should have a network interface -->
-      <element name="interface"><empty/></element>
+      <!--The number of network interfaces which should exist -->
+      <zeroOrMore>
+        <element name="interface"><empty/></element>
+      </zeroOrMore>
       <!-- Whether the VM has a graphical interface -->
       <element name="graphics"><empty/></element>
     </element>
diff -r 6a207373b908 -r d9910a83bbf6 tests/image.py
--- a/tests/image.py	Tue Jul 29 11:21:07 2008 -0400
+++ b/tests/image.py	Mon Aug 04 15:00:25 2008 -0400
(Continue reading)

David Lutterkort | 5 Aug 23:28
Favicon

Re: [PATCH] Multiple nic patch with DLutterkort's comments applied

On Tue, 2008-08-05 at 16:39 -0400, bkearney@... wrote:
> diff -r 6a207373b908 -r d9910a83bbf6 virtinst/cli.py
> --- a/virtinst/cli.py	Tue Jul 29 11:21:07 2008 -0400
> +++ b/virtinst/cli.py	Mon Aug 04 15:00:25 2008 -0400
> @@ -262,41 +262,41 @@
>          fail(_("Unknown network type ") + network)
>      guest.nics.append(n)
>  
> -def digest_networks(macs, bridges, networks):
> +def digest_networks(macs, bridges, networks, nics = 1):
>      if type(bridges) != list and bridges != None:
>          bridges = [ bridges ]
>  
> -    if type(macs) != list and macs != None:
> +    if macs is None:
> +        macs = []
> +    elif type(macs) != list:
>          macs = [ macs ]
> -
> -    if type(networks) != list and networks != None:
> -        networks = [ networks ]
> +        	
> +    if networks is None:
> +        networks = []
> +    elif type(networks) != list:
> +        networks = [ macs ]
>  
>      if bridges is not None and networks != None:
>          fail(_("Cannot mix both --bridge and --network arguments"))
>  
(Continue reading)

Bryan Kearney | 6 Aug 14:08
Favicon

Re: [PATCH] Multiple nic patch with DLutterkort's comments applied


David Lutterkort wrote:
> On Tue, 2008-08-05 at 16:39 -0400, bkearney@... wrote:
>> diff -r 6a207373b908 -r d9910a83bbf6 virtinst/cli.py
>> --- a/virtinst/cli.py	Tue Jul 29 11:21:07 2008 -0400
>> +++ b/virtinst/cli.py	Mon Aug 04 15:00:25 2008 -0400
>> @@ -262,41 +262,41 @@
>>          fail(_("Unknown network type ") + network)
>>      guest.nics.append(n)
>>  
>> -def digest_networks(macs, bridges, networks):
>> +def digest_networks(macs, bridges, networks, nics = 1):
>>      if type(bridges) != list and bridges != None:
>>          bridges = [ bridges ]
>>  
>> -    if type(macs) != list and macs != None:
>> +    if macs is None:
>> +        macs = []
>> +    elif type(macs) != list:
>>          macs = [ macs ]
>> -
>> -    if type(networks) != list and networks != None:
>> -        networks = [ networks ]
>> +        	
>> +    if networks is None:
>> +        networks = []
>> +    elif type(networks) != list:
>> +        networks = [ macs ]
>>  
>>      if bridges is not None and networks != None:
(Continue reading)


Gmane