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

Re: [virt-tools-list] [PATCH]virtinst: Add address type configuration for network device



On 03/05/2012 01:31 AM, Li Zhang wrote:
> Address type can be set as spapr-vio for newtwork
> device on pseries guest.So address type configuration 
> for network device should be added.
> 

Please include unit tests, similarly to your recent patches.

Thanks,
Cole

> Signed-off-by: Li Zhang <zhlcindy linux vnet ibm com>
> ---
>  virtinst/Guest.py                   |    3 ++-
>  virtinst/VirtualNetworkInterface.py |    5 +++++
>  2 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/virtinst/Guest.py b/virtinst/Guest.py
> index 8e6496c..cd529aa 100644
> --- a/virtinst/Guest.py
> +++ b/virtinst/Guest.py
> @@ -881,7 +881,8 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
>          # Build XML
>          for dev in devs:
>              xml = _util.xml_append(xml, get_dev_xml(dev))
> -            if dev.address.type == "spapr-vio":
> +            if (dev.address.type == "spapr-vio" and
> +                  dev.virtual_device_type == virtinst.VirtualDevice.VIRTUAL_DEV_DISK):
>                  xml = _util.xml_append(xml, get_vscsi_ctrl_xml())
>  
>          return xml
> diff --git a/virtinst/VirtualNetworkInterface.py b/virtinst/VirtualNetworkInterface.py
> index 4b0761d..37a51e6 100644
> --- a/virtinst/VirtualNetworkInterface.py
> +++ b/virtinst/VirtualNetworkInterface.py
> @@ -360,6 +360,7 @@ class VirtualNetworkInterface(VirtualDevice.VirtualDevice):
>          src_xml = ""
>          model_xml = ""
>          target_xml = ""
> +        addr_xml = ""
>          if self.type == self.TYPE_BRIDGE:
>              src_xml     = "      <source bridge='%s'/>\n" % self.bridge
>          elif self.type == self.TYPE_VIRTUAL:
> @@ -372,6 +373,9 @@ class VirtualNetworkInterface(VirtualDevice.VirtualDevice):
>          if self.model:
>              model_xml   = "      <model type='%s'/>\n" % self.model
>  
> +        if self.address:
> +            addr_xml = self.indent(self.address.get_xml_config(), 6)
> +
>          if self.target_dev:
>              target_xml  = "      <target dev='%s'/>\n" % self.target_dev
>  
> @@ -380,6 +384,7 @@ class VirtualNetworkInterface(VirtualDevice.VirtualDevice):
>          xml += "      <mac address='%s'/>\n" % self.macaddr
>          xml += target_xml
>          xml += model_xml
> +        xml += addr_xml
>          xml += "    </interface>"
>          return xml
>  


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